Package org.jppf.jmxremote.nio
Class JMXContext
java.lang.Object
org.jppf.nio.AbstractNioContext
org.jppf.jmxremote.nio.JMXContext
- All Implemented Interfaces:
org.jppf.nio.CloseableContext,org.jppf.nio.NioChannelHandler,org.jppf.nio.NioContext
public class JMXContext
extends org.jppf.nio.AbstractNioContext
Context associated with a
JMXChannelWrapper.- 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
ConstructorsConstructorDescriptionJMXContext(JMXNioServer server, boolean reading, SocketChannel socketChannel, Map<String, ?> env) Initialize with the specified server. -
Method Summary
Modifier and TypeMethodDescriptiondeserializeMessage(org.jppf.nio.SimpleNioMessage message) Deserialize the specified message.intgetId()voidhandleException(Exception exception) booleanvoidofferJmxMessage(JMXMessage jmxMessage) Add a JMX message to the pending queue.org.jppf.jmxremote.nio.MessageWrapperGet the next JMX message from the pending queue.booleanvoidsetMessageHandler(JMXMessageHandler messageHandler) Set the object that handles messages correlations.toString()booleanMethods inherited from class org.jppf.nio.AbstractNioContext
getConnectionUuid, getInterestOps, getReadMessage, 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
-
JMXContext
public JMXContext(JMXNioServer server, boolean reading, SocketChannel socketChannel, Map<String, ?> env) Initialize with the specified server.- Parameters:
server- the JMX nio server to use.socketChannel- the associated socket channel.reading- whether the associated channel performs read operations (true) or write operations (false).env- the jmx environment parameters.
-
-
Method Details
-
handleException
-
getConnectionID
- Returns:
- the connection id.
-
deserializeMessage
Deserialize the specified message.- Parameters:
message- the message to deserialize.- Returns:
- a deserialzed message.
- Throws:
Exception- if any error occurs.
-
offerJmxMessage
Add a JMX message to the pending queue.- Parameters:
jmxMessage- the JMX message to offer.- Throws:
Exception- if any error occurs.
-
pollJmxMessage
public org.jppf.jmxremote.nio.MessageWrapper pollJmxMessage()Get the next JMX message from the pending queue.- Returns:
- a
JMXMessageinstance.
-
hasQueuedMessage
public boolean hasQueuedMessage()- Returns:
- whether there is at least one pending message.
-
getMessageHandler
- Returns:
- the object that handles messages correlations.
-
getChannels
- Returns:
- the ChannelsPair this context's channel is a part of.
-
setMessageHandler
Set the object that handles messages correlations.- Parameters:
messageHandler- aJMXMessageHandlerinstance.
-
toString
- Overrides:
toStringin classorg.jppf.nio.AbstractNioContext
-
getServer
- Returns:
- the JMX nio server to use.
-
getSelectionKey
- Specified by:
getSelectionKeyin interfaceorg.jppf.nio.NioChannelHandler- Overrides:
getSelectionKeyin classorg.jppf.nio.AbstractNioContext- Returns:
- the channel's selection key.
-
readMessage
- Throws:
Exception
-
writeMessage
- Throws:
Exception
-
getId
public int getId()- Returns:
- The unique id for this context.
-