added waiting block for equinox event and ds service to start.
This commit is contained in:
parent
17090453d6
commit
8199b9f9b4
|
@ -42,14 +42,20 @@ public class EventManager implements IEventManager {
|
||||||
private static IEventManager instance = null;
|
private static IEventManager instance = null;
|
||||||
private final static CLogger log = CLogger.getCLogger(EventManager.class);
|
private final static CLogger log = CLogger.getCLogger(EventManager.class);
|
||||||
|
|
||||||
|
private final static Object mutex = new Object();
|
||||||
|
|
||||||
private Map<EventHandler, List<ServiceRegistration>> registrations = new HashMap<EventHandler, List<ServiceRegistration>>();
|
private Map<EventHandler, List<ServiceRegistration>> registrations = new HashMap<EventHandler, List<ServiceRegistration>>();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param eventAdmin
|
* @param eventAdmin
|
||||||
*/
|
*/
|
||||||
public void bindEventAdmin(EventAdmin eventAdmin) {
|
public void bindEventAdmin(EventAdmin eventAdmin) {
|
||||||
if (instance == null)
|
synchronized (mutex) {
|
||||||
instance = this;
|
if (instance == null) {
|
||||||
|
instance = this;
|
||||||
|
mutex.notifyAll();
|
||||||
|
}
|
||||||
|
}
|
||||||
this.eventAdmin = eventAdmin;
|
this.eventAdmin = eventAdmin;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -65,6 +71,14 @@ public class EventManager implements IEventManager {
|
||||||
* @return EventManager
|
* @return EventManager
|
||||||
*/
|
*/
|
||||||
public static IEventManager getInstance() {
|
public static IEventManager getInstance() {
|
||||||
|
synchronized (mutex) {
|
||||||
|
if (instance == null) {
|
||||||
|
try {
|
||||||
|
mutex.wait(10000);
|
||||||
|
} catch (InterruptedException e) {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
return instance;
|
return instance;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue