Methods Summary |
---|
public org.jruby.Ruby | bollowRuntime()Retrives ruby runtime from the object pool.
return queue.poll();
|
public java.lang.String | getJrubyLib()Gets JRUBY_LIB directory.
return jrubyLib;
|
public int | getNumberOfRuntime()Gets the number of directory.
return numberOfRuntime;
|
public java.lang.String | getRailsRoot()Gets RAILS_ROOT directory.
return railsRoot;
|
protected java.util.concurrent.BlockingQueue | getRubyRuntimeQueue()
return queue;
|
protected org.jruby.Ruby | initializeRubyRuntime()
return JavaEmbedUtils.initialize(new ArrayList<String>());
|
protected void | loadRubyLibraries(org.jruby.Ruby runtime)
LoadService loadService = runtime.getLoadService();
// load rails
loadService.require(railsRoot + "/config/environment.rb");
|
public void | returnRuntime(org.jruby.Ruby runtime)Returns runtime to the object pool.
queue.offer(runtime);
|
public void | setJrubyLib(java.lang.String jrubyLib)Sets JRUBY_LIB directory.
this.jrubyLib = jrubyLib;
|
public void | setNumberOfRuntime(int numberOfRuntime)Sets the number of pooling runtime.
this.numberOfRuntime = numberOfRuntime;
|
public void | setRailsRoot(java.lang.String railsRoot)Sets RAILS_ROOT directory.
this.railsRoot = railsRoot;
|
public void | start()Starts the object pool.
if (jrubyLib == null || railsRoot == null) {
throw new IllegalStateException("jrubyLib or railsRoot can not be null.");
}
for (int i = 0; i < numberOfRuntime; i++) {
Ruby runtime = initializeRubyRuntime();
loadRubyLibraries(runtime);
queue.offer(runtime);
}
|
public void | stop()Shutdowns the object pool.
for (Ruby ruby : queue) {
ruby.tearDown();
}
queue.clear();
|