Skip to content

Instantly share code, notes, and snippets.

@spmallette
Created December 17, 2012 17:22
Show Gist options
  • Save spmallette/4320048 to your computer and use it in GitHub Desktop.
Save spmallette/4320048 to your computer and use it in GitHub Desktop.
Standalone Rexster
package com.tinkerpop.rexster;
import com.tinkerpop.blueprints.impls.tg.TinkerGraph;
import com.tinkerpop.rexster.server.DefaultRexsterApplication;
import com.tinkerpop.rexster.server.RexProRexsterServer;
import com.tinkerpop.rexster.server.RexsterApplication;
import com.tinkerpop.rexster.server.ShutdownManager;
import org.apache.commons.configuration.XMLConfiguration;
/**
* @author Stephen Mallette (http://stephen.genoprime.com)
*/
public class Starter {
public static void main(final String[] args) throws Exception {
final XMLConfiguration conf = new XMLConfiguration();
final RexProRexsterServer server = new RexProRexsterServer(conf);
final RexsterApplication ra = new DefaultRexsterApplication("graph", new TinkerGraph());
server.start(ra);
final ShutdownManager shutdownManager = new ShutdownManager("0.0.0.0", 8183);
shutdownManager.registerShutdownListener(new ShutdownManager.ShutdownListener() {
public void shutdown() {
// shutdown grizzly/graphs
try { server.stop(); } catch (Exception ex) { ex.printStackTrace(); }
}
});
shutdownManager.start();
shutdownManager.waitForShutdown();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment