Package net.sf.eBus.config
Class EConfigure.RemoteConnection
- java.lang.Object
-
- net.sf.eBus.config.EConfigure.AbstractConfig
-
- net.sf.eBus.config.EConfigure.RemoteConnection
-
- All Implemented Interfaces:
Comparable<EConfigure.RemoteConnection>
- Enclosing class:
- EConfigure
public static final class EConfigure.RemoteConnection extends EConfigure.AbstractConfig implements Comparable<EConfigure.RemoteConnection>
This immutable class stores the information pertaining to a remote eBus connection. The remote connection JSON properties are:Remote Connection JSON Properties Property Required? Type Default Description nameYes StringNA Unique remote connection name. Duplicate names within the connections array are not allowd. connectionTypeNo EConfigure.ConnectionTypeEConfigure.ConnectionType.TCPProtocol used to establish connection to remote eBus peer. EConfigure.ConnectionType.SECURE_TCPandEConfigure.ConnectionType.SECURE_UDPare not allowed when defined in a configuration file since this requires placing sensitive information in the clear in this file.hostYes StringNA eBus peer host specified either as a name or in dotted notation. portYes intNA eBus peer port. Must be an integer value > zero and < 65,536. bindHostNo StringWildcard address Bind connection local host to this value. If set to nullthen local address is bound to the wildcard address.bindPort No intENetConfigure.ANY_PORTBind connection local port to this value. If set to ENetConfigure.ANY_PORTthen local port is bound to any available ephemeral port.inputBufferSizeNo intENetConfigure.DEFAULT_BUFFER_SIZEConnection input buffer size. Limits number of bytes received at one time. outputBufferSizeNo intENetConfigure.DEFAULT_BUFFER_SIZEConnection output buffer size. Limits number of bytes transmitted at one time. byteOrderNo ByteOrderEConfigure.DEFAULT_BYTE_ORDEReBus messages are encode/decoded in this byte order. messageQueueSizeNo intEConfigure.DEFAULT_QUEUE_SIZEOutbound message queue size. A zero queue size means the queue size is unlimited. Used only for TCP connection types. selectorNo StringDefault eBus selector. Remote connection channel is monitored by this eBus selector thread. reconnectNo booleanfalseIf true, then reconnects after unexpected connection loss. Used only for TCP connection types.reconnectTimeYes if reconnectistrueintfollowed by time unit. Example:15 secondsZero Wait this time limit after disconnecting and each reconnect attempt. heartbeatDelayNo intfollowed by time unit. Example:30 secondsEConfigure.DEFAULT_HEARTBEAT_DELAYWait this delay after latest inbound message before sending heartbeat message. If zero then heartbeating is turned off. heartbeatReplyDelayNo intfollowed by time unit. Example:500 millisecondsEConfigure.DEFAULT_HEARTBEAT_REPLY_DELAYWait this time limit for a reply to a heartbeat message. A zero setting means wait indefinitely. If heartbeatDelayis zero, then this value is ignored.canPauseNo booleanfalseIf true, then this connection may be paused according toEConfigure.PauseConfigsettings.Example remote connection configuration.
name : conn1 host : "127.0.0.1" port : 12346 bindPort : 54321 byteOrder : BIG_ENDIAN selector : selector1 inputBufferSize : 8192 outputBufferSize : 65536 messageQueueSize : 100 reconnect : true reconnectTime : 500ms canPause : false- See Also:
EConfigure.Service,EConfigure.PauseConfig
-
-
Field Summary
-
Fields inherited from class net.sf.eBus.config.EConfigure.AbstractConfig
mByteOrder, mCanPause, mConnectionType, mHbDelay, mHbReplyDelay, mInputBufferSize, mMsgQueueSize, mName, mOutputBufferSize, mPauseConfig, mRetransmitDelay, mRetransmitLimit, mSSLContext
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description InetSocketAddressaddress()Returns the remote eBus socket address.InetSocketAddressbindAddress()Returns the connection bind host and port to which local address is bound.intcompareTo(EConfigure.RemoteConnection conn)Comparesthisremote connection configuration withconn.booleanequals(Object o)Returnstrueifois a non-nullRemoteConnectioninstance with the same name;falseotherwise.inthashCode()Returns the remote connection address hash code.booleanreconnectFlag()Returnstrueif connection is to be re-established when lost.DurationreconnectTime()Returns the reconnect delay.Stringselector()Returns the selector information to which this connection is registered.StringtoString()Returns a text representation for this remote connection.-
Methods inherited from class net.sf.eBus.config.EConfigure.AbstractConfig
byteOrder, canPause, connectionType, heartbeatDelay, heartbeatReplyDelay, inputBufferSize, messageQueueSize, name, outputBufferSize, pauseConfiguration, retransmitDelay, retransmitLimit, sslContext
-
-
-
-
Method Detail
-
compareTo
public int compareTo(EConfigure.RemoteConnection conn)
Comparesthisremote connection configuration withconn.- Specified by:
compareToin interfaceComparable<EConfigure.RemoteConnection>- Parameters:
conn- compare with this object.- Returns:
- < zero if
thisinstance is less thanconn; zero ifthisinstance is equal toconn; > zero ifthisis greater thanconn.
-
equals
public boolean equals(Object o)
Returnstrueifois a non-nullRemoteConnectioninstance with the same name;falseotherwise.
-
hashCode
public int hashCode()
Returns the remote connection address hash code.
-
toString
public String toString()
Returns a text representation for this remote connection.
-
address
public InetSocketAddress address()
Returns the remote eBus socket address.- Returns:
- the remote eBus socket address.
-
bindAddress
public InetSocketAddress bindAddress()
Returns the connection bind host and port to which local address is bound.- Returns:
- the connection bind address.
-
selector
public String selector()
Returns the selector information to which this connection is registered.- Returns:
- selector information.
-
reconnectFlag
public boolean reconnectFlag()
Returnstrueif connection is to be re-established when lost.- Returns:
trueif connection is to be re-established when lost.
-
reconnectTime
public Duration reconnectTime()
Returns the reconnect delay.- Returns:
- the reconnect delay.
-
-