|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.springframework.remoting.support.RemoteExporter org.springframework.remoting.rmi.RmiServiceExporter
RMI exporter that exposes the specified service as RMI object with the specified name. Such services can be accessed via plain RMI or via RmiProxyFactoryBean. Also supports exposing any non-RMI service via RMI invokers, to be accessed via RmiClientInterceptor/RmiProxyFactoryBean's automatic detection of such invokers.
With an RMI invoker, RMI communication works on the RmiInvocationHandler level, needing only one stub for any service. Service interfaces do not have to extend java.rmi.Remote or throw RemoteException on all methods, but in and out parameters have to be serializable.
The major advantage of RMI, compared to Hessian and Burlap, is serialization. Effectively, any serializable Java object can be transported without hassle. Hessian and Burlap have their own (de-)serialization mechanisms, but are HTTP-based and thus much easier to setup than RMI.
RmiClientInterceptor
,
RmiProxyFactoryBean
,
HessianServiceExporter
,
BurlapServiceExporter
Field Summary | |
protected org.apache.commons.logging.Log |
logger
|
Constructor Summary | |
RmiServiceExporter()
|
Method Summary | |
void |
afterPropertiesSet()
Register the service as RMI object. |
void |
destroy()
Invoked by a BeanFactory on destruction of a singleton. |
protected java.lang.Object |
invoke(RemoteInvocation invocation,
java.lang.Object targetObject)
Apply the given remote invocation to the given target object. |
void |
setClientSocketFactory(java.rmi.server.RMIClientSocketFactory clientSocketFactory)
Set a custom RMI client socket factory to use for exporting. |
void |
setRegistryPort(int registryPort)
Set the port of the registry for the exported RMI service, i.e. |
void |
setServerSocketFactory(java.rmi.server.RMIServerSocketFactory serverSocketFactory)
Set a custom RMI server socket factory to use for exporting. |
void |
setServiceName(java.lang.String serviceName)
Set the name of the exported RMI service, i.e. |
void |
setServicePort(int servicePort)
Set the port that the exported RMI service will use. |
Methods inherited from class org.springframework.remoting.support.RemoteExporter |
getProxyForService, getService, getServiceInterface, setService, setServiceInterface |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
protected final org.apache.commons.logging.Log logger
Constructor Detail |
public RmiServiceExporter()
Method Detail |
public void setServiceName(java.lang.String serviceName)
public void setServicePort(int servicePort)
public void setRegistryPort(int registryPort)
public void setClientSocketFactory(java.rmi.server.RMIClientSocketFactory clientSocketFactory)
setServerSocketFactory(java.rmi.server.RMIServerSocketFactory)
,
UnicastRemoteObject.exportObject(Remote, int, RMIClientSocketFactory, RMIServerSocketFactory)
public void setServerSocketFactory(java.rmi.server.RMIServerSocketFactory serverSocketFactory)
setClientSocketFactory(java.rmi.server.RMIClientSocketFactory)
public void afterPropertiesSet() throws java.lang.Exception
afterPropertiesSet
in interface InitializingBean
afterPropertiesSet
in class RemoteExporter
java.lang.Exception
protected java.lang.Object invoke(RemoteInvocation invocation, java.lang.Object targetObject) throws java.lang.NoSuchMethodException, java.lang.IllegalAccessException, java.lang.reflect.InvocationTargetException
Can be overridden in subclasses for custom invocation behavior, possibly for applying additional invocation parameters from a custom RemoteInvocation subclass. Will typically match a corresponding custom invoke implementation in RmiClientInterceptor/RmiProxyFactoryBean.
invocation
- the remote invocationtargetObject
- the target object to apply the invocation to
java.lang.NoSuchMethodException
- if the method name could not be resolved
java.lang.IllegalAccessException
- if the method could not be accessed
java.lang.reflect.InvocationTargetException
- if the method invocation resulted in an exceptionRmiClientInterceptor.invoke(org.aopalliance.intercept.MethodInvocation)
public void destroy() throws java.rmi.RemoteException, java.rmi.NotBoundException
DisposableBean
destroy
in interface DisposableBean
java.rmi.RemoteException
java.rmi.NotBoundException
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |