Java Code Examples for org.apache.meecrowave.Meecrowave#deployWebapp()
The following examples show how to use
org.apache.meecrowave.Meecrowave#deployWebapp() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: MeecrowaveRunMojo.java From openwebbeans-meecrowave with Apache License 2.0 | 5 votes |
private void deploy(final Meecrowave meecrowave, final Meecrowave.DeploymentMeta deploymentMeta) { if (useClasspathDeployment) { meecrowave.deployClasspath(deploymentMeta); } else { meecrowave.deployWebapp(deploymentMeta); } }
Example 2
Source File: MonoBase.java From openwebbeans-meecrowave with Apache License 2.0 | 4 votes |
public Meecrowave.Builder doBoot() { final Meecrowave.Builder configuration = new Meecrowave.Builder().randomHttpPort().noShutdownHook(/*the rule does*/); boolean unlocked = false; ClassLoaderLock.LOCK.lock(); try { final ClassLoader originalCL = Thread.currentThread().getContextClassLoader(); ClassLoaderLock.LOCK.lock(); final ClassLoader containerLoader = ClassLoaderLock.getUsableContainerLoader(); final Meecrowave meecrowave = new Meecrowave(configuration); if (CONTAINER.compareAndSet(null, new Instance(meecrowave, configuration, containerLoader))) { final Configuration runnerConfig = StreamSupport.stream(ServiceLoader.load(Configuration.class) .spliterator(), false) .min(Comparator.comparingInt(Configuration::order)) .orElseGet(() -> new Configuration() {}); runnerConfig.beforeStarts(); final File war = runnerConfig.application(); final Thread thread = Thread.currentThread(); if (containerLoader != originalCL) { thread.setContextClassLoader(containerLoader); } try { if (war == null) { meecrowave.bake(runnerConfig.context()); } else { meecrowave.deployWebapp(runnerConfig.context(), runnerConfig.application()); } } finally { if (containerLoader != originalCL) { thread.setContextClassLoader(originalCL); } } ClassLoaderLock.LOCK.unlock(); unlocked = true; runnerConfig.afterStarts(); Runtime.getRuntime() .addShutdownHook(new Thread() { { setName("Meecrowave-mono-rule-stopping"); } @Override public void run() { try { runnerConfig.beforeStops(); } finally { try { meecrowave.close(); } finally { runnerConfig.afterStops(); } } } }); } } finally { if (!unlocked) { ClassLoaderLock.LOCK.unlock(); } } return getConfiguration(); }