more code in progress to support multiple instances of jetty

git-svn-id: svn+ssh://dev.eclipse.org/svnroot/rt/org.eclipse.jetty/jetty/trunk@2031 7e9141cc-0065-0410-87d8-b60c137991c4
This commit is contained in:
Hugues Malphettes 2010-06-20 03:08:00 +00:00
parent dacfcc8903
commit 79c83a7184
3 changed files with 37 additions and 16 deletions

View File

@ -156,21 +156,21 @@ public class JettyBootstrapActivator implements BundleActivator
_registeredServer = null; _registeredServer = null;
} }
} }
if (_jettyServerFactoryService != null) // if (_jettyServerFactoryService != null)
{ // {
try // try
{ // {
_jettyServerFactoryService.unregister(); // _jettyServerFactoryService.unregister();
} // }
catch (IllegalArgumentException ill) // catch (IllegalArgumentException ill)
{ // {
// already unregistered. // // already unregistered.
} // }
finally // finally
{ // {
_jettyServerFactoryService = null; // _jettyServerFactoryService = null;
} // }
} // }
} }
finally finally

View File

@ -108,6 +108,14 @@ public class ServerInstanceWrapper {
return _deploymentManager; return _deploymentManager;
} }
/**
* @return The collection of context handlers
*/
public ContextHandlerCollection getContextHandlerCollection()
{
return _ctxtHandler;
}
public void start(Server server, Dictionary props) public void start(Server server, Dictionary props)
{ {

View File

@ -41,6 +41,7 @@ import org.eclipse.jetty.osgi.boot.JettyBootstrapActivator;
import org.eclipse.jetty.osgi.boot.OSGiAppProvider; import org.eclipse.jetty.osgi.boot.OSGiAppProvider;
import org.eclipse.jetty.osgi.boot.OSGiWebappConstants; import org.eclipse.jetty.osgi.boot.OSGiWebappConstants;
import org.eclipse.jetty.osgi.boot.internal.jsp.TldLocatableURLClassloader; import org.eclipse.jetty.osgi.boot.internal.jsp.TldLocatableURLClassloader;
import org.eclipse.jetty.osgi.boot.internal.serverfactory.ServerInstanceWrapper;
import org.eclipse.jetty.osgi.boot.utils.BundleClassLoaderHelper; import org.eclipse.jetty.osgi.boot.utils.BundleClassLoaderHelper;
import org.eclipse.jetty.osgi.boot.utils.BundleFileLocatorHelper; import org.eclipse.jetty.osgi.boot.utils.BundleFileLocatorHelper;
import org.eclipse.jetty.osgi.boot.utils.WebappRegistrationCustomizer; import org.eclipse.jetty.osgi.boot.utils.WebappRegistrationCustomizer;
@ -126,7 +127,7 @@ public class WebappRegistrationHelper
* webapp classloader. It is in fact the _libExtClassLoader with a trick to * webapp classloader. It is in fact the _libExtClassLoader with a trick to
* let the TldScanner find the jars where the tld files are. * let the TldScanner find the jars where the tld files are.
*/ */
private URLClassLoader _commonParentClassLoaderForWebapps; private ClassLoader _commonParentClassLoaderForWebapps;
private DeploymentManager _deploymentManager; private DeploymentManager _deploymentManager;
@ -138,6 +139,14 @@ public class WebappRegistrationHelper
staticInit(); staticInit();
} }
public WebappRegistrationHelper(ServerInstanceWrapper wrapper, Server server)
{
_server = server;
_commonParentClassLoaderForWebapps = wrapper.getParentClassLoaderForWebapps();
_ctxtHandler = wrapper.getContextHandlerCollection();
staticInit();
}
// Inject the customizing classes that might be defined in fragment bundles. // Inject the customizing classes that might be defined in fragment bundles.
private static synchronized void staticInit() private static synchronized void staticInit()
{ {
@ -370,6 +379,10 @@ public class WebappRegistrationHelper
*/ */
private void init() private void init()
{ {
if (_ctxtHandler != null)
{
return;
}
// Get the context handler // Get the context handler
_ctxtHandler = (ContextHandlerCollection)_server.getChildHandlerByClass(ContextHandlerCollection.class); _ctxtHandler = (ContextHandlerCollection)_server.getChildHandlerByClass(ContextHandlerCollection.class);