|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjadex.standalone.transport.tcpmtp.TCPTransport
public class TCPTransport
The tcp transport for sending messages over tcp/ip connections. Initiates one receiving tcp/ip port under the specified settings and opens outgoing connections for all remote platforms on demand. For the receiving side a separate listener thread is necessary as it must be continuously listened for incoming transmission requests.
| Nested Class Summary | |
|---|---|
protected class |
TCPTransport.Cleaner
Class for cleaning output connections after max keep alive time has been reached. |
| Field Summary | |
|---|---|
protected String[] |
addresses
The addresses. |
protected boolean |
async
Should be received asynchronously? |
static String |
ASYNCHRONOUS
Constant for asynchronous setting. |
protected static int |
BUFFER_SIZE
2MB as message buffer |
protected CodecFactory |
codecfac
The codec factory. |
protected Map |
connections
The opened connections for addresses. |
protected IServiceProvider |
container
The platform. |
protected static int |
DEFAULT_PORT
Default port. |
protected ILibraryService |
libservice
The library service. |
protected Logger |
logger
The logger. |
protected static int |
MAX_CONNECTIONS
Maximum number of outgoing connections |
protected static int |
MAX_KEEPALIVE
How long to keep output connections alive (5 min). |
protected int |
port
The port. |
static String |
PORT
The receiving port. |
protected static int |
PROLOG_SIZE
The prolog size. |
static String |
SCHEMA
The schema name. |
protected ServerSocket |
serversocket
The server socket for receiving messages. |
| Constructor Summary | |
|---|---|
TCPTransport(IServiceProvider container,
int port)
Init the transport. |
|
TCPTransport(IServiceProvider container,
int port,
boolean async)
Init the transport. |
|
| Method Summary | |
|---|---|
protected jadex.standalone.transport.tcpmtp.TCPOutputConnection |
createConnection(String address)
Create a outgoing connection. |
protected void |
deliverMessages(TCPInputConnection con)
Deliver messages to local message service for disptaching to the components. |
protected String |
getAddress(String hostname,
int port)
Get the address of this transport. |
String[] |
getAddresses()
Get the adresses of this transport. |
protected jadex.standalone.transport.tcpmtp.TCPOutputConnection |
getConnection(String address)
Get the connection. |
String |
getServiceSchema()
Returns the prefix of this transport |
protected void |
removeConnection(String address)
Remove a cached connection. |
IComponentIdentifier[] |
sendMessage(Map msg,
String type,
IComponentIdentifier[] receivers)
Send a message. |
void |
shutdown()
Perform cleanup operations (if any). |
void |
start()
Start the transport. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final String SCHEMA
public static final String ASYNCHRONOUS
public static final String PORT
protected static final int MAX_KEEPALIVE
protected static final int PROLOG_SIZE
protected static final int BUFFER_SIZE
protected static final int MAX_CONNECTIONS
protected static final int DEFAULT_PORT
protected IServiceProvider container
protected String[] addresses
protected int port
protected ServerSocket serversocket
protected Map connections
protected boolean async
protected CodecFactory codecfac
protected Logger logger
protected ILibraryService libservice
| Constructor Detail |
|---|
public TCPTransport(IServiceProvider container,
int port)
platform - The platform.settings - The settings.
public TCPTransport(IServiceProvider container,
int port,
boolean async)
platform - The platform.settings - The settings.| Method Detail |
|---|
public void start()
start in interface ITransportpublic void shutdown()
shutdown in interface ITransport
public IComponentIdentifier[] sendMessage(Map msg,
String type,
IComponentIdentifier[] receivers)
sendMessage in interface ITransportmessage - The message to send.
(todo: On which thread this should be done?)
public String getServiceSchema()
getServiceSchema in interface ITransportpublic String[] getAddresses()
getAddresses in interface ITransport
protected String getAddress(String hostname,
int port)
hostname - The hostname.port - The port.
protected jadex.standalone.transport.tcpmtp.TCPOutputConnection getConnection(String address)
address -
protected jadex.standalone.transport.tcpmtp.TCPOutputConnection createConnection(String address)
address - The connection address.
protected void removeConnection(String address)
address - The address.protected void deliverMessages(TCPInputConnection con)
con - The connection.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||