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
FieldsFields inherited from interface org.rribbit.processing.RmiRequestProcessor
REGISTRY_KEY -
Constructor Summary
ConstructorsConstructorDescriptionRmiRequestProcessorImpl(int portnumber) Sets up aRegistryon the specified portnumber that does NOT use SSL.RmiRequestProcessorImpl(int portnumber, String keystoreLocation, String keystorePassword, String truststoreLocation, String truststorePassword) Sets up aRegistryon 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 aRegistryon the specified portnumber that uses SSL with the supplied parameters.RmiRequestProcessorImpl(int portnumber, ListenerObjectRetriever listenerObjectRetriever, ListenerObjectExecutor listenerObjectExecutor) Sets up aRegistryon the specified portnumber that does NOT use SSL. -
Method Summary
Modifier and TypeMethodDescription<T> Response<T> processRequestViaRMI(Request request) voidsetListenerObjectExecutor(ListenerObjectExecutor listenerObjectExecutor) voidsetListenerObjectRetriever(ListenerObjectRetriever listenerObjectRetriever) voidshutdown()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 aRegistryon the specified portnumber that does NOT use SSL. Whenever you use this constructor, be sure to set theListenerObjectRetrieverAND theListenerObjectExecutorwith the setters provided by this class. If you don't, runtimeNullPointerExceptions will occur.- Parameters:
portnumber- The portnumber to use
-
RmiRequestProcessorImpl
public RmiRequestProcessorImpl(int portnumber, ListenerObjectRetriever listenerObjectRetriever, ListenerObjectExecutor listenerObjectExecutor) Sets up aRegistryon the specified portnumber that does NOT use SSL. This constructor is recommended, since it forces you to specify theListenerObjectRetrieverandListenerObjectExecutor. Passing a null value for either of these will result in a runtimeNullPointerExceptionwhenever theRmiRequestProcessorImplis used.- Parameters:
portnumber- The portnumber to uselistenerObjectRetriever-listenerObjectExecutor-
-
RmiRequestProcessorImpl
public RmiRequestProcessorImpl(int portnumber, String keystoreLocation, String keystorePassword, String truststoreLocation, String truststorePassword) Sets up aRegistryon 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
ListenerObjectRetrieverAND theListenerObjectExecutorwith the setters provided by this class. If you don't, runtimeNullPointerExceptions 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 aRegistryon 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
ListenerObjectRetrieverandListenerObjectExecutor. Passing a null value for either of these will result in a runtimeNullPointerExceptionwhenever theRmiRequestProcessorImplis 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 theRegistryis killed. -
processRequestViaRMI
Description copied from interface:RmiRequestProcessorProcesses aRequestand returns theResponse. This method should just callRequestProcessor.processRequest(Request), but is necessary, because Java RMI requires you to declare aRemoteExceptionon remote methods.- Specified by:
processRequestViaRMIin interfaceRmiRequestProcessor- Parameters:
request- TheRequestto process- Returns:
- The
Response
-
getListenerObjectRetriever
-
setListenerObjectRetriever
-
getListenerObjectExecutor
-
setListenerObjectExecutor
-