Class AbstractAsyncClassContext

java.lang.Object
org.jppf.nio.AbstractNioContext
org.jppf.server.nio.classloader.AbstractAsyncClassContext
All Implemented Interfaces:
org.jppf.nio.CloseableContext, org.jppf.nio.NioChannelHandler, org.jppf.nio.NioContext
Direct Known Subclasses:
AsyncClientClassContext, AsyncNodeClassContext

public abstract class AbstractAsyncClassContext extends org.jppf.nio.AbstractNioContext
Context object associated with a socket channel used by the class server of the JPPF driver.
Author:
Laurent Cohen
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    protected final JPPFDriver
    Reference to the driver.
    protected final BlockingQueue<org.jppf.nio.ClassLoaderNioMessage>
    This queue contains all the result bundles to send back to the node.

    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

    Constructors
    Constructor
    Description
    AbstractAsyncClassContext(JPPFDriver driver, org.jppf.nio.StatelessNioServer<? extends AbstractAsyncClassContext> server)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    org.jppf.classloader.JPPFResourceWrapper
    deserializeResource(org.jppf.nio.ClassLoaderNioMessage message)
    Deserialize a resource wrapper from an array of bytes.
    static String
    getResourceName(org.jppf.classloader.JPPFResourceWrapper resource)
    Determine whether the specified resource is a request for a single resource definition.
    org.jppf.nio.StatelessNioServer<? extends AbstractAsyncClassContext>
     
    protected abstract boolean
    Determine whether this context relates to a provider or node connection.
    protected org.jppf.nio.ClassLoaderNioMessage
     
    boolean
     
    org.jppf.nio.ClassLoaderNioMessage
    serializeResource(org.jppf.classloader.JPPFResourceWrapper resource)
    Serialize a resource wrapper to an array of bytes.
    boolean
     

    Methods inherited from class org.jppf.nio.AbstractNioContext

    getConnectionUuid, getInterestOps, getReadMessage, getSelectionKey, getSocketChannel, getSSLHandler, getUuid, getWriteMessage, isClosed, isEnabled, isLocal, isPeer, isSecure, isSsl, onClose, setClosed, setConnectionUuid, setEnabled, setInterestOps, setLocal, setOnCloseAction, setPeer, setReadMessage, setSelectionKey, setSsl, setSSLHandler, setUuid, setWriteMessage, toString

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait

    Methods inherited from interface org.jppf.nio.NioContext

    handleException
  • Field Details

    • driver

      protected final JPPFDriver driver
      Reference to the driver.
    • sendQueue

      protected final BlockingQueue<org.jppf.nio.ClassLoaderNioMessage> sendQueue
      This queue contains all the result bundles to send back to the node.
  • Constructor Details

    • AbstractAsyncClassContext

      public AbstractAsyncClassContext(JPPFDriver driver, org.jppf.nio.StatelessNioServer<? extends AbstractAsyncClassContext> server)
      Parameters:
      driver - reference to the JPPF driver.
      server - the server handling this context.
  • Method Details

    • deserializeResource

      public org.jppf.classloader.JPPFResourceWrapper deserializeResource(org.jppf.nio.ClassLoaderNioMessage message) throws Exception
      Deserialize a resource wrapper from an array of bytes.
      Parameters:
      message - the message to deserialize.
      Returns:
      a JPPFResourceWrapper instance.
      Throws:
      Exception - if an error occurs while deserializing.
    • serializeResource

      public org.jppf.nio.ClassLoaderNioMessage serializeResource(org.jppf.classloader.JPPFResourceWrapper resource) throws Exception
      Serialize a resource wrapper to an array of bytes.
      Parameters:
      resource - the resource to serialize.
      Returns:
      a ClassLoaderNioMessage instance.
      Throws:
      Exception - if an error occurs while serializing.
    • isProvider

      protected abstract boolean isProvider()
      Determine whether this context relates to a provider or node connection.
      Returns:
      true if this is a provider context, false otherwise.
    • readMessage

      public boolean readMessage() throws Exception
      Throws:
      Exception
    • writeMessage

      public boolean writeMessage() throws Exception
      Throws:
      Exception
    • getResourceName

      public static String getResourceName(org.jppf.classloader.JPPFResourceWrapper resource)
      Determine whether the specified resource is a request for a single resource definition.
      Parameters:
      resource - the resource to check.
      Returns:
      true if the specified resource is a request for a single resource definition, false otherwise.
    • getServer

      public org.jppf.nio.StatelessNioServer<? extends AbstractAsyncClassContext> getServer()
      Returns:
      the Nio server handling this context.
    • nextMessageToSend

      protected org.jppf.nio.ClassLoaderNioMessage nextMessageToSend()
      Overrides:
      nextMessageToSend in class org.jppf.nio.AbstractNioContext