You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by kw...@apache.org on 2017/03/09 15:28:38 UTC
svn commit: r1786188 - in /qpid/java/trunk:
bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/replication/
broker-core/src/main/java/org/apache/qpid/server/util/
broker-plugins/management-http/src/main/java/org/apache/qpid/server/managemen...
Author: kwall
Date: Thu Mar 9 15:28:37 2017
New Revision: 1786188
URL: http://svn.apache.org/viewvc?rev=1786188&view=rev
Log:
QPID-7675: [BDB HA] Distinguish between network timeouts and db-ping failures
Added:
qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/util/ExternalServiceTimeoutException.java
Modified:
qpid/java/trunk/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/replication/ReplicatedEnvironmentFacade.java
qpid/java/trunk/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/servlet/rest/RestServlet.java
Modified: qpid/java/trunk/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/replication/ReplicatedEnvironmentFacade.java
URL: http://svn.apache.org/viewvc/qpid/java/trunk/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/replication/ReplicatedEnvironmentFacade.java?rev=1786188&r1=1786187&r2=1786188&view=diff
==============================================================================
--- qpid/java/trunk/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/replication/ReplicatedEnvironmentFacade.java (original)
+++ qpid/java/trunk/bdbstore/src/main/java/org/apache/qpid/server/store/berkeleydb/replication/ReplicatedEnvironmentFacade.java Thu Mar 9 15:28:37 2017
@@ -24,6 +24,7 @@ import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.IOException;
import java.net.InetSocketAddress;
+import java.net.SocketTimeoutException;
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
@@ -79,6 +80,7 @@ import org.apache.qpid.server.store.berk
import org.apache.qpid.server.util.ConnectionScopedRuntimeException;
import org.apache.qpid.server.util.DaemonThreadFactory;
import org.apache.qpid.server.util.ExternalServiceException;
+import org.apache.qpid.server.util.ExternalServiceTimeoutException;
import org.apache.qpid.server.util.ServerScopedRuntimeException;
public class ReplicatedEnvironmentFacade implements EnvironmentFacade, StateChangeListener
@@ -1847,6 +1849,11 @@ public class ReplicatedEnvironmentFacade
byte[] applicationState = state.getAppState();
permittedNodes = convertApplicationStateBytesToPermittedNodeList(applicationState);
}
+ catch (SocketTimeoutException ste)
+ {
+ throw new ExternalServiceTimeoutException(String.format("Timed out trying to connect to existing node '%s' at '%s'",
+ helperNodeName, helperHostPort), ste);
+ }
catch (IOException | ServiceConnectFailedException e)
{
throw new ExternalServiceException(String.format("Cannot connect to existing node '%s' at '%s'",
Added: qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/util/ExternalServiceTimeoutException.java
URL: http://svn.apache.org/viewvc/qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/util/ExternalServiceTimeoutException.java?rev=1786188&view=auto
==============================================================================
--- qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/util/ExternalServiceTimeoutException.java (added)
+++ qpid/java/trunk/broker-core/src/main/java/org/apache/qpid/server/util/ExternalServiceTimeoutException.java Thu Mar 9 15:28:37 2017
@@ -0,0 +1,37 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+ */
+
+package org.apache.qpid.server.util;
+
+/**
+ * Indicates that an external service used by the Broker has timed out.
+ */
+public class ExternalServiceTimeoutException extends ExternalServiceException
+{
+ public ExternalServiceTimeoutException(final String message)
+ {
+ super(message);
+ }
+
+ public ExternalServiceTimeoutException(final String message, final Throwable cause)
+ {
+ super(message, cause);
+ }
+}
Modified: qpid/java/trunk/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/servlet/rest/RestServlet.java
URL: http://svn.apache.org/viewvc/qpid/java/trunk/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/servlet/rest/RestServlet.java?rev=1786188&r1=1786187&r2=1786188&view=diff
==============================================================================
--- qpid/java/trunk/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/servlet/rest/RestServlet.java (original)
+++ qpid/java/trunk/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/servlet/rest/RestServlet.java Thu Mar 9 15:28:37 2017
@@ -63,6 +63,7 @@ import org.apache.qpid.server.model.Inte
import org.apache.qpid.server.model.Model;
import org.apache.qpid.server.model.OperationTimeoutException;
import org.apache.qpid.server.model.preferences.UserPreferences;
+import org.apache.qpid.server.util.ExternalServiceTimeoutException;
import org.apache.qpid.server.util.ServerScopedRuntimeException;
import org.apache.qpid.server.util.urlstreamhandler.data.Handler;
import org.apache.qpid.server.util.DataUrlUtils;
@@ -943,9 +944,15 @@ public class RestServlet extends Abstrac
message = "Not found: " + message;
LOGGER.warn("Unexpected exception processing request ", e);
}
+ else if (e instanceof ExternalServiceTimeoutException)
+ {
+ responseCode = HttpServletResponse.SC_GATEWAY_TIMEOUT;
+ LOGGER.warn("External request timeout ", e);
+ }
else if (e instanceof ExternalServiceException)
{
responseCode = HttpServletResponse.SC_BAD_GATEWAY;
+ LOGGER.warn("External request failed ", e);
}
else
{
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org