Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,15 @@
import java.util.Collection;
import java.util.concurrent.CompletableFuture;

class ReceiveWorkItem extends WorkItem<Collection<MessageWithDeliveryTag>>
{
class ReceiveWorkItem extends WorkItem<Collection<MessageWithDeliveryTag>> {
private final int maxMessageCount;

public ReceiveWorkItem(CompletableFuture<Collection<MessageWithDeliveryTag>> completableFuture, Duration timeout, final int maxMessageCount)
{
ReceiveWorkItem(CompletableFuture<Collection<MessageWithDeliveryTag>> completableFuture, Duration timeout, final int maxMessageCount) {
super(completableFuture, timeout);
this.maxMessageCount = maxMessageCount;
}

public int getMaxMessageCount()
{
public int getMaxMessageCount() {
return this.maxMessageCount;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,27 +15,22 @@
* @see <a href="http://go.microsoft.com/fwlink/?LinkId=761101">http://go.microsoft.com/fwlink/?LinkId=761101</a>
* @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);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -110,8 +114,7 @@ public static CompletableFuture<RequestResponseLink> createAsync(
try {
messagingFactory.scheduleOnReactorThread(new DispatchHandler() {
@Override
public void onEvent()
{
public void onEvent() {
requestReponseLink.createInternalLinks();
}
});
Expand Down Expand Up @@ -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;
}

Expand Down Expand Up @@ -185,7 +187,7 @@ private CompletableFuture<Void> sendTokenAndSetRenewTimer(boolean retryOnFailure
return CompletableFuture.completedFuture(null);
} else {
CompletableFuture<ScheduledFuture<?>> sendTokenFuture = this.underlyingFactory.sendSecurityTokenAndSetRenewTimer(this.sasTokenAudienceURI, retryOnFailure, () -> this.sendTokenAndSetRenewTimer(true));
CompletableFuture<Void> sasTokenFuture = sendTokenFuture.thenAccept((f) -> {this.sasTokenRenewTimerFuture = f;});
CompletableFuture<Void> sasTokenFuture = sendTokenFuture.thenAccept((f) -> this.sasTokenRenewTimerFuture = f);

if (additionalAudienceURI != null) {
CompletableFuture<Void> transferSendTokenFuture = this.underlyingFactory.sendSecurityToken(this.additionalAudienceURI);
Expand Down Expand Up @@ -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();
Expand All @@ -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);
Expand Down Expand Up @@ -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<>();
}
Expand Down Expand Up @@ -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<Void>();
this.closeFuture = new CompletableFuture<Void>();
this.openFuture = new CompletableFuture<>();
this.closeFuture = new CompletableFuture<>();

if (senderToBeCopied == null) {
this.pendingFreshSends = new LinkedList<>();
Expand Down Expand Up @@ -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 {
Expand Down
Loading