}
@Override
public Ruby getRuntime() throws IllegalStateException, UnsupportedOperationException {
// obtain JRuby runtime from JRuby-Rack :
final RackApplicationFactory appFactory = getRackFactory();
if ( appFactory == null ) {
final String message =
RackApplicationFactory.class.getName() + " not yet initialized - " +
"seems this listener is executing before the " +
"RackServletContextListener / RailsSevletContextListener !";
log("[" + getClass().getName() + "] " + message);
throw new IllegalStateException(message);
}
final RackApplication app;
try {
app = appFactory.getApplication();
}
catch (RackException e) {
throw new UnsupportedOperationException(e); // rack/rails initialization failure
}
if ( app == null ) {