Methods Summary |
---|
public java.lang.String | getRailsRoot()
return railsRoot;
|
public void | initEndpoint()
if (embeddedInGlassFish) {
railsRoot = System.getProperty("com.sun.aas.instanceRoot")
+ "/applications/rails";
}
setupSystemProperties();
initializeRubyRuntime();
setBufferResponse(false);
asyncExecution = true;
DefaultAsyncHandler asyncHandler = new DefaultAsyncHandler();
setAsyncHandler(asyncHandler);
RailAsyncFilter railAsyncFilter = new RailAsyncFilter();
railAsyncFilter.setRubyRuntimeQueue(pool.getRubyRuntimeQueue());
asyncHandler.addAsyncFilter(railAsyncFilter);
adapter = new RailsAdapter(pool,railAsyncFilter);
algorithmClassName = StaticStreamAlgorithm.class.getName();
super.initEndpoint();
|
protected void | initializeRubyRuntime()
pool = new RubyObjectPool();
pool.setNumberOfRuntime(numberOfRuntime);
pool.setJrubyLib(jrubyLib);
pool.setRailsRoot(railsRoot);
try {
pool.start();
} catch (Throwable t) {
logger.log(Level.WARNING, t.getMessage());
}
|
public void | setNumberOfRuntime(int numberOfRuntime)
this.numberOfRuntime = numberOfRuntime;
|
public void | setRailsRoot(java.lang.String railsRoot)
this.railsRoot = railsRoot;
|
protected void | setupSystemProperties()
String jrubyBase = System.getProperty("jruby.base");
String jrubyHome = System.getProperty("jruby.home");
String jrubyShell = System.getProperty("jruby.shell");
String jrubyScript = System.getProperty("jruby.script");
if (System.getProperty(NUMBER_OF_RUNTIME) != null){
try{
numberOfRuntime = Integer.parseInt(
System.getProperty(NUMBER_OF_RUNTIME));
} catch (NumberFormatException ex){
SelectorThread.logger().log(Level.WARNING,
"Invalid number of Runtime");
}
}
if (jrubyBase == null) {
throw new IllegalStateException("Set system property jruby.base to JRuby directory");
}
if (jrubyHome == null) {
System.setProperty("jruby.home", jrubyBase);
}
if (jrubyShell == null) {
System.setProperty("jruby.shell", "");
}
if (jrubyScript == null) {
System.setProperty("jruby.script", "");
}
jrubyLib = System.getProperty("jruby.lib");
if (jrubyLib == null) {
jrubyLib = jrubyBase + "/lib";
System.setProperty("jruby.lib", jrubyLib);
}
|
public synchronized void | stopEndpoint()
pool.stop();
super.stopEndpoint();
|