From 06d5d360f92dcbffceebb38e9d98605b070aba49 Mon Sep 17 00:00:00 2001 From: David Turner Date: Fri, 18 Sep 2020 08:25:50 +0100 Subject: [PATCH] Tidy up fillInStackTrace implementations (#62555) Removes the unnecessary `synchronized` introduced in #62433 and adjusts the others to return `this` not `null` as required by the parent method's Javadocs. --- .../java/org/elasticsearch/cluster/NotMasterException.java | 2 +- .../index/engine/VersionConflictEngineException.java | 2 +- .../org/elasticsearch/transport/NodeDisconnectedException.java | 2 +- .../transport/NotSerializableTransportException.java | 2 +- .../transport/ReceiveTimeoutTransportException.java | 3 --- .../org/elasticsearch/transport/RemoteTransportException.java | 2 +- .../transport/ResponseHandlerFailureTransportException.java | 2 +- 7 files changed, 6 insertions(+), 9 deletions(-) diff --git a/server/src/main/java/org/elasticsearch/cluster/NotMasterException.java b/server/src/main/java/org/elasticsearch/cluster/NotMasterException.java index 11c2cf2581e..50f89062510 100644 --- a/server/src/main/java/org/elasticsearch/cluster/NotMasterException.java +++ b/server/src/main/java/org/elasticsearch/cluster/NotMasterException.java @@ -41,6 +41,6 @@ public class NotMasterException extends ElasticsearchException { @Override public Throwable fillInStackTrace() { - return null; + return this; } } diff --git a/server/src/main/java/org/elasticsearch/index/engine/VersionConflictEngineException.java b/server/src/main/java/org/elasticsearch/index/engine/VersionConflictEngineException.java index be854b11778..c98c499d7eb 100644 --- a/server/src/main/java/org/elasticsearch/index/engine/VersionConflictEngineException.java +++ b/server/src/main/java/org/elasticsearch/index/engine/VersionConflictEngineException.java @@ -59,7 +59,7 @@ public class VersionConflictEngineException extends EngineException { } @Override - public synchronized Throwable fillInStackTrace() { + public Throwable fillInStackTrace() { // This is on the hot path for updates; stack traces are expensive to compute and not very useful for VCEEs, so don't fill it in. return this; } diff --git a/server/src/main/java/org/elasticsearch/transport/NodeDisconnectedException.java b/server/src/main/java/org/elasticsearch/transport/NodeDisconnectedException.java index 32dcf6700c2..d3174b6959f 100644 --- a/server/src/main/java/org/elasticsearch/transport/NodeDisconnectedException.java +++ b/server/src/main/java/org/elasticsearch/transport/NodeDisconnectedException.java @@ -38,6 +38,6 @@ public class NodeDisconnectedException extends ConnectTransportException { @Override public Throwable fillInStackTrace() { - return null; + return this; } } \ No newline at end of file diff --git a/server/src/main/java/org/elasticsearch/transport/NotSerializableTransportException.java b/server/src/main/java/org/elasticsearch/transport/NotSerializableTransportException.java index c6b90f61d0c..8ee8148d50f 100644 --- a/server/src/main/java/org/elasticsearch/transport/NotSerializableTransportException.java +++ b/server/src/main/java/org/elasticsearch/transport/NotSerializableTransportException.java @@ -35,7 +35,7 @@ public class NotSerializableTransportException extends TransportException { @Override public Throwable fillInStackTrace() { - return null; + return this; } private static String buildMessage(Throwable t) { diff --git a/server/src/main/java/org/elasticsearch/transport/ReceiveTimeoutTransportException.java b/server/src/main/java/org/elasticsearch/transport/ReceiveTimeoutTransportException.java index 88cdc52f10a..c99fdd9f26f 100644 --- a/server/src/main/java/org/elasticsearch/transport/ReceiveTimeoutTransportException.java +++ b/server/src/main/java/org/elasticsearch/transport/ReceiveTimeoutTransportException.java @@ -34,7 +34,4 @@ public class ReceiveTimeoutTransportException extends ActionTransportException { super(in); } -// @Override public Throwable fillInStackTrace() { -// return fillStack(); -// } } diff --git a/server/src/main/java/org/elasticsearch/transport/RemoteTransportException.java b/server/src/main/java/org/elasticsearch/transport/RemoteTransportException.java index 5d8ffdc2609..3111c8a4ec6 100644 --- a/server/src/main/java/org/elasticsearch/transport/RemoteTransportException.java +++ b/server/src/main/java/org/elasticsearch/transport/RemoteTransportException.java @@ -48,6 +48,6 @@ public class RemoteTransportException extends ActionTransportException implement @Override public Throwable fillInStackTrace() { // no need for stack trace here, we always have cause - return null; + return this; } } diff --git a/server/src/main/java/org/elasticsearch/transport/ResponseHandlerFailureTransportException.java b/server/src/main/java/org/elasticsearch/transport/ResponseHandlerFailureTransportException.java index 8597edb8761..40cf692112b 100644 --- a/server/src/main/java/org/elasticsearch/transport/ResponseHandlerFailureTransportException.java +++ b/server/src/main/java/org/elasticsearch/transport/ResponseHandlerFailureTransportException.java @@ -38,6 +38,6 @@ public class ResponseHandlerFailureTransportException extends TransportException @Override public Throwable fillInStackTrace() { - return null; + return this; } // why is this? }