Ensure that persistence adapter start is not missed to avoid infinite
wait for it.
This commit is contained in:
Timothy Bish 2015-06-02 11:36:47 -04:00
parent 73e8d10982
commit 35b82e5f93
1 changed files with 8 additions and 5 deletions

View File

@ -240,7 +240,7 @@ public class BrokerService implements Service {
private long offlineDurableSubscriberTaskSchedule = 300000;
private DestinationFilter virtualConsumerDestinationFilter;
private final Object persistenceAdapterLock = new Object();
private final AtomicBoolean persistenceAdapterStarted = new AtomicBoolean(false);
private Throwable startException = null;
private boolean startAsync = false;
private Date startDate;
@ -630,8 +630,9 @@ public class BrokerService implements Service {
} catch (Throwable e) {
startException = e;
} finally {
synchronized (persistenceAdapterLock) {
persistenceAdapterLock.notifyAll();
synchronized (persistenceAdapterStarted) {
persistenceAdapterStarted.set(true);
persistenceAdapterStarted.notifyAll();
}
}
}
@ -669,8 +670,10 @@ public class BrokerService implements Service {
@Override
public void run() {
try {
synchronized (persistenceAdapterLock) {
persistenceAdapterLock.wait();
synchronized (persistenceAdapterStarted) {
if (!persistenceAdapterStarted.get()) {
persistenceAdapterStarted.wait();
}
}
doStartBroker();
} catch (Throwable t) {