Package com.kheops.jmap.net
Class JMapInProcessConnection
java.lang.Object
com.kheops.jmap.net.JMapConnection
com.kheops.jmap.net.JMapInProcessConnection
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 Summary
-
Method Summary
Modifier and TypeMethodDescriptionboolean
cancelRequest
(JMapRequest pushedRequest) Method that cancels a previously pushed request.void
close()
This method has no effect on this connection.static Object
deserializeObject
(byte[] bytes) byte[]
executeRequest
(byte[] requestBytes) Blocking method that sends a pre-serialized request (byte array) to JMapServer and returns the serialized response object (byte array) obtained from JMapServer.executeRequest
(JMapRequest request) Blocking method that sends a request to JMapServer and returns the response object obtained from JMapServer.boolean
void
pushRequest
(JMapRequest request) Non-blocking method that pushes a request in the queue.Methods inherited from class com.kheops.jmap.net.JMapConnection
pingServer
-
Constructor Details
-
JMapInProcessConnection
-
-
Method Details
-
pushRequest
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 itscallback
method.- Specified by:
pushRequest
in classJMapConnection
- Parameters:
request
- the request to send to JMapServer- See Also:
-
executeRequest
Blocking method that sends a request to JMapServer and returns the response object obtained from JMapServer.- Specified by:
executeRequest
in classJMapConnection
- Parameters:
request
- the request to send to JMapServer- Returns:
- the response from JMapServer
-
cancelRequest
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
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 classJMapConnection
- Parameters:
requestBytes
- the request to send to JMapServer- Returns:
- the response from JMapServer
- Throws:
IOException
- if a serialization error occurs.
-
deserializeObject
- Throws:
IOException
-
isConnected
public boolean isConnected()- Specified by:
isConnected
in classJMapConnection
-
close
public void close()This method has no effect on this connection.- Specified by:
close
in classJMapConnection
-