|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object fulmine.AbstractLifeCycle fulmine.distribution.connection.tcp.TcpConnectionBroker
public final class TcpConnectionBroker
A connection broker implementation based on TCP/IP sockets. This has a single thread that handles input and output. This should be adequate as a context is usually the source or sink of data.
The TCP parameters are controlled by:
Field Summary | |
---|---|
static String |
CONTEXT_IP_ADDRESS
The system property for the IP address of the context server socket. |
static String |
CONTEXT_RCV_BUFFER
The system property for overriding the default receive buffer size for the server port. |
static String |
CONTEXT_TCP_PORT
The system property for the TCP port |
static int |
DEFAULT_CONTEXT_TCP_PORT
The default for the TCP port |
static String |
HOST_NAME
The host name |
Constructor Summary | |
---|---|
TcpConnectionBroker(IFrameworkContext context)
Default constructor that reads system properties for the IP address and TCP port to use. |
|
TcpConnectionBroker(IFrameworkContext context,
String address,
int port)
Construct the TcpConnectionBroker using parameters for the
identity, IP address and TCP port. |
Method Summary | |
---|---|
void |
connect(IConnectionParameters connectionParameters)
Connect to the remote context identified in the connection parameters. |
protected void |
doDestroy()
Overridden in subclasses to perform custom logic on destruction. |
protected void |
doStart()
Overridden in subclasses to perform custom logic on activation. |
String |
getAddress()
|
protected AsyncLog |
getLog()
Get the log to use for the object hierarchy |
int |
getPort()
|
String |
toString()
|
Methods inherited from class fulmine.AbstractLifeCycle |
---|
checkActive, destroy, finalize, isActive, start |
Methods inherited from class java.lang.Object |
---|
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Methods inherited from interface fulmine.distribution.connection.IConnectionBroker |
---|
start |
Methods inherited from interface fulmine.ILifeCycle |
---|
isActive |
Methods inherited from interface fulmine.IDestroyable |
---|
destroy |
Field Detail |
---|
public static final String CONTEXT_IP_ADDRESS
null
to accept on all addresses the
host uses.
public static final String CONTEXT_TCP_PORT
public static final int DEFAULT_CONTEXT_TCP_PORT
public static final String CONTEXT_RCV_BUFFER
public static final String HOST_NAME
Constructor Detail |
---|
public TcpConnectionBroker(IFrameworkContext context, String address, int port)
TcpConnectionBroker
using parameters for the
identity, IP address and TCP port.
context
- The context to use when subscribing for eventsaddress
- the IP address of the host of this TcpConnectionBroker
, null
for the host address of the local hostport
- the TCP port for thisTcpConnectionBroker
,
0
for DEFAULT_CONTEXT_TCP_PORT
public TcpConnectionBroker(IFrameworkContext context)
context
- The context to use when subscribing for eventsCONTEXT_IP_ADDRESS
,
CONTEXT_TCP_PORT
,
DEFAULT_CONTEXT_TCP_PORT
Method Detail |
---|
public String getAddress()
public int getPort()
protected void doDestroy()
AbstractLifeCycle
RuntimeException
or subclass
thereof.
doDestroy
in class AbstractLifeCycle
public void connect(IConnectionParameters connectionParameters)
IConnectionBroker
When available, the connection will be encapsulated in a
ConnectionAvailableEvent
and distributed using the event
framework. To receive the connection event, a listener should be
registered against the connection event typed source (
IEventManager.getSystemEventSource(Class)
).
connect
in interface IConnectionBroker
connectionParameters
- the parameters for creating the connectionprotected AsyncLog getLog()
AbstractLifeCycle
getLog
in class AbstractLifeCycle
protected void doStart()
AbstractLifeCycle
RuntimeException
or subclass
thereof. When this method is called, the AbstractLifeCycle.isActive()
method will
return true
.
doStart
in class AbstractLifeCycle
public String toString()
toString
in class AbstractLifeCycle
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |