Class JMapInProcessConnection

java.lang.Object
com.kheops.jmap.net.JMapConnection
com.kheops.jmap.net.JMapInProcessConnection

public class JMapInProcessConnection extends JMapConnection
This class represents a direct connection between a client application and JMapServer running in the same process. It is used to as an abstraction layer to uniformize the communications with JMapServer running either in the same process or somewhere on a network.
See Also:
  • Constructor Details

    • JMapInProcessConnection

      public JMapInProcessConnection(JMapServer server)
  • Method Details

    • pushRequest

      public void pushRequest(JMapRequest request)
      Non-blocking method that pushes a request in the queue. Requests placed in the queue are sent to JMapServer one after the other. When the response is obtained from JMapServer, the client specified in the request object is notified through its callback method.
      Specified by:
      pushRequest in class JMapConnection
      Parameters:
      request - the request to send to JMapServer
      See Also:
    • executeRequest

      public JMapResponse executeRequest(JMapRequest request)
      Blocking method that sends a request to JMapServer and returns the response object obtained from JMapServer.
      Specified by:
      executeRequest in class JMapConnection
      Parameters:
      request - the request to send to JMapServer
      Returns:
      the response from JMapServer
    • cancelRequest

      public boolean cancelRequest(JMapRequest pushedRequest)
      Method that cancels a previously pushed request. The request will be cancelled ONLY if it is NOT currently in execution.
      Parameters:
      pushedRequest -
      Returns:
      true if the cancel was successful
    • executeRequest

      public byte[] executeRequest(byte[] requestBytes) throws IOException
      Blocking method that sends a pre-serialized request (byte array) to JMapServer and returns the serialized response object (byte array) obtained from JMapServer.
      Specified by:
      executeRequest in class JMapConnection
      Parameters:
      requestBytes - the request to send to JMapServer
      Returns:
      the response from JMapServer
      Throws:
      IOException - if a serialization error occurs.
    • deserializeObject

      public static Object deserializeObject(byte[] bytes) throws IOException
      Throws:
      IOException
    • isConnected

      public boolean isConnected()
      Specified by:
      isConnected in class JMapConnection
    • close

      public void close()
      This method has no effect on this connection.
      Specified by:
      close in class JMapConnection