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 Stringstatic final intstatic final intstatic final intstatic final Stringstatic final Stringstatic final Stringstatic final StringFields 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 TypeMethodDescriptionvoidcloseConnection(Host peer, int connection) voiddeliverMessage(T msg, Connection<T> conn) Method that is called to deliver a message from the network layer to the applicationvoidinboundConnectionDown(Connection<T> conn, Throwable cause) voidinboundConnectionUp(Connection<T> con) voidopenConnection(Host peer) voidoutboundConnectionDown(Connection<T> conn, Throwable cause) voidoutboundConnectionFailed(Connection<T> conn, Throwable cause) voidoutboundConnectionUp(Connection<T> conn) voidsendMessage(T msg, Host peer, int connection) voidserverSocketBind(boolean success, Throwable cause) voidserverSocketClose(boolean success, Throwable cause) booleanvalidateAttributes(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:
openConnectionin interfaceIChannel<T>
-
sendMessage
- Specified by:
sendMessagein interfaceIChannel<T>
-
closeConnection
- Specified by:
closeConnectionin interfaceIChannel<T>
-
outboundConnectionUp
- Specified by:
outboundConnectionUpin interfaceOutConnListener<T>
-
outboundConnectionDown
- Specified by:
outboundConnectionDownin interfaceOutConnListener<T>
-
outboundConnectionFailed
- Specified by:
outboundConnectionFailedin interfaceOutConnListener<T>
-
inboundConnectionUp
- Specified by:
inboundConnectionUpin interfaceInConnListener<T>
-
inboundConnectionDown
- Specified by:
inboundConnectionDownin interfaceInConnListener<T>
-
deliverMessage
Description copied from interface:MessageListenerMethod that is called to deliver a message from the network layer to the application- Specified by:
deliverMessagein interfaceMessageListener<T>- Parameters:
msg- The received message
-
serverSocketBind
- Specified by:
serverSocketBindin interfaceInConnListener<T>
-
serverSocketClose
- Specified by:
serverSocketClosein interfaceInConnListener<T>
-
validateAttributes
- Specified by:
validateAttributesin interfaceAttributeValidator
-