Class ServiceExporter
java.lang.Object
org.nuiton.util.rmi.ServiceExporter
This class allows to make some service available through RMI. For each service,
a wrapper will be created which will be put in the RMI registry. This wrapper
will intercept calls to the service and delegate them to it.
- Author:
- Arnaud Thimel - thimel@codelutin.com
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic <E> voidregisterService(Class<E> serviceInterface, E instance) Will register a service using the default name.static <E> voidregisterService(String rmiName, E instance) Will register a service using the given RMI name.static voidunregisterService(Class<?> serviceInterface) Will unregister a service using the default name.static voidunregisterService(String rmiName) Will unregister a service using the given RMI name.
-
Constructor Details
-
ServiceExporter
public ServiceExporter()
-
-
Method Details
-
registerService
public static <E> void registerService(Class<E> serviceInterface, E instance) throws RemoteException Will register a service using the default name.- Type Parameters:
E- some interface class- Parameters:
serviceInterface- the interface used to bind the service. The RMI name will be generated from this class nameinstance- the service instance to bind- Throws:
RemoteException- in case the registry is not reachable
-
registerService
Will register a service using the given RMI name.- Type Parameters:
E- some interface class- Parameters:
rmiName- the RMI name used to bind the service in the registryinstance- the service instance to bind- Throws:
RemoteException- in case the registry is not reachable
-
unregisterService
public static void unregisterService(Class<?> serviceInterface) throws RemoteException, NotBoundException Will unregister a service using the default name.- Parameters:
serviceInterface- the interface used to unbind the service. The RMI name will be generated from this class name- Throws:
RemoteException- in case the registry is not reachableNotBoundException- in case the given name is not bound
-
unregisterService
Will unregister a service using the given RMI name.- Parameters:
rmiName- the RMI name used to unbind the service in the registry- Throws:
RemoteException- in case the registry is not reachableNotBoundException- in case the given name is not bound
-