|
Ubik
Welcome to Ubik's wiki. Web site: http://www.sapia-oss.org/projects/ubik/ HistoryWe've been using Ubik in production for a couple of years now. In fact, the project has been started in 2002. What a long way! EJBs were all the rage at that time (but slowly loosing ground to more lightweight approaches). Anyway, Ubik has been designed for ease of use in mind. It's great for quickly implementing remote services, in a manner that is completely compatible with the "lightweight" philosophy (in fact, with exactly that philosophy in mind). Ubik offers scalability and reliability without the complexity of JINI and the bloat of an appserver. News
Guice and UbikThe Ubik-Guice integration provides:
Both of these features have been implemented through specific Guice "providers". Imagine a distributed app where node A depends on node B. There are potentially a few problems:
What's been implemented supports the late-binding of services, through discovery:
Here's a snippet to wet your appetite: final NamingService naming = new NamingServiceImpl("default")
.setJndiHost(Localhost.getLocalAddress().getHostAddress())
.setJndiPort(1099);
Injector injector = Guice.createInjector(new AbstractModule(){
@Override
protected void configure() {
bind(NamingService.class).toInstance(naming);
bind(TimeServiceIF.class).toProvider(new RemoteServiceExporter<TimeServiceIF>(new TimeServiceImpl(), "services/time"));
}
});
// calling getInstance() internally invokes get() on the RemoteServiceExporter, which publishes the service
// to the JNDI.
TimeServiceIF server = injector.getInstance(TimeServiceIF.class);
System.out.println("Bound time server");
while(true){
Thread.sleep(10000);
}See the Javadoc for more info. TipsHow to start a JNDI Server Programmaticallypackage org.sapia.ubik.rmi.examples;
import org.sapia.ubik.rmi.naming.remote.EmbeddableJNDIServer;
public class JndiRunner {
public static void main(String[] args) throws Exception{
EmbeddableJNDIServer jndi = new EmbeddableJNDIServer("default", 1099);
jndi.start(true);
while(true){
Thread.sleep(100000);
}
}
}
|
I was wondering if you are aware of the classes NamingService? and NamingServiceMBean that ship with mx4j. They wrap the standard RMI Registry Server and allow it to be turned on and managed in a way that is more seamless than your example above for starting the UBIK JNDI server programatically.
You can find them in package mx4j.tools.naming of the mx4j distribution.
s/loosing ground/losing ground/