IDEMPIERE-3043 by synchronized. sometime, get list service will wrong
This commit is contained in:
parent
0a6ea1a3e5
commit
43212e22e2
|
@ -49,7 +49,8 @@ public abstract class AbstractActivator implements BundleActivator, ServiceTrack
|
|||
private String trxName = null;
|
||||
private ProcessInfo m_processInfo = null;
|
||||
private IProcessUI m_processUI = null;
|
||||
public static boolean isFrameworkCompletedSrart = false;
|
||||
private final static Object mutex = new Object();
|
||||
private static boolean isFrameworkStarted = false;
|
||||
|
||||
|
||||
@Override
|
||||
|
@ -58,7 +59,7 @@ public abstract class AbstractActivator implements BundleActivator, ServiceTrack
|
|||
if (logger.isLoggable(Level.INFO)) logger.info(getName() + " " + getVersion() + " starting...");
|
||||
serviceTracker = new ServiceTracker<IDictionaryService, IDictionaryService>(context, IDictionaryService.class.getName(), this);
|
||||
serviceTracker.open();
|
||||
if (!isFrameworkCompletedSrart)
|
||||
if (!isFrameworkStarted())
|
||||
context.addFrameworkListener(this);
|
||||
start();
|
||||
if (logger.isLoggable(Level.INFO)) logger.info(getName() + " " + getVersion() + " ready.");
|
||||
|
@ -216,10 +217,18 @@ public abstract class AbstractActivator implements BundleActivator, ServiceTrack
|
|||
@Override
|
||||
public void frameworkEvent(FrameworkEvent event) {
|
||||
if (event.getType() == FrameworkEvent.STARTLEVEL_CHANGED) {
|
||||
isFrameworkCompletedSrart = true;
|
||||
synchronized(mutex) {
|
||||
isFrameworkStarted = true;
|
||||
frameworkStarted();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static Boolean isFrameworkStarted() {
|
||||
synchronized(mutex) {
|
||||
return isFrameworkStarted;
|
||||
}
|
||||
}
|
||||
|
||||
protected abstract void frameworkStarted();
|
||||
|
||||
|
@ -243,7 +252,7 @@ public abstract class AbstractActivator implements BundleActivator, ServiceTrack
|
|||
public IDictionaryService addingService(
|
||||
ServiceReference<IDictionaryService> reference) {
|
||||
service = context.getService(reference);
|
||||
if (isFrameworkCompletedSrart)
|
||||
if (isFrameworkStarted())
|
||||
frameworkStarted ();
|
||||
return null;
|
||||
}
|
||||
|
|
|
@ -26,7 +26,6 @@ import java.util.Timer;
|
|||
import java.util.TimerTask;
|
||||
import java.util.logging.Level;
|
||||
|
||||
import org.adempiere.base.IDictionaryService;
|
||||
import org.adempiere.util.ServerContext;
|
||||
import org.compiere.Adempiere;
|
||||
import org.compiere.model.MClient;
|
||||
|
@ -41,7 +40,6 @@ import org.compiere.util.AdempiereSystemError;
|
|||
import org.compiere.util.CLogger;
|
||||
import org.compiere.util.Env;
|
||||
import org.compiere.util.Util;
|
||||
import org.osgi.framework.ServiceReference;
|
||||
|
||||
public class PackInApplicationActivator extends AbstractActivator{
|
||||
|
||||
|
|
Loading…
Reference in New Issue