You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@openwebbeans.apache.org by gp...@apache.org on 2014/03/03 14:49:53 UTC
svn commit: r1573563 -
/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/lifecycle/AbstractLifeCycle.java
Author: gpetracek
Date: Mon Mar 3 13:49:53 2014
New Revision: 1573563
URL: http://svn.apache.org/r1573563
Log:
OWB-937 unified startup detection
Modified:
openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/lifecycle/AbstractLifeCycle.java
Modified: openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/lifecycle/AbstractLifeCycle.java
URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/lifecycle/AbstractLifeCycle.java?rev=1573563&r1=1573562&r2=1573563&view=diff
==============================================================================
--- openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/lifecycle/AbstractLifeCycle.java (original)
+++ openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/lifecycle/AbstractLifeCycle.java Mon Mar 3 13:49:53 2014
@@ -19,6 +19,7 @@
package org.apache.webbeans.lifecycle;
import java.util.Properties;
+import java.util.concurrent.atomic.AtomicBoolean;
import java.util.logging.Level;
import java.util.logging.Logger;
@@ -41,6 +42,8 @@ import org.apache.webbeans.util.WebBeans
public abstract class AbstractLifeCycle implements ContainerLifecycle
{
+ protected AtomicBoolean started = new AtomicBoolean(false);
+
//Logger instance
protected Logger logger;
@@ -98,6 +101,16 @@ public abstract class AbstractLifeCycle
@Override
public void startApplication(Object startupObject)
{
+ bootstrapApplication(startupObject);
+ }
+
+ protected synchronized void bootstrapApplication(Object startupObject)
+ {
+ if (started.get())
+ {
+ return;
+ }
+
// Initalize Application Context
logger.info(OWBLogConst.INFO_0005);
@@ -131,6 +144,8 @@ public abstract class AbstractLifeCycle
{
logger.log(Level.INFO, OWBLogConst.INFO_0001, Long.toString(System.currentTimeMillis() - begin));
}
+
+ started.set(true);
}
@Override
@@ -184,6 +199,7 @@ public abstract class AbstractLifeCycle
}
finally
{
+ started.set(false);
// Clear singleton list
WebBeansFinder.clearInstances(WebBeansUtil.getCurrentClassLoader());
}