mirror of https://github.com/apache/activemq.git
[AMQ-7301] Remove guava dependency to implement own getRootCause() method
This commit is contained in:
parent
f7ab7203ba
commit
d800f1bdb4
|
@ -87,11 +87,6 @@
|
||||||
<groupId>com.fasterxml.jackson.core</groupId>
|
<groupId>com.fasterxml.jackson.core</groupId>
|
||||||
<artifactId>jackson-databind</artifactId>
|
<artifactId>jackson-databind</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
|
||||||
<groupId>com.google.guava</groupId>
|
|
||||||
<artifactId>guava</artifactId>
|
|
||||||
<version>${guava-version}</version>
|
|
||||||
</dependency>
|
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
<reporting>
|
<reporting>
|
||||||
|
|
|
@ -19,14 +19,15 @@ package org.apache.activemq.broker;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.net.URI;
|
import java.net.URI;
|
||||||
import java.net.URISyntaxException;
|
import java.net.URISyntaxException;
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.LinkedList;
|
import java.util.LinkedList;
|
||||||
|
import java.util.List;
|
||||||
import java.util.StringTokenizer;
|
import java.util.StringTokenizer;
|
||||||
import java.util.concurrent.CopyOnWriteArrayList;
|
import java.util.concurrent.CopyOnWriteArrayList;
|
||||||
import java.util.regex.Pattern;
|
import java.util.regex.Pattern;
|
||||||
|
|
||||||
import javax.management.ObjectName;
|
import javax.management.ObjectName;
|
||||||
|
|
||||||
import com.google.common.base.Throwables;
|
|
||||||
import org.apache.activemq.broker.jmx.ManagedTransportConnector;
|
import org.apache.activemq.broker.jmx.ManagedTransportConnector;
|
||||||
import org.apache.activemq.broker.jmx.ManagementContext;
|
import org.apache.activemq.broker.jmx.ManagementContext;
|
||||||
import org.apache.activemq.broker.region.ConnectorStatistics;
|
import org.apache.activemq.broker.region.ConnectorStatistics;
|
||||||
|
@ -240,9 +241,9 @@ public class TransportConnector implements Connector, BrokerServiceAware {
|
||||||
|
|
||||||
private void onAcceptError(Exception error, String remoteHost) {
|
private void onAcceptError(Exception error, String remoteHost) {
|
||||||
if (brokerService != null && brokerService.isStopping()) {
|
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 {
|
} 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);
|
LOG.debug("Reason: " + error.getMessage(), error);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -263,6 +264,20 @@ public class TransportConnector implements Connector, BrokerServiceAware {
|
||||||
LOG.info("Connector {} started", getName());
|
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 {
|
public String getPublishableConnectString() throws Exception {
|
||||||
String publishableConnectString = publishedAddressPolicy.getPublishableConnectString(this);
|
String publishableConnectString = publishedAddressPolicy.getPublishableConnectString(this);
|
||||||
LOG.debug("Publishing: {} for broker transport URI: {}", publishableConnectString, getConnectUri());
|
LOG.debug("Publishing: {} for broker transport URI: {}", publishableConnectString, getConnectUri());
|
||||||
|
|
|
@ -102,8 +102,7 @@
|
||||||
com.google.errorprone.annotations.concurrent,
|
com.google.errorprone.annotations.concurrent,
|
||||||
com.google.j2objc.annotations,
|
com.google.j2objc.annotations,
|
||||||
org.linkedin*,
|
org.linkedin*,
|
||||||
org.iq80*,
|
org.iq80*
|
||||||
com.google.common.base
|
|
||||||
</activemq.osgi.private.pkg>
|
</activemq.osgi.private.pkg>
|
||||||
<activemq.osgi.dynamic.import>*</activemq.osgi.dynamic.import>
|
<activemq.osgi.dynamic.import>*</activemq.osgi.dynamic.import>
|
||||||
<surefire.argLine>-Xmx512M</surefire.argLine>
|
<surefire.argLine>-Xmx512M</surefire.argLine>
|
||||||
|
|
Loading…
Reference in New Issue