File tree Expand file tree Collapse file tree 2 files changed +25
-3
lines changed
src/main/java/com/uber/cadence Expand file tree Collapse file tree 2 files changed +25
-3
lines changed Original file line number Diff line number Diff line change 22
22
import com .uber .cadence .internal .metrics .MetricsType ;
23
23
import com .uber .m3 .tally .Scope ;
24
24
import java .util .Objects ;
25
- import java .util .concurrent .*;
25
+ import java .util .concurrent .ArrayBlockingQueue ;
26
+ import java .util .concurrent .CountDownLatch ;
27
+ import java .util .concurrent .Semaphore ;
28
+ import java .util .concurrent .ThreadPoolExecutor ;
29
+ import java .util .concurrent .TimeUnit ;
26
30
import java .util .concurrent .atomic .AtomicReference ;
27
31
import org .apache .thrift .TException ;
32
+ import org .apache .thrift .transport .TTransportException ;
28
33
import org .slf4j .Logger ;
29
34
import org .slf4j .LoggerFactory ;
30
35
@@ -52,7 +57,17 @@ interface ThrowingRunnable {
52
57
private Throttler pollRateThrottler ;
53
58
54
59
private Thread .UncaughtExceptionHandler uncaughtExceptionHandler =
55
- (t , e ) -> log .error ("Failure in thread " + t .getName (), e );
60
+ (t , e ) -> {
61
+ if (e instanceof TTransportException ) {
62
+ TTransportException te = (TTransportException ) e ;
63
+ if (te .getType () == TTransportException .TIMED_OUT ) {
64
+ log .warn ("Failure in thread " + t .getName (), e );
65
+ return ;
66
+ }
67
+ }
68
+
69
+ log .error ("Failure in thread " + t .getName (), e );
70
+ };
56
71
57
72
public Poller (
58
73
String identity ,
Original file line number Diff line number Diff line change 100
100
import com .uber .tchannel .api .TChannel ;
101
101
import com .uber .tchannel .api .TFuture ;
102
102
import com .uber .tchannel .api .errors .TChannelError ;
103
+ import com .uber .tchannel .errors .ErrorType ;
103
104
import com .uber .tchannel .messages .ThriftRequest ;
104
105
import com .uber .tchannel .messages .ThriftResponse ;
105
106
import java .net .InetAddress ;
113
114
import java .util .concurrent .ExecutionException ;
114
115
import org .apache .thrift .TException ;
115
116
import org .apache .thrift .async .AsyncMethodCallback ;
117
+ import org .apache .thrift .transport .TTransportException ;
116
118
import org .slf4j .Logger ;
117
119
import org .slf4j .LoggerFactory ;
118
120
@@ -540,7 +542,12 @@ private <T> CompletableFuture<ThriftResponse<T>> doRemoteCallAsync(ThriftRequest
540
542
541
543
private void throwOnRpcError (ThriftResponse <?> response ) throws TException {
542
544
if (response .isError ()) {
543
- throw new TException ("Rpc error:" + response .getError ());
545
+ if (response .getError ().getErrorType () == ErrorType .Timeout ) {
546
+ throw new TTransportException (
547
+ TTransportException .TIMED_OUT , response .getError ().getMessage ());
548
+ } else {
549
+ throw new TException ("Rpc error:" + response .getError ());
550
+ }
544
551
}
545
552
}
546
553
You can’t perform that action at this time.
0 commit comments