Skip to content
Open
Show file tree
Hide file tree
Changes from 2 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 @@ -43,6 +43,10 @@ public class FlowController {
/** Base exception that signals a flow control state. */
public abstract static class FlowControlException extends Exception {
private FlowControlException() {}

protected FlowControlException(String message) {
super(message);
}
Comment thread
NiranjanKumar001 marked this conversation as resolved.
Outdated
}

/**
Expand All @@ -68,18 +72,16 @@ public static final class MaxOutstandingElementCountReachedException
private final long currentMaxElementCount;

public MaxOutstandingElementCountReachedException(long currentMaxElementCount) {
super(
String.format(
"The maximum number of batch elements: %d have been reached.",
Comment thread
NiranjanKumar001 marked this conversation as resolved.
Outdated
currentMaxElementCount));
this.currentMaxElementCount = currentMaxElementCount;
}

public long getCurrentMaxBatchElementCount() {
return currentMaxElementCount;
}

@Override
public String toString() {
return String.format(
"The maximum number of batch elements: %d have been reached.", currentMaxElementCount);
}
}

/**
Expand All @@ -91,18 +93,15 @@ public static final class MaxOutstandingRequestBytesReachedException
private final long currentMaxBytes;

public MaxOutstandingRequestBytesReachedException(long currentMaxBytes) {
super(
String.format(
"The maximum number of batch bytes: %d have been reached.", currentMaxBytes));
Comment thread
NiranjanKumar001 marked this conversation as resolved.
Outdated
this.currentMaxBytes = currentMaxBytes;
}

public long getCurrentMaxBatchBytes() {
return currentMaxBytes;
}

@Override
public String toString() {
return String.format(
"The maximum number of batch bytes: %d have been reached.", currentMaxBytes);
}
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -774,4 +774,18 @@ private List<Future<?>> testConcurrentUpdates(
executors.shutdown();
return reserveReleaseFuture;
}

@Test
void testExceptionGetMessage() {
Comment thread
NiranjanKumar001 marked this conversation as resolved.
Outdated
FlowController.MaxOutstandingElementCountReachedException elementException =
new FlowController.MaxOutstandingElementCountReachedException(100);
assertThat(elementException.getMessage())
.isEqualTo("The maximum number of batch elements: 100 have been reached.");
Comment thread
NiranjanKumar001 marked this conversation as resolved.
Outdated

FlowController.MaxOutstandingRequestBytesReachedException bytesException =
new FlowController.MaxOutstandingRequestBytesReachedException(500);
assertThat(bytesException.getMessage())
.isEqualTo("The maximum number of batch bytes: 500 have been reached.");
Comment thread
NiranjanKumar001 marked this conversation as resolved.
Outdated
}
}

Loading