1616package com .google .cloud .bigtable .gaxx .retrying ;
1717
1818import com .google .api .core .InternalApi ;
19- import com .google .api .core .InternalExtensionOnly ;
2019import com .google .api .core .SettableApiFuture ;
2120import com .google .api .gax .retrying .RetryingFuture ;
2221import com .google .api .gax .retrying .ServerStreamingAttemptException ;
8685 * @param <ResponseT> response type
8786 */
8887@ InternalApi
89- @ InternalExtensionOnly
90- public class ServerStreamingAttemptCallable <RequestT , ResponseT > implements Callable <Void > {
91- protected final Object lock = new Object ();
88+ public final class ServerStreamingAttemptCallable <RequestT , ResponseT > implements Callable <Void > {
89+ private final Object lock = new Object ();
9290
93- protected final ServerStreamingCallable <RequestT , ResponseT > innerCallable ;
94- protected final StreamResumptionStrategy <RequestT , ResponseT > resumptionStrategy ;
95- protected final RequestT initialRequest ;
96- protected ApiCallContext context ;
97- protected final ResponseObserver <ResponseT > outerObserver ;
91+ private final ServerStreamingCallable <RequestT , ResponseT > innerCallable ;
92+ private final StreamResumptionStrategy <RequestT , ResponseT > resumptionStrategy ;
93+ private final RequestT initialRequest ;
94+ private ApiCallContext context ;
95+ private final ResponseObserver <ResponseT > outerObserver ;
9896
9997 // Start state
100- protected boolean autoFlowControl = true ;
101- protected boolean isStarted ;
98+ private boolean autoFlowControl = true ;
99+ private boolean isStarted ;
102100
103101 // Outer state
104- protected Throwable cancellationCause ;
102+ private Throwable cancellationCause ;
105103
106- protected int pendingRequests ;
104+ private int pendingRequests ;
107105
108- protected RetryingFuture <Void > outerRetryingFuture ;
106+ private RetryingFuture <Void > outerRetryingFuture ;
109107
110108 // Internal retry state
111- protected int numAttempts ;
109+ private int numAttempts ;
112110
113- protected StreamController innerController ;
111+ private StreamController innerController ;
114112
115- protected boolean seenSuccessSinceLastError ;
116- protected SettableApiFuture <Void > innerAttemptFuture ;
113+ private boolean seenSuccessSinceLastError ;
114+ private SettableApiFuture <Void > innerAttemptFuture ;
117115
118116 public ServerStreamingAttemptCallable (
119117 ServerStreamingCallable <RequestT , ResponseT > innerCallable ,
@@ -245,7 +243,7 @@ public void onCompleteImpl() {
245243 *
246244 * @see ResponseObserver#onStart(StreamController)
247245 */
248- protected void onAttemptStart (StreamController controller ) {
246+ private void onAttemptStart (StreamController controller ) {
249247 if (!autoFlowControl ) {
250248 controller .disableAutoInboundFlowControl ();
251249 }
@@ -275,7 +273,7 @@ protected void onAttemptStart(StreamController controller) {
275273 *
276274 * @see StreamController#cancel()
277275 */
278- protected void onCancel () {
276+ private void onCancel () {
279277 StreamController localInnerController ;
280278
281279 synchronized (lock ) {
@@ -302,7 +300,7 @@ protected void onCancel() {
302300 *
303301 * @see StreamController#request(int)
304302 */
305- protected void onRequest (int count ) {
303+ private void onRequest (int count ) {
306304 Preconditions .checkState (!autoFlowControl , "Automatic flow control is enabled" );
307305 Preconditions .checkArgument (count > 0 , "Count must be > 0" );
308306
@@ -325,7 +323,7 @@ protected void onRequest(int count) {
325323 }
326324
327325 /** Called when the inner callable has responses to deliver. */
328- protected void onAttemptResponse (ResponseT message ) {
326+ private void onAttemptResponse (ResponseT message ) {
329327 if (!autoFlowControl ) {
330328 synchronized (lock ) {
331329 pendingRequests --;
@@ -342,7 +340,7 @@ protected void onAttemptResponse(ResponseT message) {
342340 * Called when the current RPC fails. The error will be bubbled up to the outer {@link
343341 * RetryingFuture} via the {@link #innerAttemptFuture}.
344342 */
345- protected void onAttemptError (Throwable throwable ) {
343+ private void onAttemptError (Throwable throwable ) {
346344 Throwable localCancellationCause ;
347345 synchronized (lock ) {
348346 localCancellationCause = cancellationCause ;
@@ -366,7 +364,7 @@ protected void onAttemptError(Throwable throwable) {
366364 * Called when the current RPC successfully completes. Notifies the outer {@link RetryingFuture}
367365 * via {@link #innerAttemptFuture}.
368366 */
369- protected void onAttemptComplete () {
367+ private void onAttemptComplete () {
370368 innerAttemptFuture .set (null );
371369 }
372370}
0 commit comments