Package org.rribbit.processing
Class RmiRequestProcessorImpl
java.lang.Object
org.rribbit.processing.RmiRequestProcessorImpl
- All Implemented Interfaces:
Remote
,RmiRequestProcessor
This
RequestProcessor
processes requests that it receives from an RmiRequestDispatcher
and returns the result via RMI. In order to use this RequestProcessor
,
all parameters and return values must implement Serializable
. Note that an RmiRequestProcessorImpl
is not actually an RequestProcessor
, because Java
RMI does not allow non-remote methods in a remote interface. This is not a problem though, since an RmiRequestProcessorImpl
receives its requests via RMI and not via a Java
interface.
Users of this class must call shutdown()
after use, to clean up the RMI Registry
.- Author:
- G.J. Schouten
-
Field Summary
Fields inherited from interface org.rribbit.processing.RmiRequestProcessor
REGISTRY_KEY
-
Constructor Summary
ConstructorDescriptionRmiRequestProcessorImpl
(int portnumber) Sets up aRegistry
on the specified portnumber that does NOT use SSL.RmiRequestProcessorImpl
(int portnumber, String keystoreLocation, String keystorePassword, String truststoreLocation, String truststorePassword) Sets up aRegistry
on the specified portnumber that uses SSL with the supplied parameters.RmiRequestProcessorImpl
(int portnumber, String keystoreLocation, String keystorePassword, String truststoreLocation, String truststorePassword, ListenerObjectRetriever listenerObjectRetriever, ListenerObjectExecutor listenerObjectExecutor) Sets up aRegistry
on the specified portnumber that uses SSL with the supplied parameters.RmiRequestProcessorImpl
(int portnumber, ListenerObjectRetriever listenerObjectRetriever, ListenerObjectExecutor listenerObjectExecutor) Sets up aRegistry
on the specified portnumber that does NOT use SSL. -
Method Summary
Modifier and TypeMethodDescription<T> Response
<T> processRequestViaRMI
(Request request) void
setListenerObjectExecutor
(ListenerObjectExecutor listenerObjectExecutor) void
setListenerObjectRetriever
(ListenerObjectRetriever listenerObjectRetriever) void
shutdown()
Call this method at application shutdown to make sure that the RMI Registry gets closed properly.
-
Field Details
-
requestProcessor
-
registry
-
-
Constructor Details
-
RmiRequestProcessorImpl
public RmiRequestProcessorImpl(int portnumber) Sets up aRegistry
on the specified portnumber that does NOT use SSL. Whenever you use this constructor, be sure to set theListenerObjectRetriever
AND theListenerObjectExecutor
with the setters provided by this class. If you don't, runtimeNullPointerException
s will occur.- Parameters:
portnumber
- The portnumber to use
-
RmiRequestProcessorImpl
public RmiRequestProcessorImpl(int portnumber, ListenerObjectRetriever listenerObjectRetriever, ListenerObjectExecutor listenerObjectExecutor) Sets up aRegistry
on the specified portnumber that does NOT use SSL. This constructor is recommended, since it forces you to specify theListenerObjectRetriever
andListenerObjectExecutor
. Passing a null value for either of these will result in a runtimeNullPointerException
whenever theRmiRequestProcessorImpl
is used.- Parameters:
portnumber
- The portnumber to uselistenerObjectRetriever
-listenerObjectExecutor
-
-
RmiRequestProcessorImpl
public RmiRequestProcessorImpl(int portnumber, String keystoreLocation, String keystorePassword, String truststoreLocation, String truststorePassword) Sets up aRegistry
on the specified portnumber that uses SSL with the supplied parameters. The following system properties will be set:- javax.net.ssl.keyStore
- javax.net.ssl.keyStorePassword
- javax.net.ssl.trustStore
ListenerObjectRetriever
AND theListenerObjectExecutor
with the setters provided by this class. If you don't, runtimeNullPointerException
s will occur.- Parameters:
portnumber
- The portnumber to usekeystoreLocation
- The filepath that contains the SSL keystore, without file://keystorePassword
- The password of the SSL keystoretruststoreLocation
- The filepath that contains the SSL truststore, without file://truststorePassword
- The password of the SSL truststore
-
RmiRequestProcessorImpl
public RmiRequestProcessorImpl(int portnumber, String keystoreLocation, String keystorePassword, String truststoreLocation, String truststorePassword, ListenerObjectRetriever listenerObjectRetriever, ListenerObjectExecutor listenerObjectExecutor) Sets up aRegistry
on the specified portnumber that uses SSL with the supplied parameters. The following system properties will be set:- javax.net.ssl.keyStore
- javax.net.ssl.keyStorePassword
- javax.net.ssl.trustStore
ListenerObjectRetriever
andListenerObjectExecutor
. Passing a null value for either of these will result in a runtimeNullPointerException
whenever theRmiRequestProcessorImpl
is used.- Parameters:
portnumber
- The portnumber to usekeystoreLocation
- The filepath that contains the SSL keystore, without file://keystorePassword
- The password of the SSL keystoretruststoreLocation
- The filepath that contains the SSL truststore, without file://truststorePassword
- The password of the SSL truststorelistenerObjectRetriever
-listenerObjectExecutor
-
-
-
Method Details
-
shutdown
public void shutdown()Call this method at application shutdown to make sure that the RMI Registry gets closed properly. Pending requests will be allowed to finish before theRegistry
is killed. -
processRequestViaRMI
Description copied from interface:RmiRequestProcessor
Processes aRequest
and returns theResponse
. This method should just callRequestProcessor.processRequest(Request)
, but is necessary, because Java RMI requires you to declare aRemoteException
on remote methods.- Specified by:
processRequestViaRMI
in interfaceRmiRequestProcessor
- Parameters:
request
- TheRequest
to process- Returns:
- The
Response
-
getListenerObjectRetriever
-
setListenerObjectRetriever
-
getListenerObjectExecutor
-
setListenerObjectExecutor
-