You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@activemq.apache.org by jb...@apache.org on 2020/03/11 17:48:02 UTC
[activemq] branch activemq-5.15.x updated: [AMQ-7301] Remove guava
dependency to implement own getRootCause() method
This is an automated email from the ASF dual-hosted git repository.
jbonofre pushed a commit to branch activemq-5.15.x
in repository https://gitbox.apache.org/repos/asf/activemq.git
The following commit(s) were added to refs/heads/activemq-5.15.x by this push:
new 56e61ca [AMQ-7301] Remove guava dependency to implement own getRootCause() method
56e61ca is described below
commit 56e61ca2debb69d7f6c0dde625bac06a2a047f02
Author: jbonofre <jb...@apache.org>
AuthorDate: Wed Mar 11 18:47:19 2020 +0100
[AMQ-7301] Remove guava dependency to implement own getRootCause() method
---
activemq-broker/pom.xml | 5 -----
.../apache/activemq/broker/TransportConnector.java | 21 ++++++++++++++++++---
activemq-osgi/pom.xml | 3 +--
3 files changed, 19 insertions(+), 10 deletions(-)
diff --git a/activemq-broker/pom.xml b/activemq-broker/pom.xml
index 36387cc..a7c01a2 100644
--- a/activemq-broker/pom.xml
+++ b/activemq-broker/pom.xml
@@ -92,11 +92,6 @@
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
</dependency>
- <dependency>
- <groupId>com.google.guava</groupId>
- <artifactId>guava</artifactId>
- <version>${guava-version}</version>
- </dependency>
</dependencies>
<reporting>
diff --git a/activemq-broker/src/main/java/org/apache/activemq/broker/TransportConnector.java b/activemq-broker/src/main/java/org/apache/activemq/broker/TransportConnector.java
index 8f23a24..22e7356 100644
--- a/activemq-broker/src/main/java/org/apache/activemq/broker/TransportConnector.java
+++ b/activemq-broker/src/main/java/org/apache/activemq/broker/TransportConnector.java
@@ -19,14 +19,15 @@ package org.apache.activemq.broker;
import java.io.IOException;
import java.net.URI;
import java.net.URISyntaxException;
+import java.util.ArrayList;
import java.util.LinkedList;
+import java.util.List;
import java.util.StringTokenizer;
import java.util.concurrent.CopyOnWriteArrayList;
import java.util.regex.Pattern;
import javax.management.ObjectName;
-import com.google.common.base.Throwables;
import org.apache.activemq.broker.jmx.ManagedTransportConnector;
import org.apache.activemq.broker.jmx.ManagementContext;
import org.apache.activemq.broker.region.ConnectorStatistics;
@@ -241,9 +242,9 @@ public class TransportConnector implements Connector, BrokerServiceAware {
private void onAcceptError(Exception error, String remoteHost) {
if (brokerService != null && brokerService.isStopping()) {
- LOG.info("Could not accept connection during shutdown {} : {} ({})", (remoteHost == null ? "" : "from " + remoteHost), error.getLocalizedMessage(), Throwables.getRootCause(error).getMessage());
+ LOG.info("Could not accept connection during shutdown {} : {} ({})", (remoteHost == null ? "" : "from " + remoteHost), error.getLocalizedMessage(), getRootCause(error).getMessage());
} else {
- LOG.warn("Could not accept connection from {}: {} ({})", (remoteHost == null ? "" : "from " + remoteHost), error.getMessage(), Throwables.getRootCause(error).getMessage());
+ LOG.warn("Could not accept connection from {}: {} ({})", (remoteHost == null ? "" : "from " + remoteHost), error.getMessage(), getRootCause(error).getMessage());
LOG.debug("Reason: " + error.getMessage(), error);
}
}
@@ -264,6 +265,20 @@ public class TransportConnector implements Connector, BrokerServiceAware {
LOG.info("Connector {} started", getName());
}
+ static Throwable getRootCause(final Throwable throwable) {
+ final List<Throwable> list = getThrowableList(throwable);
+ return list.isEmpty() ? null : list.get(list.size() - 1);
+ }
+
+ static List<Throwable> getThrowableList(Throwable throwable) {
+ final List<Throwable> list = new ArrayList<>();
+ while (throwable != null && !list.contains(throwable)) {
+ list.add(throwable);
+ throwable = throwable.getCause();
+ }
+ return list;
+ }
+
public String getPublishableConnectString() throws Exception {
String publishableConnectString = publishedAddressPolicy.getPublishableConnectString(this);
LOG.debug("Publishing: {} for broker transport URI: {}", publishableConnectString, getConnectUri());
diff --git a/activemq-osgi/pom.xml b/activemq-osgi/pom.xml
index 1acc6a6..b7d1180 100644
--- a/activemq-osgi/pom.xml
+++ b/activemq-osgi/pom.xml
@@ -102,8 +102,7 @@
com.google.errorprone.annotations.concurrent,
com.google.j2objc.annotations,
org.linkedin*,
- org.iq80*,
- com.google.common.base
+ org.iq80*
</activemq.osgi.private.pkg>
<activemq.osgi.dynamic.import>*</activemq.osgi.dynamic.import>
<surefire.argLine>-Xmx512M</surefire.argLine>