1 /** 2 * Autogenerated by Thrift 3 * 4 * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING 5 * @generated 6 */ 7 8 package test.fixtures.basicannotations; 9 10 import static com.facebook.swift.service.SwiftConstants.STICKY_HASH_KEY; 11 12 import java.util.*; 13 import java.util.concurrent.ConcurrentHashMap; 14 import java.util.concurrent.atomic.AtomicLong; 15 import org.apache.thrift.protocol.*; 16 import org.apache.thrift.ClientPushMetadata; 17 import org.apache.thrift.InteractionCreate; 18 import org.apache.thrift.InteractionTerminate; 19 import com.facebook.thrift.client.ResponseWrapper; 20 import com.facebook.thrift.client.RpcOptions; 21 22 public class MyServicePrioChildReactiveClient extends test.fixtures.basicannotations.MyServicePrioParentReactiveClient 23 implements MyServicePrioChild.Reactive { 24 private static final AtomicLong _interactionCounter = new AtomicLong(0); 25 26 private final org.apache.thrift.ProtocolId _protocolId; 27 private final reactor.core.publisher.Mono<? extends com.facebook.thrift.client.RpcClient> _rpcClient; 28 private final Map<String, String> _headers; 29 private final Map<String, String> _persistentHeaders; 30 private final Set<Long> _activeInteractions; 31 32 private static final java.util.Map<Short, com.facebook.thrift.payload.Reader> _pang_EXCEPTION_READERS = java.util.Collections.emptyMap(); 33 34 static { 35 } 36 MyServicePrioChildReactiveClient(org.apache.thrift.ProtocolId _protocolId, reactor.core.publisher.Mono<? extends com.facebook.thrift.client.RpcClient> _rpcClient)37 public MyServicePrioChildReactiveClient(org.apache.thrift.ProtocolId _protocolId, reactor.core.publisher.Mono<? extends com.facebook.thrift.client.RpcClient> _rpcClient) { 38 super(_protocolId, _rpcClient); 39 this._protocolId = _protocolId; 40 this._rpcClient = _rpcClient; 41 this._headers = java.util.Collections.emptyMap(); 42 this._persistentHeaders = java.util.Collections.emptyMap(); 43 this._activeInteractions = ConcurrentHashMap.newKeySet(); 44 } 45 MyServicePrioChildReactiveClient(org.apache.thrift.ProtocolId _protocolId, reactor.core.publisher.Mono<? extends com.facebook.thrift.client.RpcClient> _rpcClient, Map<String, String> _headers, Map<String, String> _persistentHeaders)46 public MyServicePrioChildReactiveClient(org.apache.thrift.ProtocolId _protocolId, reactor.core.publisher.Mono<? extends com.facebook.thrift.client.RpcClient> _rpcClient, Map<String, String> _headers, Map<String, String> _persistentHeaders) { 47 this(_protocolId, _rpcClient, _headers, _persistentHeaders, new AtomicLong(), ConcurrentHashMap.newKeySet()); 48 } 49 MyServicePrioChildReactiveClient(org.apache.thrift.ProtocolId _protocolId, reactor.core.publisher.Mono<? extends com.facebook.thrift.client.RpcClient> _rpcClient, Map<String, String> _headers, Map<String, String> _persistentHeaders, AtomicLong interactionCounter, Set<Long> activeInteractions)50 public MyServicePrioChildReactiveClient(org.apache.thrift.ProtocolId _protocolId, reactor.core.publisher.Mono<? extends com.facebook.thrift.client.RpcClient> _rpcClient, Map<String, String> _headers, Map<String, String> _persistentHeaders, AtomicLong interactionCounter, Set<Long> activeInteractions) { 51 super(_protocolId, _rpcClient); 52 this._protocolId = _protocolId; 53 this._rpcClient = _rpcClient; 54 this._headers = _headers; 55 this._persistentHeaders = _persistentHeaders; 56 this._activeInteractions = activeInteractions; 57 } 58 59 @java.lang.Override dispose()60 public void dispose() {} 61 _createpangWriter()62 private com.facebook.thrift.payload.Writer _createpangWriter() { 63 return oprot -> { 64 try { 65 66 } catch (Throwable _e) { 67 throw reactor.core.Exceptions.propagate(_e); 68 } 69 }; 70 } 71 72 private static final com.facebook.thrift.payload.Reader _pang_READER = 73 oprot -> { 74 try { 75 76 return null; 77 78 } catch (Throwable _e) { 79 throw reactor.core.Exceptions.propagate(_e); 80 } 81 }; 82 83 84 @java.lang.Override 85 public reactor.core.publisher.Mono<com.facebook.thrift.client.ResponseWrapper<Void>> pangWrapper( final com.facebook.thrift.client.RpcOptions rpcOptions) { 86 return _rpcClient 87 .flatMap(_rpc -> { 88 org.apache.thrift.RequestRpcMetadata _metadata = new org.apache.thrift.RequestRpcMetadata.Builder() 89 .setName("pang") 90 .setKind(org.apache.thrift.RpcKind.SINGLE_REQUEST_SINGLE_RESPONSE) 91 .setOtherMetadata(getHeaders(rpcOptions)) 92 .setProtocol(_protocolId) 93 .build(); 94 95 com.facebook.thrift.payload.ClientRequestPayload<Void> _crp = 96 com.facebook.thrift.payload.ClientRequestPayload.create( 97 _createpangWriter(), 98 _pang_READER, 99 _pang_EXCEPTION_READERS, 100 _metadata, 101 java.util.Collections.emptyMap()); 102 103 return _rpc 104 .singleRequestSingleResponse(_crp, rpcOptions).doOnNext(_p -> {if(_p.getException() != null) throw reactor.core.Exceptions.propagate(_p.getException());}); 105 }); 106 } 107 108 @java.lang.Override 109 public reactor.core.publisher.Mono<Void> pang( final com.facebook.thrift.client.RpcOptions rpcOptions) { 110 return pangWrapper( rpcOptions).then(); 111 } 112 113 @java.lang.Override 114 public reactor.core.publisher.Mono<Void> pang() { 115 return pang( com.facebook.thrift.client.RpcOptions.EMPTY); 116 } 117 118 119 120 private Map<String, String> getHeaders(com.facebook.thrift.client.RpcOptions rpcOptions) { 121 Map<String, String> headers = new HashMap<>(); 122 if (rpcOptions.getRequestHeaders() != null && !rpcOptions.getRequestHeaders().isEmpty()) { 123 headers.putAll(rpcOptions.getRequestHeaders()); 124 } 125 if (_headers != null && !_headers.isEmpty()) { 126 headers.putAll(_headers); 127 } 128 if (_persistentHeaders != null && !_persistentHeaders.isEmpty()) { 129 headers.putAll(_persistentHeaders); 130 } 131 return headers; 132 } 133 } 134