org.sapia.ubik.ioc.guice
Class RemoteServiceImporter<T>
java.lang.Object
org.sapia.ubik.ioc.guice.RemoteServiceImporter<T>
- All Implemented Interfaces:
- com.google.inject.Provider<T>
public class RemoteServiceImporter<T>
- extends java.lang.Object
- implements com.google.inject.Provider<T>
This provider is used in order to lookup remote objects from remote Ubik JNDI servers.
This provider supports lazy lookups of services: it allows for Ubik services to appear on
the network in an ad-hoc manner. More precisely, given services must not necessarily appear on the network
before the applications that depend on them.
This allows client applications to startup without risking abrupt termination because of failed service lookups:
if a given service is not found, a lazy proxy is created and returned at its place. A discovery mechanism
insures that the missing service is eventually retrieved (if it appears on the network).
Example:
final NamingService naming = new NamingServiceImpl("default")
.setJndiHost(Localhost.getLocalAddress().getHostAddress())
.setJndiPort(1099);
Injector injector = Guice.createInjector(new AbstractModule(){
- Author:
- yduchesne
- See Also:
NamingService,
RemoteServiceExporter
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
RemoteServiceImporter
public RemoteServiceImporter(java.lang.Class<T> type,
java.lang.String jndiName)
- Creates a new instance of
RemoteServiceImporter.
- Parameters:
type - the Class of the service to retrieve.jndiName - the name under which the expected service is bound into
Ubik's JNDI server(s).
get
public T get()
- Specified by:
get in interface com.google.inject.Provider<T>
Copyright © 2010 Sapia OSS. All Rights Reserved.