@Test public void testGetInstance() throws Exception { String applicationId = "app 1"; String transactionServiceGroup = "group A"; TmRpcClient tmRpcClient = TmRpcClient.getInstance(applicationId, transactionServiceGroup); Field nettyClientKeyPoolField = getDeclaredField(tmRpcClient.getClientChannelManager(), "nettyClientKeyPool"); nettyClientKeyPoolField.setAccessible(true); GenericKeyedObjectPool nettyClientKeyPool = (GenericKeyedObjectPool) nettyClientKeyPoolField.get(tmRpcClient.getClientChannelManager()); NettyClientConfig defaultNettyClientConfig = new NettyClientConfig(); Assertions.assertEquals(defaultNettyClientConfig.getMaxPoolActive(), nettyClientKeyPool.getMaxActive()); Assertions.assertEquals(defaultNettyClientConfig.getMinPoolIdle(), nettyClientKeyPool.getMinIdle()); Assertions.assertEquals(defaultNettyClientConfig.getMaxAcquireConnMills(), nettyClientKeyPool.getMaxWait()); Assertions.assertEquals(defaultNettyClientConfig.isPoolTestBorrow(), nettyClientKeyPool.getTestOnBorrow()); Assertions.assertEquals(defaultNettyClientConfig.isPoolTestReturn(), nettyClientKeyPool.getTestOnReturn()); Assertions.assertEquals(defaultNettyClientConfig.isPoolLifo(), nettyClientKeyPool.getLifo()); }
public static TmRpcClient getInstance(String applicationId, String transactionServiceGroup) { TmRpcClient tmRpcClient = getInstance(); tmRpcClient.setApplicationId(applicationId); tmRpcClient.setTransactionServiceGroup(transactionServiceGroup); return tmRpcClient; }
TmRpcClient extends AbstractRpcRemotingClient { public static TmRpcClient getInstance(String applicationId, String transactionServiceGroup) { TmRpcClient tmRpcClient = getInstance(); tmRpcClient.setApplicationId(applicationId); tmRpcClient.setTransactionServiceGroup(transactionServiceGroup); return tmRpcClient; } }
TmRpcClient extends AbstractRpcRemotingClient { public static TmRpcClient getInstance(String applicationId, String transactionServiceGroup) { TmRpcClient tmRpcClient = getInstance(); tmRpcClient.setApplicationId(applicationId); tmRpcClient.setTransactionServiceGroup(transactionServiceGroup); return tmRpcClient; } private  TmRpcClient(NettyClientConfig nettyClientConfig,
                        EventExecutorGroup eventExecutorGroup,
                        ThreadPoolExecutor messageExecutor); }
TmRpcClient extends AbstractRpcRemotingClient { public static TmRpcClient getInstance(String applicationId, String transactionServiceGroup) { TmRpcClient tmRpcClient = getInstance(); tmRpcClient.setApplicationId(applicationId); tmRpcClient.setTransactionServiceGroup(transactionServiceGroup); return tmRpcClient; } private  TmRpcClient(NettyClientConfig nettyClientConfig,
                        EventExecutorGroup eventExecutorGroup,
                        ThreadPoolExecutor messageExecutor); static TmRpcClient getInstance(String applicationId, String transactionServiceGroup); static TmRpcClient getInstance(); void setApplicationId(String applicationId); void setTransactionServiceGroup(String transactionServiceGroup); @Override void init(); @Override void destroy(); @Override String getTransactionServiceGroup(); @Override void onRegisterMsgSuccess(String serverAddress, Channel channel, Object response,
                                     AbstractMessage requestMessage); @Override void onRegisterMsgFail(String serverAddress, Channel channel, Object response,
                                  AbstractMessage requestMessage); }
TmRpcClient extends AbstractRpcRemotingClient { public static TmRpcClient getInstance(String applicationId, String transactionServiceGroup) { TmRpcClient tmRpcClient = getInstance(); tmRpcClient.setApplicationId(applicationId); tmRpcClient.setTransactionServiceGroup(transactionServiceGroup); return tmRpcClient; } private  TmRpcClient(NettyClientConfig nettyClientConfig,
                        EventExecutorGroup eventExecutorGroup,
                        ThreadPoolExecutor messageExecutor); static TmRpcClient getInstance(String applicationId, String transactionServiceGroup); static TmRpcClient getInstance(); void setApplicationId(String applicationId); void setTransactionServiceGroup(String transactionServiceGroup); @Override void init(); @Override void destroy(); @Override String getTransactionServiceGroup(); @Override void onRegisterMsgSuccess(String serverAddress, Channel channel, Object response,
                                     AbstractMessage requestMessage); @Override void onRegisterMsgFail(String serverAddress, Channel channel, Object response,
                                  AbstractMessage requestMessage); static boolean enableDegrade; }