Class MultithreadedTCPChannel<T>
java.lang.Object
pt.unl.fct.di.novasys.channel.tcp.MultithreadedTCPChannel<T>
- All Implemented Interfaces:
IChannel<T>
,AttributeValidator
,InConnListener<T>
,MessageListener<T>
,OutConnListener<T>
public class MultithreadedTCPChannel<T>
extends Object
implements IChannel<T>, MessageListener<T>, InConnListener<T>, OutConnListener<T>, AttributeValidator
Multithreaded channel with explicit openConnection.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final String
static final int
static final int
static final int
static final String
static final String
static final String
static final String
Fields inherited from interface pt.unl.fct.di.novasys.network.AttributeValidator
ALWAYS_VALID, CHANNEL_MAGIC_ATTRIBUTE
-
Constructor Summary
ConstructorsConstructorDescriptionMultithreadedTCPChannel
(ISerializer<T> serializer, ChannelListener<T> list, Properties properties) -
Method Summary
Modifier and TypeMethodDescriptionvoid
closeConnection
(Host peer, int connection) void
deliverMessage
(T msg, Connection<T> conn) Method that is called to deliver a message from the network layer to the applicationvoid
inboundConnectionDown
(Connection<T> conn, Throwable cause) void
inboundConnectionUp
(Connection<T> con) void
openConnection
(Host peer) void
outboundConnectionDown
(Connection<T> conn, Throwable cause) void
outboundConnectionFailed
(Connection<T> conn, Throwable cause) void
outboundConnectionUp
(Connection<T> conn) void
sendMessage
(T msg, Host peer, int connection) void
serverSocketBind
(boolean success, Throwable cause) void
serverSocketClose
(boolean success, Throwable cause) boolean
validateAttributes
(Attributes attr)
-
Field Details
-
NAME
- See Also:
-
ADDRESS_KEY
- See Also:
-
PORT_KEY
- See Also:
-
WORKER_GROUP_KEY
- See Also:
-
LISTEN_ADDRESS_ATTRIBUTE
- See Also:
-
DEFAULT_PORT
public static final int DEFAULT_PORT- See Also:
-
CONNECTION_OUT
public static final int CONNECTION_OUT- See Also:
-
CONNECTION_IN
public static final int CONNECTION_IN- See Also:
-
-
Constructor Details
-
MultithreadedTCPChannel
public MultithreadedTCPChannel(ISerializer<T> serializer, ChannelListener<T> list, Properties properties) throws IOException - Throws:
IOException
-
-
Method Details
-
openConnection
- Specified by:
openConnection
in interfaceIChannel<T>
-
sendMessage
- Specified by:
sendMessage
in interfaceIChannel<T>
-
closeConnection
- Specified by:
closeConnection
in interfaceIChannel<T>
-
outboundConnectionUp
- Specified by:
outboundConnectionUp
in interfaceOutConnListener<T>
-
outboundConnectionDown
- Specified by:
outboundConnectionDown
in interfaceOutConnListener<T>
-
outboundConnectionFailed
- Specified by:
outboundConnectionFailed
in interfaceOutConnListener<T>
-
inboundConnectionUp
- Specified by:
inboundConnectionUp
in interfaceInConnListener<T>
-
inboundConnectionDown
- Specified by:
inboundConnectionDown
in interfaceInConnListener<T>
-
deliverMessage
Description copied from interface:MessageListener
Method that is called to deliver a message from the network layer to the application- Specified by:
deliverMessage
in interfaceMessageListener<T>
- Parameters:
msg
- The received message
-
serverSocketBind
- Specified by:
serverSocketBind
in interfaceInConnListener<T>
-
serverSocketClose
- Specified by:
serverSocketClose
in interfaceInConnListener<T>
-
validateAttributes
- Specified by:
validateAttributes
in interfaceAttributeValidator
-