com.alibaba.dubbo.remoting.Server Java Examples
The following examples show how to use
com.alibaba.dubbo.remoting.Server.
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: GrizzlyTransporterTest.java From dubbo-2.6.5 with Apache License 2.0 | 5 votes |
@Test public void shouldAbleToBindGrizzly() throws Exception { int port = NetUtils.getAvailablePort(); URL url = new URL("http", "localhost", port, new String[]{Constants.BIND_PORT_KEY, String.valueOf(port)}); Server server = new GrizzlyTransporter().bind(url, new ChannelHandlerAdapter()); assertThat(server.isBound(), is(true)); }
Example #2
Source File: NettyTransporterTest.java From dubbo-2.6.5 with Apache License 2.0 | 5 votes |
@Test public void shouldAbleToBindNetty4() throws Exception { int port = NetUtils.getAvailablePort(); URL url = new URL("http", "localhost", port, new String[]{Constants.BIND_PORT_KEY, String.valueOf(port)}); Server server = new NettyTransporter().bind(url, new ChannelHandlerAdapter()); assertThat(server.isBound(), is(true)); }
Example #3
Source File: HeaderExchangeServer.java From dubbox-hystrix with Apache License 2.0 | 5 votes |
public HeaderExchangeServer(Server server) { if (server == null) { throw new IllegalArgumentException("server == null"); } this.server = server; this.heartbeat = server.getUrl().getParameter(Constants.HEARTBEAT_KEY, 0); this.heartbeatTimeout = server.getUrl().getParameter(Constants.HEARTBEAT_TIMEOUT_KEY, heartbeat * 3); if (heartbeatTimeout < heartbeat * 2) { throw new IllegalStateException("heartbeatTimeout < heartbeatInterval * 2"); } startHeatbeatTimer(); }
Example #4
Source File: NettyClientTest.java From dubbo-remoting-netty4 with Apache License 2.0 | 5 votes |
@Test public void testServerClose() throws Exception { for (int i = 0; i < 100; i++) { Server aServer = Exchangers.bind(URL.valueOf("exchange://localhost:" + (5000 + i) + "?transporter=netty4"), new TelnetServerHandler()); aServer.close(); } }
Example #5
Source File: AbstractGroup.java From dubbox with Apache License 2.0 | 5 votes |
public Peer join(URL url, ChannelHandler handler) throws RemotingException { Server server = servers.get(url); if (server == null) { // TODO 有并发间隙 server = Transporters.bind(url, handler); servers.put(url, server); dispatcher.addChannelHandler(handler); } return new ServerPeer(server, clients, this); }
Example #6
Source File: AbstractExchangeGroup.java From dubbo-2.6.5 with Apache License 2.0 | 5 votes |
@Override public void leave(URL url) throws RemotingException { Server server = servers.remove(url); if (server != null) { server.close(); } }
Example #7
Source File: NettyClientTest.java From dubbox with Apache License 2.0 | 5 votes |
@Test public void testServerClose() throws Exception { for (int i = 0; i < 100; i++) { Server aServer = Exchangers.bind(URL.valueOf("exchange://localhost:" + (5000 + i) + "?client=netty"), new TelnetServerHandler()); aServer.close(); } }
Example #8
Source File: AbstractGroup.java From dubbo-2.6.5 with Apache License 2.0 | 5 votes |
@Override public Peer join(URL url, ChannelHandler handler) throws RemotingException { Server server = servers.get(url); if (server == null) { // TODO exist concurrent gap server = Transporters.bind(url, handler); servers.put(url, server); dispatcher.addChannelHandler(handler); } return new ServerPeer(server, clients, this); }
Example #9
Source File: AbstractGroup.java From dubbo-2.6.5 with Apache License 2.0 | 5 votes |
@Override public void leave(URL url) throws RemotingException { Server server = servers.remove(url); if (server != null) { server.close(); } }
Example #10
Source File: HeaderExchangeServer.java From dubbo-2.6.5 with Apache License 2.0 | 5 votes |
public HeaderExchangeServer(Server server) { if (server == null) { throw new IllegalArgumentException("server == null"); } this.server = server; // 心跳监测时间默认值是0 this.heartbeat = server.getUrl().getParameter(Constants.HEARTBEAT_KEY, 0); // 心跳监测超时时间默认值是0 this.heartbeatTimeout = server.getUrl().getParameter(Constants.HEARTBEAT_TIMEOUT_KEY, heartbeat * 3); if (heartbeatTimeout < heartbeat * 2) { throw new IllegalStateException("heartbeatTimeout < heartbeatInterval * 2"); } // 设置心跳监测定时任务=》 startHeartbeatTimer(); }
Example #11
Source File: AbstractGroup.java From dubbox-hystrix with Apache License 2.0 | 5 votes |
public Peer join(URL url, ChannelHandler handler) throws RemotingException { Server server = servers.get(url); if (server == null) { // TODO 有并发间隙 server = Transporters.bind(url, handler); servers.put(url, server); dispatcher.addChannelHandler(handler); } return new ServerPeer(server, clients, this); }
Example #12
Source File: NettyClientTest.java From dubbo-remoting-netty4 with Apache License 2.0 | 5 votes |
@Test public void testServerClose() throws Exception { for (int i = 0; i < 100; i++) { Server aServer = Exchangers.bind(URL.valueOf("exchange://localhost:" + (5000 + i) + "?transporter=netty4"), new TelnetServerHandler()); aServer.close(); } }
Example #13
Source File: HeaderExchangeServer.java From dubbo3 with Apache License 2.0 | 5 votes |
public HeaderExchangeServer(Server server) { if (server == null) { throw new IllegalArgumentException("server == null"); } this.server = server; this.heartbeat = server.getUrl().getParameter(Constants.HEARTBEAT_KEY, 0); this.heartbeatTimeout = server.getUrl().getParameter(Constants.HEARTBEAT_TIMEOUT_KEY, heartbeat * 3); if (heartbeatTimeout < heartbeat * 2) { throw new IllegalStateException("heartbeatTimeout < heartbeatInterval * 2"); } startHeatbeatTimer(); }
Example #14
Source File: HeaderExchangeServer.java From dubbox with Apache License 2.0 | 5 votes |
public HeaderExchangeServer(Server server) { if (server == null) { throw new IllegalArgumentException("server == null"); } this.server = server; this.heartbeat = server.getUrl().getParameter(Constants.HEARTBEAT_KEY, 0); this.heartbeatTimeout = server.getUrl().getParameter(Constants.HEARTBEAT_TIMEOUT_KEY, heartbeat * 3); if (heartbeatTimeout < heartbeat * 2) { throw new IllegalStateException("heartbeatTimeout < heartbeatInterval * 2"); } startHeatbeatTimer(); }
Example #15
Source File: NettyClientTest.java From dubbox with Apache License 2.0 | 5 votes |
@Test public void testServerClose() throws Exception { for (int i = 0; i < 100; i++) { Server aServer = Exchangers.bind(URL.valueOf("exchange://localhost:" + (5000 + i) + "?transporter=netty4"), new TelnetServerHandler()); aServer.close(); } }
Example #16
Source File: AbstractGroup.java From dubbox with Apache License 2.0 | 5 votes |
public Peer join(URL url, ChannelHandler handler) throws RemotingException { Server server = servers.get(url); if (server == null) { // TODO 有并发间隙 server = Transporters.bind(url, handler); servers.put(url, server); dispatcher.addChannelHandler(handler); } return new ServerPeer(server, clients, this); }
Example #17
Source File: NettyClientTest.java From dubbox with Apache License 2.0 | 5 votes |
@Test public void testServerClose() throws Exception { for (int i = 0; i < 100; i++) { Server aServer = Exchangers.bind(URL.valueOf("exchange://localhost:" + (5000 + i) + "?client=netty"), new TelnetServerHandler()); aServer.close(); } }
Example #18
Source File: AbstractGroup.java From dubbox with Apache License 2.0 | 5 votes |
public Peer join(URL url, ChannelHandler handler) throws RemotingException { Server server = servers.get(url); if (server == null) { // TODO 有并发间隙 server = Transporters.bind(url, handler); servers.put(url, server); dispatcher.addChannelHandler(handler); } return new ServerPeer(server, clients, this); }
Example #19
Source File: NettyClientTest.java From dubbox with Apache License 2.0 | 5 votes |
@Test public void testServerClose() throws Exception { for (int i = 0; i < 100; i++) { Server aServer = Exchangers.bind(URL.valueOf("exchange://localhost:" + (5000 + i) + "?client=netty"), new TelnetServerHandler()); aServer.close(); } }
Example #20
Source File: HeaderExchangeServer.java From dubbox with Apache License 2.0 | 5 votes |
public HeaderExchangeServer(Server server) { if (server == null) { throw new IllegalArgumentException("server == null"); } this.server = server; this.heartbeat = server.getUrl().getParameter(Constants.HEARTBEAT_KEY, 0); this.heartbeatTimeout = server.getUrl().getParameter(Constants.HEARTBEAT_TIMEOUT_KEY, heartbeat * 3); if (heartbeatTimeout < heartbeat * 2) { throw new IllegalStateException("heartbeatTimeout < heartbeatInterval * 2"); } startHeatbeatTimer(); }
Example #21
Source File: ServerDelegate.java From dubbox-hystrix with Apache License 2.0 | 4 votes |
public void setServer(Server server) { this.server = server; }
Example #22
Source File: NettyTransporter.java From dubbo-remoting-netty4 with Apache License 2.0 | 4 votes |
public Server bind(URL url, ChannelHandler listener) throws RemotingException { return new NettyServer(url, listener); }
Example #23
Source File: NettyTransporter.java From dubbo3 with Apache License 2.0 | 4 votes |
public Server bind(URL url, ChannelHandler listener) throws RemotingException { return new NettyServer(url, listener); }
Example #24
Source File: MinaTransporter.java From dubbox-hystrix with Apache License 2.0 | 4 votes |
public Server bind(URL url, ChannelHandler handler) throws RemotingException { return new MinaServer(url, handler); }
Example #25
Source File: HeaderExchangeServer.java From dubbo3 with Apache License 2.0 | 4 votes |
public Server getServer() { return server; }
Example #26
Source File: ServerDelegate.java From dubbo3 with Apache License 2.0 | 4 votes |
public void setServer(Server server) { this.server = server; }
Example #27
Source File: GrizzlyTransporter.java From dubbox with Apache License 2.0 | 4 votes |
public Server bind(URL url, ChannelHandler listener) throws RemotingException { return new GrizzlyServer(url, listener); }
Example #28
Source File: AbstractGroup.java From dubbox with Apache License 2.0 | 4 votes |
public void leave(URL url) throws RemotingException { Server server = servers.remove(url); if (server != null) { server.close(); } }
Example #29
Source File: ServerDelegate.java From dubbox-hystrix with Apache License 2.0 | 4 votes |
public Server getServer() { return server; }
Example #30
Source File: NettyTransporter.java From dubbox with Apache License 2.0 | 4 votes |
public Server bind(URL url, ChannelHandler listener) throws RemotingException { return new NettyServer(url, listener); }