|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object fulmine.distribution.connection.tcp.TcpNetwork
public class TcpNetwork
Creates components that connect using TCP/IP.
Field Summary |
---|
Fields inherited from interface fulmine.distribution.IHeartbeatMonitor |
---|
DEFAULT_ALLOWED_MISSED_COUNT, DEFAULT_HEARTBEAT_PERIOD |
Constructor Summary | |
---|---|
TcpNetwork()
Default constructor that reads system properties for the IP address and TCP port to use. |
|
TcpNetwork(String address,
int port)
Construct the network to use specific parameters for the IP address and TCP port of the network connection for the context. |
|
TcpNetwork(String hostAddress,
int tcpPort,
String udpNetwork,
int udpPort,
String udpNic)
Construct the network to use specifying specific parameters for: the IP address and TCP port of the network connection for the context the UDP connection parameters for the discoverer |
Method Summary | |
---|---|
IConnectionBroker |
createBroker()
Create a connection broker. |
IChannel |
createChannel(IConnection connection)
Create a channel |
IConnectionDiscoverer |
createDiscoverer()
Create a connection discoverer. |
int |
getAllowableNetworkHeartbeatMissCount()
Get the number of allowed missed heartbeats before a remote context is deemed to be not available. |
long |
getNetworkHeartbeatPeriod()
Get the heartbeat period in milliseconds. |
boolean |
isListeningOnlyMode()
Get the value of the listening only mode |
void |
setAllowableNetworkHeartbeatMissCount(int allowedHeartbeatMissCount)
Set the allowable number of missed heartbeats from other contexts on the network before that context is deemed to be not available anymore. |
void |
setContext(IFrameworkContext context)
Set the context this network services |
void |
setListeningOnlyMode(boolean listeningOnlyMode)
Sets the IConnectionDiscoverer returned from
INetwork.createDiscoverer() into listening-only mode. |
void |
setNetworkHeartbeatPeriod(long periodInMillis)
Set the network heartbeat period. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public TcpNetwork()
TcpConnectionBroker.CONTEXT_IP_ADDRESS
,
TcpConnectionBroker.CONTEXT_TCP_PORT
,
TcpConnectionBroker.DEFAULT_CONTEXT_TCP_PORT
,
AbstractConnectionDiscoverer.DEFAULT_UDP_DISCOVERY_NETWORK
,
AbstractConnectionDiscoverer.DEFAULT_UDP_DISCOVERY_PORT
public TcpNetwork(String address, int port)
address
- the IP address (or hostname) of the host, null
for the host address of the local hostport
- the TCP port for the context's network connection,
0
for
TcpConnectionBroker.DEFAULT_CONTEXT_TCP_PORT
public TcpNetwork(String hostAddress, int tcpPort, String udpNetwork, int udpPort, String udpNic)
hostAddress
- the IP address (or hostname) of the host, null
for the host address of the local hosttcpPort
- the TCP port for the context's network connection,
0
for
TcpConnectionBroker.DEFAULT_CONTEXT_TCP_PORT
udpNetwork
- the UDP network for the discovererudpPort
- the UDP port for the discovererudpNic
- the network interface card name to bind to, null
for defaultMethod Detail |
---|
public IConnectionBroker createBroker()
INetwork
createBroker
in interface INetwork
public IChannel createChannel(IConnection connection)
INetwork
createChannel
in interface INetwork
connection
- the connection for the channel
public IConnectionDiscoverer createDiscoverer()
INetwork
createDiscoverer
in interface INetwork
public void setContext(IFrameworkContext context)
INetwork
setContext
in interface INetwork
context
- the context this network servicespublic void setAllowableNetworkHeartbeatMissCount(int allowedHeartbeatMissCount)
IHeartbeatMonitor
setAllowableNetworkHeartbeatMissCount
in interface IHeartbeatMonitor
allowedHeartbeatMissCount
- the number of missed heartbeats allowed before a remote
context is deemed to be not availableIHeartbeatMonitor.setNetworkHeartbeatPeriod(long)
public void setNetworkHeartbeatPeriod(long periodInMillis)
IHeartbeatMonitor
As a general rule-of-thumb, the heartbeat period should be small and the allowed heartbeat miss count high. This provides more leniency for not cancelling a context if heartbeats are missed.
setNetworkHeartbeatPeriod
in interface IHeartbeatMonitor
periodInMillis
- the heartbeat period in millisecondspublic int getAllowableNetworkHeartbeatMissCount()
IHeartbeatMonitor
getAllowableNetworkHeartbeatMissCount
in interface IHeartbeatMonitor
public long getNetworkHeartbeatPeriod()
IHeartbeatMonitor
getNetworkHeartbeatPeriod
in interface IHeartbeatMonitor
public void setListeningOnlyMode(boolean listeningOnlyMode)
INetwork
IConnectionDiscoverer
returned from
INetwork.createDiscoverer()
into listening-only mode. This effectively
means that the discoverer will not send out pulses but will monitor the
pulses from other contexts.
Calling this after the discoverer is created and started will also cause the discoverer to go into listening-only mode.
setListeningOnlyMode
in interface INetwork
listeningOnlyMode
- true
if the discoverer should be in listening
only modeIConnectionDiscoverer.disablePulsing()
public boolean isListeningOnlyMode()
INetwork
isListeningOnlyMode
in interface INetwork
true
if the discoverer is in listening only mode
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |