org.jruby.rack.SerialPoolingRackApplicationFactory Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of jruby-rack Show documentation
Show all versions of jruby-rack Show documentation
A servlet bridge for (Ruby-based) Rack applications that allow them
to run in Java Application servers using JRuby.
/*
* Copyright (c) 2010-2012 Engine Yard, Inc.
* Copyright (c) 2007-2009 Sun Microsystems, Inc.
* This source code is available under the MIT license.
* See the file LICENSE.txt for details.
*/
package org.jruby.rack;
import java.util.Queue;
/**
* Works like the pooling application factory, with the variation that it will
* create all application instances (runtimes) serially, using no extra threads.
*
* @author Ola Bini
*/
public class SerialPoolingRackApplicationFactory extends PoolingRackApplicationFactory {
public SerialPoolingRackApplicationFactory(RackApplicationFactory factory) {
super(factory);
}
@Override
protected void launchInitialization(final Queue apps) {
while ( ! apps.isEmpty() ) {
final RackApplication app = apps.remove();
try {
app.init();
applicationPool.add(app);
log(RackLogger.INFO, "added application to pool, size now = " + applicationPool.size());
}
catch (RackInitializationException e) {
log(RackLogger.ERROR, "unable to initialize application", e);
}
}
}
@Override
protected void waitTillPoolReady() {
return; // waiting makes no sense here as we're initializing serialy
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy