Java Code Examples for com.alipay.remoting.rpc.RpcServer#start()
The following examples show how to use
com.alipay.remoting.rpc.RpcServer#start() .
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: BadServerIpTest.java From sofa-bolt with Apache License 2.0 | 6 votes |
public void startServer() { server = new RpcServer(ip, 1111); server.registerUserProcessor(new SyncUserProcessor<RequestBody>() { @Override public Object handleRequest(BizContext bizCtx, RequestBody request) throws Exception { logger.warn("Request received:" + request); return "hello world!"; } @Override public String interest() { return String.class.getName(); } @Override public Executor getExecutor() { return null; } }); server.start(); }
Example 2
Source File: RemotingUtilTest.java From sofa-bolt with Apache License 2.0 | 6 votes |
public void startServer() { server = new RpcServer(port); server.registerUserProcessor(new SyncUserProcessor<RequestBody>() { ThreadPoolExecutor executor = new ThreadPoolExecutor(1, 3, 60, TimeUnit.SECONDS, new ArrayBlockingQueue<Runnable>(4), new NamedThreadFactory("Request-process-pool")); @Override public Object handleRequest(BizContext bizCtx, RequestBody request) { logger.warn("Request received:" + request); return "Hello world!"; } @Override public String interest() { return RequestBody.class.toString(); } @Override public Executor getExecutor() { return executor; } }); server.start(); }
Example 3
Source File: MockServer.java From sofa-registry with Apache License 2.0 | 5 votes |
/** * Start. */ public void start() { rpcServer = new RpcServer(port); rpcServer.registerUserProcessor(new MockSubscriberRegisterProcessor()); rpcServer.registerUserProcessor(new MockPublisherRegisterProcessor()); rpcServer.registerUserProcessor(new MockConfiguratorRegisterProcesor()); rpcServer.start(ip); }
Example 4
Source File: BoltServer.java From sofa-registry with Apache License 2.0 | 5 votes |
/** * start bolt server */ public void startServer() { if (isStarted.compareAndSet(false, true)) { try { boltServer = new RpcServer(url.getPort(), true); initHandler(); boltServer.start(); } catch (Exception e) { isStarted.set(false); LOGGER.error("Start bolt server error!", e); throw new RuntimeException("Start bolt server error!", e); } } }
Example 5
Source File: RemotingServerTest.java From sofa-bolt with Apache License 2.0 | 5 votes |
@Test public void testStartRepeatedly() { RpcServer rpcServer = new RpcServer(1111); rpcServer.start(); try { rpcServer.start(); Assert.fail("Should not reach here!"); } catch (Exception e) { // expect IllegalStateException } rpcServer.stop(); }