qpid-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kw...@apache.org
Subject svn commit: r1694858 - /qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/model/AbstractSystemConfig.java
Date Sun, 09 Aug 2015 08:13:12 GMT
Author: kwall
Date: Sun Aug  9 08:13:12 2015
New Revision: 1694858

URL: http://svn.apache.org/r1694858
Log:
QPID-6685: [Java Broker] Prevent exceptions with the Broker's openAsync future from being
ignored

Modified:
    qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/model/AbstractSystemConfig.java

Modified: qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/model/AbstractSystemConfig.java
URL: http://svn.apache.org/viewvc/qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/model/AbstractSystemConfig.java?rev=1694858&r1=1694857&r2=1694858&view=diff
==============================================================================
--- qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/model/AbstractSystemConfig.java
(original)
+++ qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/model/AbstractSystemConfig.java
Sun Aug  9 08:13:12 2015
@@ -31,6 +31,8 @@ import java.util.HashMap;
 import java.util.Map;
 import java.util.UUID;
 
+import com.google.common.util.concurrent.FutureCallback;
+import com.google.common.util.concurrent.Futures;
 import com.google.common.util.concurrent.ListenableFuture;
 import com.google.common.util.concurrent.SettableFuture;
 
@@ -46,6 +48,7 @@ import org.apache.qpid.server.store.Brok
 import org.apache.qpid.server.store.ConfiguredObjectRecord;
 import org.apache.qpid.server.store.ConfiguredObjectRecordConverter;
 import org.apache.qpid.server.store.DurableConfigurationStore;
+import org.apache.qpid.server.util.ServerScopedRuntimeException;
 
 public abstract class AbstractSystemConfig<X extends SystemConfig<X>>
         extends AbstractConfiguredObject<X> implements SystemConfig<X>
@@ -205,28 +208,31 @@ public abstract class AbstractSystemConf
 
         broker.setEventLogger(startupLogger);
         final SettableFuture<Void> returnVal = SettableFuture.create();
-        broker.openAsync().addListener(
-                new Runnable()
-                {
-                    @Override
-                    public void run()
-                    {
-                        try
-                        {
-
-                            if (broker.getState() == State.ACTIVE)
+        Futures.addCallback(broker.openAsync(), new FutureCallback()
                             {
-                                startupLogger.message(BrokerMessages.READY());
-                                broker.setEventLogger(eventLogger);
-                            }
-                        }
-                        finally
-                        {
-                            returnVal.set(null);
-                        }
-                    }
-                }, getTaskExecutor().getExecutor()
-                                      );
+                                @Override
+                                public void onSuccess(final Object result)
+                                {
+                                    State state = broker.getState();
+                                    if (state == State.ACTIVE)
+                                    {
+                                        startupLogger.message(BrokerMessages.READY());
+                                        broker.setEventLogger(eventLogger);
+                                        returnVal.set(null);
+                                    }
+                                    else
+                                    {
+                                        returnVal.setException(new ServerScopedRuntimeException("Broker
failed reach ACTIVE state (state is " + state + ")"));
+                                    }
+                                }
+
+                                @Override
+                                public void onFailure(final Throwable t)
+                                {
+                                    returnVal.setException(t);
+                                }
+                            }, getTaskExecutor().getExecutor()
+                           );
 
         return returnVal;
     }



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org


Mime
View raw message