Package org.jppf.nio.acceptor
Class AcceptorContext
java.lang.Object
org.jppf.nio.AbstractNioContext
org.jppf.nio.acceptor.AcceptorContext
- All Implemented Interfaces:
CloseableContext,NioChannelHandler,NioContext
Context associated with a channel serving tasks to a node.
- Author:
- Laurent Cohen
-
Field Summary
Fields inherited from class org.jppf.nio.AbstractNioContext
closed, connectionUuid, enabled, inSnapshot, local, onCloseAction, outSnapshot, peer, readByteCount, readMessage, socketChannel, ssl, sslHandler, uuid, writeByteCount, writeMessage -
Constructor Summary
ConstructorsConstructorDescriptionAcceptorContext(AcceptorNioServer server, ServerSocketChannel serverSocketChannel, SocketChannel socketChannel, JPPFStatistics stats) -
Method Summary
Methods inherited from class org.jppf.nio.AbstractNioContext
getConnectionUuid, getInterestOps, getReadMessage, getSelectionKey, getSocketChannel, getSSLHandler, getUuid, getWriteMessage, isClosed, isEnabled, isLocal, isPeer, isSecure, isSsl, nextMessageToSend, onClose, setClosed, setConnectionUuid, setEnabled, setInterestOps, setLocal, setOnCloseAction, setPeer, setReadMessage, setSelectionKey, setSsl, setSSLHandler, setUuid, setWriteMessage
-
Constructor Details
-
AcceptorContext
public AcceptorContext(AcceptorNioServer server, ServerSocketChannel serverSocketChannel, SocketChannel socketChannel, JPPFStatistics stats) - Parameters:
server- the acceptor server.serverSocketChannel- the server socket channel that accepted the connection.socketChannel- the socket channel that represent the connection.stats- the statsistics to update, if any.
-
-
Method Details
-
readMessage
Read data from a channel. This method reads a single integer which identifies the type of the channel.- Returns:
- true if all the data has been read, false otherwise.
- Throws:
Exception- if an error occurs while reading the data.- See Also:
-
handleException
Description copied from interface:NioContextHandle the cleanup when an exception occurs on the channel.- Parameters:
e- exception.
-
getId
public int getId()get the identifier for the channel.- Returns:
- the identifier as an int value.
-
getServerSocketChannel
- Returns:
- the server socket channel that accepted the connection.
-
writeMessage
Description copied from interface:NioContextWrite data to a channel.- Returns:
- true if all the data has been written, false otherwise.
- Throws:
Exception- if an error occurs while writing the data.
-
toString
- Overrides:
toStringin classAbstractNioContext
-