diff --git a/servicebus/data-plane/azure-servicebus/src/main/java/com/microsoft/azure/servicebus/primitives/QuotaExceededException.java b/servicebus/data-plane/azure-servicebus/src/main/java/com/microsoft/azure/servicebus/primitives/QuotaExceededException.java index fc4c82278739..c6791d971092 100644 --- a/servicebus/data-plane/azure-servicebus/src/main/java/com/microsoft/azure/servicebus/primitives/QuotaExceededException.java +++ b/servicebus/data-plane/azure-servicebus/src/main/java/com/microsoft/azure/servicebus/primitives/QuotaExceededException.java @@ -13,23 +13,19 @@ public class QuotaExceededException extends ServiceBusException { private static final long serialVersionUID = -6963913971977282430L; - public QuotaExceededException() - { + public QuotaExceededException() { super(false); } - public QuotaExceededException(String message) - { + public QuotaExceededException(String message) { super(false, message); } - public QuotaExceededException(Throwable cause) - { + public QuotaExceededException(Throwable cause) { super(false, cause); } - public QuotaExceededException(String message, Throwable cause) - { + public QuotaExceededException(String message, Throwable cause) { super(false, message, cause); } diff --git a/servicebus/data-plane/azure-servicebus/src/main/java/com/microsoft/azure/servicebus/primitives/ReceiveWorkItem.java b/servicebus/data-plane/azure-servicebus/src/main/java/com/microsoft/azure/servicebus/primitives/ReceiveWorkItem.java index 2ec60bdb4f28..797ed2a1a452 100644 --- a/servicebus/data-plane/azure-servicebus/src/main/java/com/microsoft/azure/servicebus/primitives/ReceiveWorkItem.java +++ b/servicebus/data-plane/azure-servicebus/src/main/java/com/microsoft/azure/servicebus/primitives/ReceiveWorkItem.java @@ -7,18 +7,15 @@ import java.util.Collection; import java.util.concurrent.CompletableFuture; -class ReceiveWorkItem extends WorkItem> -{ +class ReceiveWorkItem extends WorkItem> { private final int maxMessageCount; - public ReceiveWorkItem(CompletableFuture> completableFuture, Duration timeout, final int maxMessageCount) - { + ReceiveWorkItem(CompletableFuture> completableFuture, Duration timeout, final int maxMessageCount) { super(completableFuture, timeout); this.maxMessageCount = maxMessageCount; } - public int getMaxMessageCount() - { + public int getMaxMessageCount() { return this.maxMessageCount; } } diff --git a/servicebus/data-plane/azure-servicebus/src/main/java/com/microsoft/azure/servicebus/primitives/ReceiverDisconnectedException.java b/servicebus/data-plane/azure-servicebus/src/main/java/com/microsoft/azure/servicebus/primitives/ReceiverDisconnectedException.java index f97e5a1cc914..724d62e0006e 100644 --- a/servicebus/data-plane/azure-servicebus/src/main/java/com/microsoft/azure/servicebus/primitives/ReceiverDisconnectedException.java +++ b/servicebus/data-plane/azure-servicebus/src/main/java/com/microsoft/azure/servicebus/primitives/ReceiverDisconnectedException.java @@ -15,27 +15,22 @@ * @see http://go.microsoft.com/fwlink/?LinkId=761101 * @since 1.0 */ -public class ReceiverDisconnectedException extends ServiceBusException -{ +public class ReceiverDisconnectedException extends ServiceBusException { private static final long serialVersionUID = 3385140843418138213L; - ReceiverDisconnectedException() - { + ReceiverDisconnectedException() { super(false); } - ReceiverDisconnectedException(final String message) - { + ReceiverDisconnectedException(final String message) { super(false, message); } - ReceiverDisconnectedException(final Throwable cause) - { + ReceiverDisconnectedException(final Throwable cause) { super(false, cause); } - ReceiverDisconnectedException(final String message, final Throwable cause) - { + ReceiverDisconnectedException(final String message, final Throwable cause) { super(false, message, cause); } } diff --git a/servicebus/data-plane/azure-servicebus/src/main/java/com/microsoft/azure/servicebus/primitives/ReceiverErrorContext.java b/servicebus/data-plane/azure-servicebus/src/main/java/com/microsoft/azure/servicebus/primitives/ReceiverErrorContext.java index 72bd9dba105a..e9940dfa3ebc 100644 --- a/servicebus/data-plane/azure-servicebus/src/main/java/com/microsoft/azure/servicebus/primitives/ReceiverErrorContext.java +++ b/servicebus/data-plane/azure-servicebus/src/main/java/com/microsoft/azure/servicebus/primitives/ReceiverErrorContext.java @@ -24,8 +24,7 @@ public class ReceiverErrorContext extends ErrorContext final String referenceId, final Integer prefetchCount, final Integer currentLinkCredit, - final Integer prefetchQueueLength) - { + final Integer prefetchQueueLength) { super(namespaceName); this.receivePath = receivePath; this.referenceId = referenceId; @@ -35,49 +34,41 @@ public class ReceiverErrorContext extends ErrorContext } @Override - public String toString() - { + public String toString() { final String superString = super.toString(); StringBuilder toString = new StringBuilder(); - if (!StringUtil.isNullOrEmpty(superString)) - { + if (!StringUtil.isNullOrEmpty(superString)) { toString.append(superString); toString.append(", "); } - if (this.receivePath != null) - { + if (this.receivePath != null) { toString.append(String.format(Locale.US, "PATH: %s", this.receivePath)); toString.append(", "); } - if (this.referenceId != null) - { + if (this.referenceId != null) { toString.append(String.format(Locale.US, "REFERENCE_ID: %s", this.referenceId)); toString.append(", "); } - if (this.prefetchCount != null) - { + if (this.prefetchCount != null) { toString.append(String.format(Locale.US, "PREFETCH_COUNT: %s", this.prefetchCount)); toString.append(", "); } - if (this.currentLinkCredit != null) - { + if (this.currentLinkCredit != null) { toString.append(String.format(Locale.US, "LINK_CREDIT: %s", this.currentLinkCredit)); toString.append(", "); } - if (this.prefetchQueueLength != null) - { + if (this.prefetchQueueLength != null) { toString.append(String.format(Locale.US, "PREFETCH_Q_LEN: %s", this.prefetchQueueLength)); toString.append(", "); } - if (toString.length() > 2) - { + if (toString.length() > 2) { toString.setLength(toString.length() - 2); } diff --git a/servicebus/data-plane/azure-servicebus/src/main/java/com/microsoft/azure/servicebus/primitives/RequestResponseLink.java b/servicebus/data-plane/azure-servicebus/src/main/java/com/microsoft/azure/servicebus/primitives/RequestResponseLink.java index 1f7c17eb411a..8f74169ce915 100644 --- a/servicebus/data-plane/azure-servicebus/src/main/java/com/microsoft/azure/servicebus/primitives/RequestResponseLink.java +++ b/servicebus/data-plane/azure-servicebus/src/main/java/com/microsoft/azure/servicebus/primitives/RequestResponseLink.java @@ -6,7 +6,11 @@ import java.io.IOException; import java.time.Duration; import java.time.ZonedDateTime; -import java.util.*; +import java.util.HashMap; +import java.util.LinkedList; +import java.util.Locale; +import java.util.Map; +import java.util.UUID; import java.util.concurrent.CompletableFuture; import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ScheduledFuture; @@ -46,7 +50,7 @@ import static java.nio.charset.StandardCharsets.UTF_8; -class RequestResponseLink extends ClientEntity{ +class RequestResponseLink extends ClientEntity { private static final Logger TRACE_LOGGER = LoggerFactory.getLogger(RequestResponseLink.class); private final Object recreateLinksLock; @@ -110,8 +114,7 @@ public static CompletableFuture createAsync( try { messagingFactory.scheduleOnReactorThread(new DispatchHandler() { @Override - public void onEvent() - { + public void onEvent() { requestReponseLink.createInternalLinks(); } }); @@ -143,8 +146,7 @@ public static String getManagementNodeLinkPath(String entityPath) { return String.format("%s/%s", entityPath, AmqpConstants.MANAGEMENT_NODE_ADDRESS_SEGMENT); } - public static String getCBSNodeLinkPath() - { + public static String getCBSNodeLinkPath() { return AmqpConstants.CBS_NODE_ADDRESS_SEGMENT; } @@ -185,7 +187,7 @@ private CompletableFuture sendTokenAndSetRenewTimer(boolean retryOnFailure return CompletableFuture.completedFuture(null); } else { CompletableFuture> sendTokenFuture = this.underlyingFactory.sendSecurityTokenAndSetRenewTimer(this.sasTokenAudienceURI, retryOnFailure, () -> this.sendTokenAndSetRenewTimer(true)); - CompletableFuture sasTokenFuture = sendTokenFuture.thenAccept((f) -> {this.sasTokenRenewTimerFuture = f;}); + CompletableFuture sasTokenFuture = sendTokenFuture.thenAccept((f) -> this.sasTokenRenewTimerFuture = f); if (additionalAudienceURI != null) { CompletableFuture transferSendTokenFuture = this.underlyingFactory.sendSecurityToken(this.additionalAudienceURI); @@ -249,9 +251,9 @@ private void createInternalLinks() { BaseHandler.setHandler(session, new SessionHandler(this.linkPath)); String sendLinkNamePrefix = "RequestResponseLink-Sender".concat(TrackingUtil.TRACKING_ID_TOKEN_SEPARATOR).concat(StringUtil.getShortRandomString()); - String sendLinkName = !StringUtil.isNullOrEmpty(connection.getRemoteContainer()) ? - sendLinkNamePrefix.concat(TrackingUtil.TRACKING_ID_TOKEN_SEPARATOR).concat(connection.getRemoteContainer()) : - sendLinkNamePrefix; + String sendLinkName = !StringUtil.isNullOrEmpty(connection.getRemoteContainer()) + ? sendLinkNamePrefix.concat(TrackingUtil.TRACKING_ID_TOKEN_SEPARATOR).concat(connection.getRemoteContainer()) + : sendLinkNamePrefix; Sender sender = session.sender(sendLinkName); Target sednerTarget = new Target(); @@ -272,9 +274,9 @@ private void createInternalLinks() { BaseHandler.setHandler(session, new SessionHandler(this.linkPath)); String receiveLinkNamePrefix = "RequestResponseLink-Receiver".concat(TrackingUtil.TRACKING_ID_TOKEN_SEPARATOR).concat(StringUtil.getShortRandomString()); - String receiveLinkName = !StringUtil.isNullOrEmpty(connection.getRemoteContainer()) ? - receiveLinkNamePrefix.concat(TrackingUtil.TRACKING_ID_TOKEN_SEPARATOR).concat(connection.getRemoteContainer()) : - receiveLinkNamePrefix; + String receiveLinkName = !StringUtil.isNullOrEmpty(connection.getRemoteContainer()) + ? receiveLinkNamePrefix.concat(TrackingUtil.TRACKING_ID_TOKEN_SEPARATOR).concat(connection.getRemoteContainer()) + : receiveLinkNamePrefix; Receiver receiver = session.receiver(receiveLinkName); Source receiverSource = new Source(); receiverSource.setAddress(this.linkPath); @@ -519,7 +521,7 @@ private class InternalReceiver extends ClientEntity implements IAmqpReceiver { protected InternalReceiver(String clientId, RequestResponseLink parent) { super(clientId); this.parent = parent; - this.linkGeneration = parent.internalLinkGeneration;// Read it in the constructor as it may change later + this.linkGeneration = parent.internalLinkGeneration; // Read it in the constructor as it may change later this.openFuture = new CompletableFuture<>(); this.closeFuture = new CompletableFuture<>(); } @@ -660,12 +662,12 @@ private class InternalSender extends ClientEntity implements IAmqpSender { protected InternalSender(String clientId, RequestResponseLink parent, InternalSender senderToBeCopied) { super(clientId); this.parent = parent; - this.linkGeneration = parent.internalLinkGeneration;// Read it in the constructor as it may change later + this.linkGeneration = parent.internalLinkGeneration; // Read it in the constructor as it may change later this.availableCredit = new AtomicInteger(0); this.pendingSendsSyncLock = new Object(); this.isSendLoopRunning = false; - this.openFuture = new CompletableFuture(); - this.closeFuture = new CompletableFuture(); + this.openFuture = new CompletableFuture<>(); + this.closeFuture = new CompletableFuture<>(); if (senderToBeCopied == null) { this.pendingFreshSends = new LinkedList<>(); @@ -858,7 +860,7 @@ private void runSendLoop() { try { encodedPair = Util.encodeMessageToOptimalSizeArray(requestToBeSent.getRequest(), this.maxMessageSize); } catch (PayloadSizeExceededException exception) { - this.parent.exceptionallyCompleteRequest((String)requestToBeSent.getRequest().getMessageId(), new PayloadSizeExceededException(String.format("Size of the payload exceeded Maximum message size: %s kb", this.maxMessageSize / 1024), exception), false); + this.parent.exceptionallyCompleteRequest((String) requestToBeSent.getRequest().getMessageId(), new PayloadSizeExceededException(String.format("Size of the payload exceeded Maximum message size: %s kb", this.maxMessageSize / 1024), exception), false); } try { diff --git a/servicebus/data-plane/azure-servicebus/src/main/java/com/microsoft/azure/servicebus/primitives/RequestResponseLinkCache.java b/servicebus/data-plane/azure-servicebus/src/main/java/com/microsoft/azure/servicebus/primitives/RequestResponseLinkCache.java index 21e17a892505..ff758a2fecd7 100644 --- a/servicebus/data-plane/azure-servicebus/src/main/java/com/microsoft/azure/servicebus/primitives/RequestResponseLinkCache.java +++ b/servicebus/data-plane/azure-servicebus/src/main/java/com/microsoft/azure/servicebus/primitives/RequestResponseLinkCache.java @@ -12,38 +12,30 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; -class RequestResponseLinkCache -{ +class RequestResponseLinkCache { private static final Logger TRACE_LOGGER = LoggerFactory.getLogger(RequestResponseLinkCache.class); private Object lock = new Object(); private final MessagingFactory underlyingFactory; private HashMap pathToRRLinkMap; - public RequestResponseLinkCache(MessagingFactory underlyingFactory) - { + RequestResponseLinkCache(MessagingFactory underlyingFactory) { this.underlyingFactory = underlyingFactory; this.pathToRRLinkMap = new HashMap<>(); } - public CompletableFuture obtainRequestResponseLinkAsync(String entityPath, String transferEntityPath, MessagingEntityType entityType) - { + public CompletableFuture obtainRequestResponseLinkAsync(String entityPath, String transferEntityPath, MessagingEntityType entityType) { RequestResponseLinkWrapper wrapper; String mapKey; - if (transferEntityPath != null) - { + if (transferEntityPath != null) { mapKey = entityPath + ":" + transferEntityPath; - } - else - { + } else { mapKey = entityPath; } - synchronized (lock) - { + synchronized (lock) { wrapper = this.pathToRRLinkMap.get(mapKey); - if(wrapper == null) - { + if (wrapper == null) { wrapper = new RequestResponseLinkWrapper(this.underlyingFactory, entityPath, transferEntityPath, entityType); this.pathToRRLinkMap.put(mapKey, wrapper); } @@ -51,35 +43,27 @@ public CompletableFuture obtainRequestResponseLinkAsync(Str return wrapper.acquireReferenceAsync(); } - public void releaseRequestResponseLink(String entityPath, String transferEntityPath) - { + public void releaseRequestResponseLink(String entityPath, String transferEntityPath) { String mapKey; - if (transferEntityPath != null) - { + if (transferEntityPath != null) { mapKey = entityPath + ":" + transferEntityPath; - } - else - { + } else { mapKey = entityPath; } RequestResponseLinkWrapper wrapper; - synchronized (lock) - { + synchronized (lock) { wrapper = this.pathToRRLinkMap.get(mapKey); } - if(wrapper != null) - { + if (wrapper != null) { wrapper.releaseReference(); } } - public CompletableFuture freeAsync() - { + public CompletableFuture freeAsync() { TRACE_LOGGER.info("Closing all cached request-response links"); ArrayList> closeFutures = new ArrayList<>(); - for(RequestResponseLinkWrapper wrapper : this.pathToRRLinkMap.values()) - { + for (RequestResponseLinkWrapper wrapper : this.pathToRRLinkMap.values()) { closeFutures.add(wrapper.forceCloseAsync()); } @@ -87,16 +71,13 @@ public CompletableFuture freeAsync() return CompletableFuture.allOf(closeFutures.toArray(new CompletableFuture[0])); } - private void removeWrapperFromCache(String entityPath) - { - synchronized (lock) - { + private void removeWrapperFromCache(String entityPath) { + synchronized (lock) { this.pathToRRLinkMap.remove(entityPath); } } - private class RequestResponseLinkWrapper - { + private class RequestResponseLinkWrapper { private Object lock = new Object(); private final MessagingFactory underlyingFactory; private final String entityPath; @@ -107,8 +88,7 @@ private class RequestResponseLinkWrapper private ArrayList> waiters; private boolean isClosed; - public RequestResponseLinkWrapper(MessagingFactory underlyingFactory, String entityPath, String transferEntityPath, MessagingEntityType entityType) - { + RequestResponseLinkWrapper(MessagingFactory underlyingFactory, String entityPath, String transferEntityPath, MessagingEntityType entityType) { this.underlyingFactory = underlyingFactory; this.entityPath = entityPath; this.transferEntityPath = transferEntityPath; @@ -120,8 +100,7 @@ public RequestResponseLinkWrapper(MessagingFactory underlyingFactory, String ent this.createRequestResponseLinkAsync(); } - private void createRequestResponseLinkAsync() - { + private void createRequestResponseLinkAsync() { String requestResponseLinkPath = RequestResponseLink.getManagementNodeLinkPath(this.entityPath); String sasTokenAudienceURI = String.format(ClientConstants.SAS_TOKEN_AUDIENCE_FORMAT, this.underlyingFactory.getHostName(), this.entityPath); @@ -141,48 +120,35 @@ private void createRequestResponseLinkAsync() sasTokenAudienceURI, transferDestinationSasTokenAudienceURI, additionalProperties, - this.entityType).handleAsync((rrlink, ex) -> - { - synchronized (this.lock) - { - if(ex == null) - { - TRACE_LOGGER.info("Created requestresponselink to '{}'", requestResponseLinkPath); - if(this.isClosed) - { - // Factory is likely closed. Close the link too - rrlink.closeAsync(); + this.entityType).handleAsync((rrlink, ex) -> { + synchronized (this.lock) { + if (ex == null) { + TRACE_LOGGER.info("Created requestresponselink to '{}'", requestResponseLinkPath); + if (this.isClosed) { + // Factory is likely closed. Close the link too + rrlink.closeAsync(); + } else { + this.requestResponseLink = rrlink; + this.completeWaiters(null); + } + } else { + Throwable cause = ExceptionUtil.extractAsyncCompletionCause(ex); + TRACE_LOGGER.error("Creating requestresponselink to '{}' failed.", requestResponseLinkPath, cause); + RequestResponseLinkCache.this.removeWrapperFromCache(this.entityPath); + this.completeWaiters(cause); + } } - else - { - this.requestResponseLink = rrlink; - this.completeWaiters(null); - } - } - else - { - Throwable cause = ExceptionUtil.extractAsyncCompletionCause(ex); - TRACE_LOGGER.error("Creating requestresponselink to '{}' failed.", requestResponseLinkPath, cause); - RequestResponseLinkCache.this.removeWrapperFromCache(this.entityPath); - this.completeWaiters(cause); - } - } - - return null; - }, MessagingFactory.INTERNAL_THREAD_POOL); + + return null; + }, MessagingFactory.INTERNAL_THREAD_POOL); } - private void completeWaiters(Throwable exception) - { - for(CompletableFuture waiter : this.waiters) - { - if(exception == null) - { + private void completeWaiters(Throwable exception) { + for (CompletableFuture waiter : this.waiters) { + if (exception == null) { this.referenceCount++; AsyncUtil.completeFuture(waiter, this.requestResponseLink); - } - else - { + } else { AsyncUtil.completeFutureExceptionally(waiter, exception); } } @@ -190,30 +156,22 @@ private void completeWaiters(Throwable exception) this.waiters.clear(); } - public CompletableFuture acquireReferenceAsync() - { - synchronized (this.lock) - { - if(this.requestResponseLink == null) - { + public CompletableFuture acquireReferenceAsync() { + synchronized (this.lock) { + if (this.requestResponseLink == null) { CompletableFuture waiter = new CompletableFuture<>(); this.waiters.add(waiter); return waiter; - } - else - { + } else { this.referenceCount++; return CompletableFuture.completedFuture(this.requestResponseLink); } } } - public void releaseReference() - { - synchronized (this.lock) - { - if(--this.referenceCount == 0) - { + public void releaseReference() { + synchronized (this.lock) { + if (--this.referenceCount == 0) { RequestResponseLinkCache.this.removeWrapperFromCache(this.entityPath); TRACE_LOGGER.info("Closing requestresponselink to '{}'", this.requestResponseLink.getLinkPath()); this.requestResponseLink.closeAsync(); @@ -221,21 +179,16 @@ public void releaseReference() } } - public CompletableFuture forceCloseAsync() - { + public CompletableFuture forceCloseAsync() { TRACE_LOGGER.info("Force closing requestresponselink to '{}'", this.requestResponseLink.getLinkPath()); this.isClosed = true; - if(this.waiters.size() > 0) - { + if (this.waiters.size() > 0) { this.completeWaiters(new ServiceBusException(false, "MessagingFactory closed.")); } - if(this.requestResponseLink != null) - { + if (this.requestResponseLink != null) { return this.requestResponseLink.closeAsync(); - } - else - { + } else { return CompletableFuture.completedFuture(null); } } diff --git a/servicebus/data-plane/azure-servicebus/src/main/java/com/microsoft/azure/servicebus/primitives/RequestResponseUtils.java b/servicebus/data-plane/azure-servicebus/src/main/java/com/microsoft/azure/servicebus/primitives/RequestResponseUtils.java index 01553a75ac59..513b5f7d0655 100644 --- a/servicebus/data-plane/azure-servicebus/src/main/java/com/microsoft/azure/servicebus/primitives/RequestResponseUtils.java +++ b/servicebus/data-plane/azure-servicebus/src/main/java/com/microsoft/azure/servicebus/primitives/RequestResponseUtils.java @@ -8,7 +8,14 @@ import java.util.HashMap; import java.util.Map; -import com.microsoft.azure.servicebus.rules.*; +import com.microsoft.azure.servicebus.rules.CorrelationFilter; +import com.microsoft.azure.servicebus.rules.FalseFilter; +import com.microsoft.azure.servicebus.rules.Filter; +import com.microsoft.azure.servicebus.rules.RuleAction; +import com.microsoft.azure.servicebus.rules.RuleDescription; +import com.microsoft.azure.servicebus.rules.SqlFilter; +import com.microsoft.azure.servicebus.rules.SqlRuleAction; +import com.microsoft.azure.servicebus.rules.TrueFilter; import org.apache.qpid.proton.amqp.DescribedType; import org.apache.qpid.proton.amqp.Symbol; import org.apache.qpid.proton.amqp.messaging.AmqpValue; @@ -49,30 +56,30 @@ public static int getResponseStatusCode(Message responseMessage) { codeObject = responseMessage.getApplicationProperties().getValue().get(ClientConstants.REQUEST_RESPONSE_LEGACY_STATUS_CODE); } if (codeObject != null) { - statusCode = (int)codeObject; + statusCode = (int) codeObject; } return statusCode; } public static Symbol getResponseErrorCondition(Message responseMessage) { - Symbol errorCondition = (Symbol)responseMessage.getApplicationProperties().getValue().get(ClientConstants.REQUEST_RESPONSE_ERROR_CONDITION); + Symbol errorCondition = (Symbol) responseMessage.getApplicationProperties().getValue().get(ClientConstants.REQUEST_RESPONSE_ERROR_CONDITION); if (errorCondition == null) { - errorCondition = (Symbol)responseMessage.getApplicationProperties().getValue().get(ClientConstants.REQUEST_RESPONSE_LEGACY_ERROR_CONDITION); + errorCondition = (Symbol) responseMessage.getApplicationProperties().getValue().get(ClientConstants.REQUEST_RESPONSE_LEGACY_ERROR_CONDITION); } return errorCondition; } public static String getResponseStatusDescription(Message responseMessage) { - String statusDescription = (String)responseMessage.getApplicationProperties().getValue().get(ClientConstants.REQUEST_RESPONSE_STATUS_DESCRIPTION); + String statusDescription = (String) responseMessage.getApplicationProperties().getValue().get(ClientConstants.REQUEST_RESPONSE_STATUS_DESCRIPTION); if (statusDescription == null) { - statusDescription = (String)responseMessage.getApplicationProperties().getValue().get(ClientConstants.REQUEST_RESPONSE_LEGACY_STATUS_DESCRIPTION); + statusDescription = (String) responseMessage.getApplicationProperties().getValue().get(ClientConstants.REQUEST_RESPONSE_LEGACY_STATUS_DESCRIPTION); } return statusDescription; } public static Map getResponseBody(Message responseMessage) { - return (Map)((AmqpValue)responseMessage.getBody()).getValue(); + return (Map) ((AmqpValue) responseMessage.getBody()).getValue(); } public static Exception genereateExceptionFromResponse(Message responseMessage) { @@ -89,10 +96,10 @@ public static Map encodeRuleDescriptionToMap(RuleDescription rul HashMap descriptionMap = new HashMap<>(); if (ruleDescription.getFilter() instanceof SqlFilter) { HashMap filterMap = new HashMap<>(); - filterMap.put(ClientConstants.REQUEST_RESPONSE_EXPRESSION, ((SqlFilter)ruleDescription.getFilter()).getSqlExpression()); + filterMap.put(ClientConstants.REQUEST_RESPONSE_EXPRESSION, ((SqlFilter) ruleDescription.getFilter()).getSqlExpression()); descriptionMap.put(ClientConstants.REQUEST_RESPONSE_SQLFILTER, filterMap); } else if (ruleDescription.getFilter() instanceof CorrelationFilter) { - CorrelationFilter correlationFilter = (CorrelationFilter)ruleDescription.getFilter(); + CorrelationFilter correlationFilter = (CorrelationFilter) ruleDescription.getFilter(); HashMap filterMap = new HashMap<>(); filterMap.put(ClientConstants.REQUEST_RESPONSE_CORRELATION_ID, correlationFilter.getCorrelationId()); filterMap.put(ClientConstants.REQUEST_RESPONSE_MESSAGE_ID, correlationFilter.getMessageId()); @@ -113,7 +120,7 @@ public static Map encodeRuleDescriptionToMap(RuleDescription rul descriptionMap.put(ClientConstants.REQUEST_RESPONSE_SQLRULEACTION, null); } else if (ruleDescription.getAction() instanceof SqlRuleAction) { HashMap sqlActionMap = new HashMap<>(); - sqlActionMap.put(ClientConstants.REQUEST_RESPONSE_EXPRESSION, ((SqlRuleAction)ruleDescription.getAction()).getSqlExpression()); + sqlActionMap.put(ClientConstants.REQUEST_RESPONSE_EXPRESSION, ((SqlRuleAction) ruleDescription.getAction()).getSqlExpression()); descriptionMap.put(ClientConstants.REQUEST_RESPONSE_SQLRULEACTION, sqlActionMap); } else { throw new IllegalArgumentException("This API supports the addition of only filters with SqlRuleActions."); @@ -156,13 +163,13 @@ private static Filter decodeFilter(Object describedFilterObject) { if (describedFilterObject != null && describedFilterObject instanceof DescribedType) { DescribedType describedFilter = (DescribedType) describedFilterObject; if (describedFilter.getDescriptor().equals(ClientConstants.SQL_FILTER_DESCRIPTOR)) { - ArrayList describedSqlFilter = (ArrayList)describedFilter.getDescribed(); + ArrayList describedSqlFilter = (ArrayList) describedFilter.getDescribed(); if (describedSqlFilter.size() > 0) { - return new SqlFilter((String)describedSqlFilter.get(0)); + return new SqlFilter((String) describedSqlFilter.get(0)); } } else if (describedFilter.getDescriptor().equals(ClientConstants.CORRELATION_FILTER_DESCRIPTOR)) { CorrelationFilter correlationFilter = new CorrelationFilter(); - ArrayList describedCorrelationFilter = (ArrayList)describedFilter.getDescribed(); + ArrayList describedCorrelationFilter = (ArrayList) describedFilter.getDescribed(); int countCorrelationFilter = describedCorrelationFilter.size(); if (countCorrelationFilter-- > 0) { correlationFilter.setCorrelationId((String) (describedCorrelationFilter.get(0))); @@ -191,7 +198,7 @@ private static Filter decodeFilter(Object describedFilterObject) { if (countCorrelationFilter > 0) { Object properties = describedCorrelationFilter.get(8); if (properties != null && properties instanceof Map) { - correlationFilter.setProperties((Map)properties); + correlationFilter.setProperties((Map) properties); } } diff --git a/servicebus/data-plane/azure-servicebus/src/main/java/com/microsoft/azure/servicebus/primitives/RequestResponseWorkItem.java b/servicebus/data-plane/azure-servicebus/src/main/java/com/microsoft/azure/servicebus/primitives/RequestResponseWorkItem.java index a906da2c9cc4..77851f4cfb4f 100644 --- a/servicebus/data-plane/azure-servicebus/src/main/java/com/microsoft/azure/servicebus/primitives/RequestResponseWorkItem.java +++ b/servicebus/data-plane/azure-servicebus/src/main/java/com/microsoft/azure/servicebus/primitives/RequestResponseWorkItem.java @@ -9,8 +9,7 @@ import com.microsoft.azure.servicebus.TransactionContext; import org.apache.qpid.proton.message.Message; -public class RequestResponseWorkItem extends WorkItem -{ +public class RequestResponseWorkItem extends WorkItem { Message request; TransactionContext transaction; @@ -26,10 +25,11 @@ public RequestResponseWorkItem(Message request, TransactionContext transaction, this.transaction = transaction; } - public Message getRequest() - { + public Message getRequest() { return this.request; } - public TransactionContext getTransaction() { return this.transaction; } + public TransactionContext getTransaction() { + return this.transaction; + } } diff --git a/servicebus/data-plane/azure-servicebus/src/main/java/com/microsoft/azure/servicebus/primitives/RetryExponential.java b/servicebus/data-plane/azure-servicebus/src/main/java/com/microsoft/azure/servicebus/primitives/RetryExponential.java index afd24b558143..77a2e4f450b9 100644 --- a/servicebus/data-plane/azure-servicebus/src/main/java/com/microsoft/azure/servicebus/primitives/RetryExponential.java +++ b/servicebus/data-plane/azure-servicebus/src/main/java/com/microsoft/azure/servicebus/primitives/RetryExponential.java @@ -11,15 +11,13 @@ * RetryIntervals will be computed using a retryFactor which is a function of deltaBackOff (MaximumBackoff - MinimumBackoff) and MaximumRetryCount * @since 1.0 */ -public final class RetryExponential extends RetryPolicy -{ +public final class RetryExponential extends RetryPolicy { private final Duration minimumBackoff; private final Duration maximumBackoff; private final int maximumRetryCount; private final double retryFactor; - public RetryExponential(final Duration minimumBackoff, final Duration maximumBackoff, final int maximumRetryCount, final String name) - { + public RetryExponential(final Duration minimumBackoff, final Duration maximumBackoff, final int maximumRetryCount, final String name) { super(name); this.minimumBackoff = minimumBackoff; @@ -29,20 +27,17 @@ public RetryExponential(final Duration minimumBackoff, final Duration maximumBac } @Override - protected Duration onGetNextRetryInterval(final String clientId, final Exception lastException, final Duration remainingTime, final int baseWaitTimeSecs) - { + protected Duration onGetNextRetryInterval(final String clientId, final Exception lastException, final Duration remainingTime, final int baseWaitTimeSecs) { int currentRetryCount = this.getRetryCount(clientId); - if (currentRetryCount >= this.maximumRetryCount) - { + if (currentRetryCount >= this.maximumRetryCount) { return null; } - double nextRetryInterval = Math.pow(this.retryFactor, (double)currentRetryCount); - long nextRetryIntervalSeconds = (long) nextRetryInterval ; - long nextRetryIntervalNano = (long)((nextRetryInterval - (double)nextRetryIntervalSeconds) * 1000000000); - if (remainingTime.getSeconds() < Math.max(nextRetryInterval, ClientConstants.TIMER_TOLERANCE.getSeconds())) - { + double nextRetryInterval = Math.pow(this.retryFactor, (double) currentRetryCount); + long nextRetryIntervalSeconds = (long) nextRetryInterval; + long nextRetryIntervalNano = (long) ((nextRetryInterval - (double) nextRetryIntervalSeconds) * 1000000000); + if (remainingTime.getSeconds() < Math.max(nextRetryInterval, ClientConstants.TIMER_TOLERANCE.getSeconds())) { return null; } @@ -52,11 +47,9 @@ protected Duration onGetNextRetryInterval(final String clientId, final Exception return retryAfter; } - private double computeRetryFactor() - { + private double computeRetryFactor() { long deltaBackoff = this.maximumBackoff.minus(this.minimumBackoff).getSeconds(); - if (deltaBackoff <= 0 || this.maximumRetryCount <= 0) - { + if (deltaBackoff <= 0 || this.maximumRetryCount <= 0) { return 0; } diff --git a/servicebus/data-plane/azure-servicebus/src/main/java/com/microsoft/azure/servicebus/primitives/RetryPolicy.java b/servicebus/data-plane/azure-servicebus/src/main/java/com/microsoft/azure/servicebus/primitives/RetryPolicy.java index 194fc6882b2a..f06ac7ea3b8f 100644 --- a/servicebus/data-plane/azure-servicebus/src/main/java/com/microsoft/azure/servicebus/primitives/RetryPolicy.java +++ b/servicebus/data-plane/azure-servicebus/src/main/java/com/microsoft/azure/servicebus/primitives/RetryPolicy.java @@ -14,8 +14,7 @@ * */ // TODO: SIMPLIFY retryPolicy - ConcurrentHashMap is not needed -public abstract class RetryPolicy -{ +public abstract class RetryPolicy { private static final RetryPolicy NO_RETRY = new RetryExponential(Duration.ofSeconds(0), Duration.ofSeconds(0), 0, ClientConstants.NO_RETRY); private final String name; @@ -25,18 +24,16 @@ public abstract class RetryPolicy * Creates an instance of RetryPolicy with the given name. * @param name name of the policy */ - protected RetryPolicy(final String name) - { + protected RetryPolicy(final String name) { this.name = name; - this.retryCounts = new ConcurrentHashMap(); + this.retryCounts = new ConcurrentHashMap<>(); } /** * Increments the number of successive retry attempts made by a client. * @param clientId id of the client retrying a failed operation */ - public void incrementRetryCount(String clientId) - { + public void incrementRetryCount(String clientId) { Integer retryCount = this.retryCounts.get(clientId); this.retryCounts.put(clientId, retryCount == null ? 1 : retryCount + 1); } @@ -54,15 +51,12 @@ public void resetRetryCount(String clientId) { * @param exception exception encountered by an operation, to be determined if it is retry-able. * @return true if the exception is retry-able (like ServerBusy or other transient exception), else returns false */ - public static boolean isRetryableException(Exception exception) - { - if (exception == null) - { + public static boolean isRetryableException(Exception exception) { + if (exception == null) { throw new IllegalArgumentException("exception cannot be null"); } - if (exception instanceof ServiceBusException) - { + if (exception instanceof ServiceBusException) { return ((ServiceBusException) exception).getIsTransient(); } @@ -74,8 +68,7 @@ public static boolean isRetryableException(Exception exception) * if no retry policy is specified. * @return a retry policy that provides exponentially increasing retry intervals */ - public static RetryPolicy getDefault() - { + public static RetryPolicy getDefault() { return new RetryExponential( ClientConstants.DEFAULT_RERTRY_MIN_BACKOFF, ClientConstants.DEFAULT_RERTRY_MAX_BACKOFF, @@ -87,13 +80,11 @@ public static RetryPolicy getDefault() * Gets a retry policy that doesn't retry any operations, effectively disabling retries. Clients can use this retry policy in case they do not want any operation automatically retried. * @return a retry policy that doesn't retry any operations */ - public static RetryPolicy getNoRetry() - { + public static RetryPolicy getNoRetry() { return RetryPolicy.NO_RETRY; } - protected int getRetryCount(String clientId) - { + protected int getRetryCount(String clientId) { Integer retryCount = this.retryCounts.get(clientId); return retryCount == null ? 0 : retryCount; } @@ -106,17 +97,14 @@ protected int getRetryCount(String clientId) * @param remainingTime remainingTime to retry before the operation times out * @return duration after which the operation will be retried. Returns null when the operation should not retried. */ - public Duration getNextRetryInterval(String clientId, Exception lastException, Duration remainingTime) - { - if (!RetryPolicy.isRetryableException(lastException)) - { + public Duration getNextRetryInterval(String clientId, Exception lastException, Duration remainingTime) { + if (!RetryPolicy.isRetryableException(lastException)) { return null; } int baseWaitTime = 0; - if (lastException != null && - (lastException instanceof ServerBusyException || (lastException.getCause() != null && lastException.getCause() instanceof ServerBusyException))) - { + if (lastException != null + && (lastException instanceof ServerBusyException || (lastException.getCause() != null && lastException.getCause() instanceof ServerBusyException))) { baseWaitTime += ClientConstants.SERVER_BUSY_BASE_SLEEP_TIME_IN_SECS; } @@ -135,8 +123,7 @@ public Duration getNextRetryInterval(String clientId, Exception lastException, D protected abstract Duration onGetNextRetryInterval(String clientId, Exception lastException, Duration remainingTime, int baseWaitTime); @Override - public String toString() - { + public String toString() { return this.name; } } diff --git a/servicebus/data-plane/azure-servicebus/src/main/java/com/microsoft/azure/servicebus/primitives/SASUtil.java b/servicebus/data-plane/azure-servicebus/src/main/java/com/microsoft/azure/servicebus/primitives/SASUtil.java index 87ff366b112c..13b14158f06d 100644 --- a/servicebus/data-plane/azure-servicebus/src/main/java/com/microsoft/azure/servicebus/primitives/SASUtil.java +++ b/servicebus/data-plane/azure-servicebus/src/main/java/com/microsoft/azure/servicebus/primitives/SASUtil.java @@ -29,37 +29,32 @@ public class SASUtil { private static final Logger TRACE_LOGGER = LoggerFactory.getLogger(SASUtil.class); private static final String SAS_FORMAT = "SharedAccessSignature sr=%s&sig=%s&se=%s&skn=%s"; - private static final String HMACAlgorithm = "HMACSHA256"; - private static final Base64.Encoder base64Encoder = Base64.getEncoder(); + private static final String HMAC_ALGORITHM = "HMACSHA256"; + private static final Base64.Encoder BASE64_ENCODER = Base64.getEncoder(); - public static String generateSharedAccessSignatureToken(String sasKeyName, String sasKey, String resourceURI, int validityInSeconds) throws InvalidKeyException - { - if(StringUtil.isNullOrWhiteSpace(sasKey)) - { + public static String generateSharedAccessSignatureToken(String sasKeyName, String sasKey, String resourceURI, int validityInSeconds) throws InvalidKeyException { + if (StringUtil.isNullOrWhiteSpace(sasKey)) { throw new IllegalArgumentException("Invalid SAS key"); } - if(StringUtil.isNullOrWhiteSpace(resourceURI)) - { + if (StringUtil.isNullOrWhiteSpace(resourceURI)) { throw new IllegalArgumentException("Invalid resourceURI"); } - if(validityInSeconds <= 0) - { + if (validityInSeconds <= 0) { throw new IllegalArgumentException("validityInSeconds should be positive"); } String validUntil = String.valueOf(Instant.now().getEpochSecond() + validityInSeconds); - try - { + try { String utf8EncodingName = StandardCharsets.UTF_8.name(); String encodedResourceURI = URLEncoder.encode(resourceURI, utf8EncodingName); String secretToSign = encodedResourceURI + "\n" + validUntil; - Mac hmac = Mac.getInstance(HMACAlgorithm); - SecretKeySpec secretKey = new SecretKeySpec(StringUtil.convertStringToBytes(sasKey), HMACAlgorithm); + Mac hmac = Mac.getInstance(HMAC_ALGORITHM); + SecretKeySpec secretKey = new SecretKeySpec(StringUtil.convertStringToBytes(sasKey), HMAC_ALGORITHM); hmac.init(secretKey); byte[] signatureBytes = hmac.doFinal(StringUtil.convertStringToBytes(secretToSign)); - String signature = base64Encoder.encodeToString(signatureBytes); + String signature = BASE64_ENCODER.encodeToString(signatureBytes); TRACE_LOGGER.debug("Generated SAS token for resource: {} with sas key name : {}", resourceURI, sasKeyName); return String.format(Locale.US, SAS_FORMAT, encodedResourceURI, diff --git a/servicebus/data-plane/azure-servicebus/src/main/java/com/microsoft/azure/servicebus/primitives/SendWorkItem.java b/servicebus/data-plane/azure-servicebus/src/main/java/com/microsoft/azure/servicebus/primitives/SendWorkItem.java index 0df22c803931..3cc20481be5b 100644 --- a/servicebus/data-plane/azure-servicebus/src/main/java/com/microsoft/azure/servicebus/primitives/SendWorkItem.java +++ b/servicebus/data-plane/azure-servicebus/src/main/java/com/microsoft/azure/servicebus/primitives/SendWorkItem.java @@ -8,8 +8,7 @@ import java.time.Duration; import java.util.concurrent.CompletableFuture; -class SendWorkItem extends WorkItem -{ +class SendWorkItem extends WorkItem { private byte[] amqpMessage; private int messageFormat; private int encodedMessageSize; @@ -17,20 +16,17 @@ class SendWorkItem extends WorkItem private String deliveryTag; private TransactionContext transaction; - public SendWorkItem(byte[] amqpMessage, int encodedMessageSize, int messageFormat, String deliveryTag, TransactionContext transaction, CompletableFuture completableFuture, Duration timeout) - { + SendWorkItem(byte[] amqpMessage, int encodedMessageSize, int messageFormat, String deliveryTag, TransactionContext transaction, CompletableFuture completableFuture, Duration timeout) { super(completableFuture, timeout); this.initialize(amqpMessage, encodedMessageSize, messageFormat, deliveryTag, transaction); } - public SendWorkItem(byte[] amqpMessage, int encodedMessageSize, int messageFormat, String deliveryTag, TransactionContext transaction, CompletableFuture completableFuture, TimeoutTracker timeout) - { + SendWorkItem(byte[] amqpMessage, int encodedMessageSize, int messageFormat, String deliveryTag, TransactionContext transaction, CompletableFuture completableFuture, TimeoutTracker timeout) { super(completableFuture, timeout); this.initialize(amqpMessage, encodedMessageSize, messageFormat, deliveryTag, transaction); } - private void initialize(byte[] amqpMessage, int encodedMessageSize, int messageFormat, String deliveryTag, TransactionContext transaction) - { + private void initialize(byte[] amqpMessage, int encodedMessageSize, int messageFormat, String deliveryTag, TransactionContext transaction) { this.amqpMessage = amqpMessage; this.messageFormat = messageFormat; this.encodedMessageSize = encodedMessageSize; @@ -38,42 +34,39 @@ private void initialize(byte[] amqpMessage, int encodedMessageSize, int messageF this.transaction = transaction; } - public byte[] getMessage() - { + public byte[] getMessage() { return this.amqpMessage; } - public int getEncodedMessageSize() - { + public int getEncodedMessageSize() { return this.encodedMessageSize; } - public int getMessageFormat() - { + public int getMessageFormat() { return this.messageFormat; } - public void setWaitingForAck() - { + public void setWaitingForAck() { this.waitingForAck = true; } - public boolean isWaitingForAck() - { + public boolean isWaitingForAck() { return this.waitingForAck; } - public String getDeliveryTag() - { + public String getDeliveryTag() { return this.deliveryTag; } - public void setDeliveryTag(String deliveryTag) - { + public void setDeliveryTag(String deliveryTag) { this.deliveryTag = deliveryTag; } - public TransactionContext getTransaction() { return this.transaction; } + public TransactionContext getTransaction() { + return this.transaction; + } - public void setTransaction(TransactionContext txnId) { this.transaction = txnId; } + public void setTransaction(TransactionContext txnId) { + this.transaction = txnId; + } } diff --git a/servicebus/data-plane/azure-servicebus/src/main/java/com/microsoft/azure/servicebus/primitives/SenderErrorContext.java b/servicebus/data-plane/azure-servicebus/src/main/java/com/microsoft/azure/servicebus/primitives/SenderErrorContext.java index 766000fa07e5..6170c83f43d9 100644 --- a/servicebus/data-plane/azure-servicebus/src/main/java/com/microsoft/azure/servicebus/primitives/SenderErrorContext.java +++ b/servicebus/data-plane/azure-servicebus/src/main/java/com/microsoft/azure/servicebus/primitives/SenderErrorContext.java @@ -5,8 +5,7 @@ import java.util.Locale; -public class SenderErrorContext extends ErrorContext -{ +public class SenderErrorContext extends ErrorContext { private static final long serialVersionUID = -8426189357575601244L; final String sendPath; final String referenceId; @@ -16,8 +15,7 @@ public class SenderErrorContext extends ErrorContext final String namespaceName, final String sendPath, final String referenceId, - final Integer currentLinkCredit) - { + final Integer currentLinkCredit) { super(namespaceName); this.sendPath = sendPath; @@ -26,37 +24,31 @@ public class SenderErrorContext extends ErrorContext } @Override - public String toString() - { + public String toString() { final String superString = super.toString(); StringBuilder toString = new StringBuilder(); - if (!StringUtil.isNullOrEmpty(superString)) - { + if (!StringUtil.isNullOrEmpty(superString)) { toString.append(superString); toString.append(", "); } - if (this.sendPath != null) - { + if (this.sendPath != null) { toString.append(String.format(Locale.US, "PATH: %s", this.sendPath)); toString.append(", "); } - if (this.referenceId != null) - { + if (this.referenceId != null) { toString.append(String.format(Locale.US, "REFERENCE_ID: %s", this.referenceId)); toString.append(", "); } - if (this.currentLinkCredit != null) - { + if (this.currentLinkCredit != null) { toString.append(String.format(Locale.US, "LINK_CREDIT: %s", this.currentLinkCredit)); toString.append(", "); } - if (toString.length() > 2) - { + if (toString.length() > 2) { toString.setLength(toString.length() - 2); } diff --git a/servicebus/data-plane/azure-servicebus/src/main/java/com/microsoft/azure/servicebus/primitives/ServerBusyException.java b/servicebus/data-plane/azure-servicebus/src/main/java/com/microsoft/azure/servicebus/primitives/ServerBusyException.java index 953c54528c25..5d01a210c0e9 100644 --- a/servicebus/data-plane/azure-servicebus/src/main/java/com/microsoft/azure/servicebus/primitives/ServerBusyException.java +++ b/servicebus/data-plane/azure-servicebus/src/main/java/com/microsoft/azure/servicebus/primitives/ServerBusyException.java @@ -9,30 +9,25 @@ * @see http://go.microsoft.com/fwlink/?LinkId=761101 * @since 1.0 */ -public class ServerBusyException extends ServiceBusException -{ +public class ServerBusyException extends ServiceBusException { private static final long serialVersionUID = 1L; /** * Default constructor for the exception */ - public ServerBusyException() - { + public ServerBusyException() { super(true); } - public ServerBusyException(final String message) - { + public ServerBusyException(final String message) { super(true, message); } - ServerBusyException(final Throwable cause) - { + ServerBusyException(final Throwable cause) { super(true, cause); } - ServerBusyException(final String message, final Throwable cause) - { + ServerBusyException(final String message, final Throwable cause) { super(true, message, cause); } } diff --git a/servicebus/data-plane/azure-servicebus/src/main/java/com/microsoft/azure/servicebus/primitives/ServiceBusException.java b/servicebus/data-plane/azure-servicebus/src/main/java/com/microsoft/azure/servicebus/primitives/ServiceBusException.java index e14c0f79083e..a4280877aca7 100644 --- a/servicebus/data-plane/azure-servicebus/src/main/java/com/microsoft/azure/servicebus/primitives/ServiceBusException.java +++ b/servicebus/data-plane/azure-servicebus/src/main/java/com/microsoft/azure/servicebus/primitives/ServiceBusException.java @@ -20,27 +20,23 @@ public ServiceBusException(final boolean isTransient) { this.isTransient = isTransient; } - public ServiceBusException(final boolean isTransient, final String message) - { + public ServiceBusException(final boolean isTransient, final String message) { super(message); this.isTransient = isTransient; } - public ServiceBusException(final boolean isTransient, final Throwable cause) - { + public ServiceBusException(final boolean isTransient, final Throwable cause) { super(cause); this.isTransient = isTransient; } - public ServiceBusException(final boolean isTransient, final String message, final Throwable cause) - { + public ServiceBusException(final boolean isTransient, final String message, final Throwable cause) { super(message, cause); this.isTransient = isTransient; } @Override - public String getMessage() - { + public String getMessage() { final String baseMessage = super.getMessage(); return this.errorContext == null || StringUtil.isNullOrEmpty(this.errorContext.toString()) ? baseMessage @@ -53,18 +49,15 @@ public String getMessage() * A boolean indicating if the exception is a transient error or not. * @return returns true when user can retry the operation that generated the exception without additional intervention. */ - public boolean getIsTransient() - { + public boolean getIsTransient() { return this.isTransient; } - public ErrorContext getContext() - { + public ErrorContext getContext() { return this.errorContext; } - void setContext(ErrorContext errorContext) - { + void setContext(ErrorContext errorContext) { this.errorContext = errorContext; } }