com.alipay.remoting.ConnectionEventType Java Examples
The following examples show how to use
com.alipay.remoting.ConnectionEventType.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ServerHeartBeatTest.java From sofa-bolt with Apache License 2.0 | 6 votes |
@Before public void init() { System.setProperty(Configs.TCP_IDLE, "1000"); System.setProperty(Configs.TCP_SERVER_IDLE, "100"); System.setProperty(Configs.TCP_IDLE_SWITCH, Boolean.toString(true)); server = new BoltServer(port); server.start(); server.addConnectionEventProcessor(ConnectionEventType.CONNECT, serverConnectProcessor); server.addConnectionEventProcessor(ConnectionEventType.CLOSE, serverDisConnectProcessor); server.registerUserProcessor(serverUserProcessor); client = new RpcClient(); client.addConnectionEventProcessor(ConnectionEventType.CONNECT, clientConnectProcessor); client.addConnectionEventProcessor(ConnectionEventType.CLOSE, clientDisConnectProcessor); client.registerUserProcessor(clientUserProcessor); client.init(); }
Example #2
Source File: RpcServerDemoByMain.java From sofa-bolt with Apache License 2.0 | 6 votes |
public RpcServerDemoByMain() { // 1. create a Rpc server with port assigned server = new BoltServer(port); // 2. add processor for connect and close event if you need server.addConnectionEventProcessor(ConnectionEventType.CONNECT, serverConnectProcessor); server.addConnectionEventProcessor(ConnectionEventType.CLOSE, serverDisConnectProcessor); // 3. register user processor for client request server.registerUserProcessor(serverUserProcessor); // 4. server start if (server.start()) { System.out.println("server start ok!"); } else { System.out.println("server start failed!"); } // server.getRpcServer().stop(); }
Example #3
Source File: BasicUsageTest.java From sofa-bolt with Apache License 2.0 | 6 votes |
@Before public void init() { ProtocolManager.unRegisterProtocol(RpcProtocolV2.PROTOCOL_CODE); server = new BoltServer(port, true); server.start(); server.addConnectionEventProcessor(ConnectionEventType.CONNECT, serverConnectProcessor); server.addConnectionEventProcessor(ConnectionEventType.CLOSE, serverDisConnectProcessor); server.registerUserProcessor(serverUserProcessor); client = new RpcClient(); client.addConnectionEventProcessor(ConnectionEventType.CONNECT, clientConnectProcessor); client.addConnectionEventProcessor(ConnectionEventType.CLOSE, clientDisConnectProcessor); client.registerUserProcessor(clientUserProcessor); client.init(); }
Example #4
Source File: ClientConnection.java From sofa-registry with Apache License 2.0 | 6 votes |
/** * Init. */ @Override public void init() { for (UserProcessor userProcessor : userProcessorList) { client.registerUserProcessor(userProcessor); } if (null != connectionEventProcessorMap) { for (Entry<ConnectionEventType, ConnectionEventProcessor> entry : connectionEventProcessorMap .entrySet()) { client.addConnectionEventProcessor(entry.getKey(), entry.getValue()); } } client.init(); }
Example #5
Source File: HeartBeatDisableTest.java From sofa-bolt with Apache License 2.0 | 6 votes |
@Before public void init() { System.setProperty(Configs.TCP_IDLE, "100"); System.setProperty(Configs.TCP_SERVER_IDLE, "50"); System.setProperty(Configs.TCP_IDLE_SWITCH, Boolean.toString(false)); server = new BoltServer(port); server.start(); server.addConnectionEventProcessor(ConnectionEventType.CONNECT, serverConnectProcessor); server.addConnectionEventProcessor(ConnectionEventType.CLOSE, serverDisConnectProcessor); server.registerUserProcessor(serverUserProcessor); client = new RpcClient(); client.addConnectionEventProcessor(ConnectionEventType.CONNECT, clientConnectProcessor); client.addConnectionEventProcessor(ConnectionEventType.CLOSE, clientDisConnectProcessor); client.registerUserProcessor(clientUserProcessor); client.init(); }
Example #6
Source File: RuntimeClientHeartBeatTest.java From sofa-bolt with Apache License 2.0 | 6 votes |
@Before public void init() { System.setProperty(Configs.TCP_IDLE, "100"); System.setProperty(Configs.TCP_IDLE_SWITCH, Boolean.toString(true)); System.setProperty(Configs.TCP_IDLE_MAXTIMES, "1000"); server = new BoltServer(port); server.start(); server.addConnectionEventProcessor(ConnectionEventType.CONNECT, serverConnectProcessor); server.addConnectionEventProcessor(ConnectionEventType.CLOSE, serverDisConnectProcessor); server.registerUserProcessor(serverUserProcessor); client = new RpcClient(); client.addConnectionEventProcessor(ConnectionEventType.CONNECT, clientConnectProcessor); client.addConnectionEventProcessor(ConnectionEventType.CLOSE, clientDisConnectProcessor); client.registerUserProcessor(clientUserProcessor); client.init(); }
Example #7
Source File: ClientHeartBeatTest.java From sofa-bolt with Apache License 2.0 | 6 votes |
@Before public void init() { System.setProperty(Configs.TCP_IDLE, "100"); System.setProperty(Configs.TCP_IDLE_SWITCH, Boolean.toString(true)); server = new BoltServer(port); server.start(); server.addConnectionEventProcessor(ConnectionEventType.CONNECT, serverConnectProcessor); server.addConnectionEventProcessor(ConnectionEventType.CLOSE, serverDisConnectProcessor); server.registerUserProcessor(serverUserProcessor); client = new RpcClient(); client.addConnectionEventProcessor(ConnectionEventType.CONNECT, clientConnectProcessor); client.addConnectionEventProcessor(ConnectionEventType.CLOSE, clientDisConnectProcessor); client.registerUserProcessor(clientUserProcessor); client.init(); }
Example #8
Source File: BasicUsage_ExecutorSelector_Test.java From sofa-bolt with Apache License 2.0 | 6 votes |
@Before public void init() { server = new BoltServer(port, true); server.start(); server.addConnectionEventProcessor(ConnectionEventType.CONNECT, serverConnectProcessor); server.addConnectionEventProcessor(ConnectionEventType.CLOSE, serverDisConnectProcessor); serverUserProcessor.setExecutorSelector(this.selector0); server.registerUserProcessor(serverUserProcessor); client = new RpcClient(); client.addConnectionEventProcessor(ConnectionEventType.CONNECT, clientConnectProcessor); client.addConnectionEventProcessor(ConnectionEventType.CLOSE, clientDisConnectProcessor); clientUserProcessor.setExecutorSelector(this.selector1); client.registerUserProcessor(clientUserProcessor); client.init(); }
Example #9
Source File: WaterMarkTest.java From sofa-bolt with Apache License 2.0 | 6 votes |
@Before public void init() { System.setProperty(Configs.NETTY_BUFFER_HIGH_WATERMARK, Integer.toString(128 * 1024)); System.setProperty(Configs.NETTY_BUFFER_LOW_WATERMARK, Integer.toString(32 * 1024)); server = new BoltServer(port, true); server.start(); server.addConnectionEventProcessor(ConnectionEventType.CONNECT, serverConnectProcessor); server.addConnectionEventProcessor(ConnectionEventType.CLOSE, serverDisConnectProcessor); server.registerUserProcessor(serverUserProcessor); client = new RpcClient(); client.addConnectionEventProcessor(ConnectionEventType.CONNECT, clientConnectProcessor); client.addConnectionEventProcessor(ConnectionEventType.CLOSE, clientDisConnectProcessor); client.registerUserProcessor(clientUserProcessor); client.init(); }
Example #10
Source File: WaterMark_UserProperty_ExceptionTest.java From sofa-bolt with Apache License 2.0 | 6 votes |
@Before public void init() { server = new BoltServer(port, true); server.getRpcServer().initWriteBufferWaterMark(1, 2); server.start(); server.addConnectionEventProcessor(ConnectionEventType.CONNECT, serverConnectProcessor); server.addConnectionEventProcessor(ConnectionEventType.CLOSE, serverDisConnectProcessor); server.registerUserProcessor(serverUserProcessor); client = new RpcClient(); client.addConnectionEventProcessor(ConnectionEventType.CONNECT, clientConnectProcessor); client.addConnectionEventProcessor(ConnectionEventType.CLOSE, clientDisConnectProcessor); client.registerUserProcessor(clientUserProcessor); client.initWriteBufferWaterMark(1, 2); client.init(); }
Example #11
Source File: WaterMark_SystemProperty_ExceptionTest.java From sofa-bolt with Apache License 2.0 | 6 votes |
@Before public void init() { System.setProperty(Configs.NETTY_BUFFER_HIGH_WATERMARK, Integer.toString(2)); System.setProperty(Configs.NETTY_BUFFER_LOW_WATERMARK, Integer.toString(1)); server = new BoltServer(port, true); server.start(); server.addConnectionEventProcessor(ConnectionEventType.CONNECT, serverConnectProcessor); server.addConnectionEventProcessor(ConnectionEventType.CLOSE, serverDisConnectProcessor); server.registerUserProcessor(serverUserProcessor); client = new RpcClient(); client.addConnectionEventProcessor(ConnectionEventType.CONNECT, clientConnectProcessor); client.addConnectionEventProcessor(ConnectionEventType.CLOSE, clientDisConnectProcessor); client.registerUserProcessor(clientUserProcessor); client.init(); }
Example #12
Source File: ServerTimeoutSwitchTest.java From sofa-bolt with Apache License 2.0 | 6 votes |
@Before public void init() { server = new BoltServer(port); server.start(); server.addConnectionEventProcessor(ConnectionEventType.CONNECT, serverConnectProcessor); server.addConnectionEventProcessor(ConnectionEventType.CLOSE, serverDisConnectProcessor); serverUserProcessor.setTimeoutDiscard(false); server.registerUserProcessor(serverUserProcessor); client = new RpcClient(); client.addConnectionEventProcessor(ConnectionEventType.CONNECT, clientConnectProcessor); client.addConnectionEventProcessor(ConnectionEventType.CLOSE, clientDisConnectProcessor); clientUserProcessor.setTimeoutDiscard(false); client.registerUserProcessor(clientUserProcessor); client.init(); }
Example #13
Source File: ScheduledDisconnectStrategyTest.java From sofa-bolt with Apache License 2.0 | 6 votes |
private void doInit(boolean enableSystem, boolean enableUser) { if (enableSystem) { System.setProperty(Configs.CONN_MONITOR_SWITCH, "true"); System.setProperty(Configs.CONN_RECONNECT_SWITCH, "true"); } else { System.setProperty(Configs.CONN_MONITOR_SWITCH, "false"); System.setProperty(Configs.CONN_RECONNECT_SWITCH, "false"); } server = new BoltServer(port, false, true); server.start(); server.addConnectionEventProcessor(ConnectionEventType.CONNECT, serverConnectProcessor); server.addConnectionEventProcessor(ConnectionEventType.CLOSE, serverDisConnectProcessor); server.registerUserProcessor(serverUserProcessor); client = new RpcClient(); if (enableUser) { client.enableReconnectSwitch(); client.enableConnectionMonitorSwitch(); } client.addConnectionEventProcessor(ConnectionEventType.CONNECT, clientConnectProcessor); client.addConnectionEventProcessor(ConnectionEventType.CLOSE, clientDisConnectProcessor); client.registerUserProcessor(clientUserProcessor); client.init(); }
Example #14
Source File: ReconnectManagerTest.java From sofa-bolt with Apache License 2.0 | 6 votes |
private void doInit(boolean enableSystem, boolean enableUser) { if (enableSystem) { System.setProperty(Configs.CONN_RECONNECT_SWITCH, "true"); } else { System.setProperty(Configs.CONN_RECONNECT_SWITCH, "false"); } server = new BoltServer(port); server.start(); server.addConnectionEventProcessor(ConnectionEventType.CONNECT, serverConnectProcessor); server.addConnectionEventProcessor(ConnectionEventType.CLOSE, serverDisConnectProcessor); server.registerUserProcessor(serverUserProcessor); client = new RpcClient(); if (enableUser) { client.enableReconnectSwitch(); } client.addConnectionEventProcessor(ConnectionEventType.CONNECT, clientConnectProcessor); client.addConnectionEventProcessor(ConnectionEventType.CLOSE, clientDisConnectProcessor); client.registerUserProcessor(clientUserProcessor); client.init(); }
Example #15
Source File: BasicUsage_ProcessInIoThread_Test.java From sofa-bolt with Apache License 2.0 | 5 votes |
@Before public void init() { server = new BoltServer(port, true); server.start(); server.addConnectionEventProcessor(ConnectionEventType.CONNECT, serverConnectProcessor); server.addConnectionEventProcessor(ConnectionEventType.CLOSE, serverDisConnectProcessor); server.registerUserProcessor(serverUserProcessor); client = new RpcClient(); client.addConnectionEventProcessor(ConnectionEventType.CONNECT, clientConnectProcessor); client.addConnectionEventProcessor(ConnectionEventType.CLOSE, clientDisConnectProcessor); client.registerUserProcessor(clientUserProcessor); client.init(); }
Example #16
Source File: ServerInvokeExceptionTest.java From sofa-bolt with Apache License 2.0 | 5 votes |
@Before public void init() { server = new BoltServer(port, true); server.start(); server.addConnectionEventProcessor(ConnectionEventType.CONNECT, serverConnectProcessor); server.addConnectionEventProcessor(ConnectionEventType.CLOSE, serverDisConnectProcessor); server.registerUserProcessor(serverUserProcessor); client = new RpcClient(); client.addConnectionEventProcessor(ConnectionEventType.CONNECT, clientConnectProcessor); client.addConnectionEventProcessor(ConnectionEventType.CLOSE, clientDisConnectProcessor); client.registerUserProcessor(clientUserProcessor); client.init(); }
Example #17
Source File: BasicUsage_ProtocolV2_1_Test.java From sofa-bolt with Apache License 2.0 | 5 votes |
@Before public void init() { server = new BoltServer(port, true); server.start(); server.addConnectionEventProcessor(ConnectionEventType.CONNECT, serverConnectProcessor); server.addConnectionEventProcessor(ConnectionEventType.CLOSE, serverDisConnectProcessor); server.registerUserProcessor(serverUserProcessor); client = new RpcClient(); client.addConnectionEventProcessor(ConnectionEventType.CONNECT, clientConnectProcessor); client.addConnectionEventProcessor(ConnectionEventType.CLOSE, clientDisConnectProcessor); client.registerUserProcessor(clientUserProcessor); client.init(); }
Example #18
Source File: ServerBasicUsageTest.java From sofa-bolt with Apache License 2.0 | 5 votes |
@Before public void init() { server = new BoltServer(port, true); server.start(); server.addConnectionEventProcessor(ConnectionEventType.CONNECT, serverConnectProcessor); server.addConnectionEventProcessor(ConnectionEventType.CLOSE, serverDisConnectProcessor); server.registerUserProcessor(serverUserProcessor); client = new RpcClient(); client.addConnectionEventProcessor(ConnectionEventType.CONNECT, clientConnectProcessor); client.addConnectionEventProcessor(ConnectionEventType.CLOSE, clientDisConnectProcessor); client.registerUserProcessor(clientUserProcessor); client.init(); }
Example #19
Source File: BasicUsage_MultiInterestUserProcessorTest.java From sofa-bolt with Apache License 2.0 | 5 votes |
@Before public void init() { server = new BoltServer(port, true); server.start(); server.addConnectionEventProcessor(ConnectionEventType.CONNECT, serverConnectProcessor); server.addConnectionEventProcessor(ConnectionEventType.CLOSE, serverDisConnectProcessor); server.registerUserProcessor(serverUserProcessor); client = new RpcClient(); client.addConnectionEventProcessor(ConnectionEventType.CONNECT, clientConnectProcessor); client.addConnectionEventProcessor(ConnectionEventType.CLOSE, clientDisConnectProcessor); client.registerUserProcessor(clientUserProcessor); client.init(); }
Example #20
Source File: CreateConnLockTest.java From sofa-bolt with Apache License 2.0 | 5 votes |
@Before public void init() { whetherConnectTimeoutConsumedTooLong.set(false); server = new BoltServer(port, true); server.start(); server.addConnectionEventProcessor(ConnectionEventType.CONNECT, serverConnectProcessor); server.addConnectionEventProcessor(ConnectionEventType.CLOSE, serverDisConnectProcessor); server.registerUserProcessor(serverUserProcessor); client = new RpcClient(); client.addConnectionEventProcessor(ConnectionEventType.CONNECT, clientConnectProcessor); client.addConnectionEventProcessor(ConnectionEventType.CLOSE, clientDisConnectProcessor); client.registerUserProcessor(clientUserProcessor); client.init(); }
Example #21
Source File: CodecTest.java From sofa-bolt with Apache License 2.0 | 5 votes |
@Before public void init() { server = new BoltServer(port); server.start(); server.addConnectionEventProcessor(ConnectionEventType.CONNECT, serverConnectProcessor); server.addConnectionEventProcessor(ConnectionEventType.CLOSE, serverDisConnectProcessor); server.registerUserProcessor(serverUserProcessor); client = new RpcClient(); client.addConnectionEventProcessor(ConnectionEventType.CONNECT, clientConnectProcessor); client.addConnectionEventProcessor(ConnectionEventType.CLOSE, clientDisConnectProcessor); client.registerUserProcessor(clientUserProcessor); client.init(); }
Example #22
Source File: ConcurrentCreateConnectionTest.java From sofa-bolt with Apache License 2.0 | 5 votes |
@Before public void init() { cm = new DefaultClientConnectionManager(connectionSelectStrategy, connectionFactory, connectionEventHandler, connectionEventListener); cm.setAddressParser(addressParser); cm.startup(); server = new BoltServer(port); server.start(); server.addConnectionEventProcessor(ConnectionEventType.CONNECT, serverConnectProcessor); }
Example #23
Source File: CustomSerializerCodecTest.java From sofa-bolt with Apache License 2.0 | 5 votes |
@Before public void init() { server = new BoltServer(port, true); server.start(); server.addConnectionEventProcessor(ConnectionEventType.CONNECT, serverConnectProcessor); server.addConnectionEventProcessor(ConnectionEventType.CLOSE, serverDisConnectProcessor); server.registerUserProcessor(serverUserProcessor); client = new RpcClient(); client.addConnectionEventProcessor(ConnectionEventType.CONNECT, clientConnectProcessor); client.addConnectionEventProcessor(ConnectionEventType.CLOSE, clientDisConnectProcessor); client.registerUserProcessor(clientUserProcessor); client.init(); }
Example #24
Source File: ClassCustomSerializerTest.java From sofa-bolt with Apache License 2.0 | 5 votes |
@Before public void init() { server = new BoltServer(port); server.start(); server.addConnectionEventProcessor(ConnectionEventType.CONNECT, serverConnectProcessor); server.addConnectionEventProcessor(ConnectionEventType.CLOSE, serverDisConnectProcessor); server.registerUserProcessor(serverUserProcessor); client = new RpcClient(); client.addConnectionEventProcessor(ConnectionEventType.CONNECT, clientConnectProcessor); client.addConnectionEventProcessor(ConnectionEventType.CLOSE, clientDisConnectProcessor); client.registerUserProcessor(clientUserProcessor); client.init(); }
Example #25
Source File: InvokeCallbackTest.java From sofa-bolt with Apache License 2.0 | 5 votes |
@Before public void init() { server = new BoltServer(port, true); server.start(); server.addConnectionEventProcessor(ConnectionEventType.CONNECT, serverConnectProcessor); server.addConnectionEventProcessor(ConnectionEventType.CLOSE, serverDisConnectProcessor); server.registerUserProcessor(serverUserProcessor); client = new RpcClient(); client.addConnectionEventProcessor(ConnectionEventType.CONNECT, clientConnectProcessor); client.addConnectionEventProcessor(ConnectionEventType.CLOSE, clientDisConnectProcessor); client.registerUserProcessor(clientUserProcessor); client.init(); }
Example #26
Source File: BasicUsage_InvokeContext_resuable_Test.java From sofa-bolt with Apache License 2.0 | 5 votes |
@Before public void init() { server = new BoltServer(port, true); server.start(); server.addConnectionEventProcessor(ConnectionEventType.CONNECT, serverConnectProcessor); server.addConnectionEventProcessor(ConnectionEventType.CLOSE, serverDisConnectProcessor); server.registerUserProcessor(serverUserProcessor); client = new RpcClient(); client.addConnectionEventProcessor(ConnectionEventType.CONNECT, clientConnectProcessor); client.addConnectionEventProcessor(ConnectionEventType.CLOSE, clientDisConnectProcessor); client.registerUserProcessor(clientUserProcessor); client.init(); }
Example #27
Source File: BasicUsage_InvokeContext_Url_Test.java From sofa-bolt with Apache License 2.0 | 5 votes |
@Before public void init() { server = new BoltServer(port, true); server.start(); server.addConnectionEventProcessor(ConnectionEventType.CONNECT, serverConnectProcessor); server.addConnectionEventProcessor(ConnectionEventType.CLOSE, serverDisConnectProcessor); server.registerUserProcessor(serverUserProcessor); client = new RpcClient(); client.addConnectionEventProcessor(ConnectionEventType.CONNECT, clientConnectProcessor); client.addConnectionEventProcessor(ConnectionEventType.CLOSE, clientDisConnectProcessor); client.registerUserProcessor(clientUserProcessor); client.init(); }
Example #28
Source File: BasicUsage_InvokeContext_Test.java From sofa-bolt with Apache License 2.0 | 5 votes |
@Before public void init() { server = new BoltServer(port, true); server.start(); server.addConnectionEventProcessor(ConnectionEventType.CONNECT, serverConnectProcessor); server.addConnectionEventProcessor(ConnectionEventType.CLOSE, serverDisConnectProcessor); server.registerUserProcessor(serverUserProcessor); client = new RpcClient(); client.addConnectionEventProcessor(ConnectionEventType.CONNECT, clientConnectProcessor); client.addConnectionEventProcessor(ConnectionEventType.CLOSE, clientDisConnectProcessor); client.registerUserProcessor(clientUserProcessor); client.init(); }
Example #29
Source File: RpcConnectionManagerTest.java From sofa-bolt with Apache License 2.0 | 5 votes |
@Before public void init() { cm = new DefaultClientConnectionManager(connectionSelectStrategy, connectionFactory, connectionEventHandler, connectionEventListener); cm.setAddressParser(addressParser); cm.startup(); server = new BoltServer(port); server.start(); server.addConnectionEventProcessor(ConnectionEventType.CONNECT, serverConnectProcessor); this.addressParser.initUrlArgs(url); }
Example #30
Source File: BasicUsageTest.java From sofa-bolt with Apache License 2.0 | 5 votes |
@Before public void init() { server = new BoltServer(port, true); server.start(); server.addConnectionEventProcessor(ConnectionEventType.CONNECT, serverConnectProcessor); server.addConnectionEventProcessor(ConnectionEventType.CLOSE, serverDisConnectProcessor); server.registerUserProcessor(serverUserProcessor); client = new RpcClient(); client.addConnectionEventProcessor(ConnectionEventType.CONNECT, clientConnectProcessor); client.addConnectionEventProcessor(ConnectionEventType.CLOSE, clientDisConnectProcessor); client.registerUserProcessor(clientUserProcessor); client.init(); }