@@ -43,6 +43,10 @@ public class FlowController {
4343 /** Base exception that signals a flow control state. */
4444 public abstract static class FlowControlException extends Exception {
4545 private FlowControlException () {}
46+
47+ protected FlowControlException (String message ) {
48+ super (message );
49+ }
4650 }
4751
4852 /**
@@ -68,23 +72,16 @@ public static final class MaxOutstandingElementCountReachedException
6872 private final long currentMaxElementCount ;
6973
7074 public MaxOutstandingElementCountReachedException (long currentMaxElementCount ) {
75+ super (
76+ String .format (
77+ "The maximum number of batch elements: %d have been reached." ,
78+ currentMaxElementCount ));
7179 this .currentMaxElementCount = currentMaxElementCount ;
7280 }
7381
7482 public long getCurrentMaxBatchElementCount () {
7583 return currentMaxElementCount ;
7684 }
77-
78- @ Override
79- public String getMessage () {
80- return String .format (
81- "The maximum number of batch elements: %d have been reached." , currentMaxElementCount );
82- }
83-
84- @ Override
85- public String toString () {
86- return getMessage ();
87- }
8885 }
8986
9087 /**
@@ -96,23 +93,15 @@ public static final class MaxOutstandingRequestBytesReachedException
9693 private final long currentMaxBytes ;
9794
9895 public MaxOutstandingRequestBytesReachedException (long currentMaxBytes ) {
96+ super (
97+ String .format (
98+ "The maximum number of batch bytes: %d have been reached." , currentMaxBytes ));
9999 this .currentMaxBytes = currentMaxBytes ;
100100 }
101101
102102 public long getCurrentMaxBatchBytes () {
103103 return currentMaxBytes ;
104104 }
105-
106- @ Override
107- public String getMessage () {
108- return String .format (
109- "The maximum number of batch bytes: %d have been reached." , currentMaxBytes );
110- }
111-
112- @ Override
113- public String toString () {
114- return getMessage ();
115- }
116105 }
117106
118107 /**
0 commit comments