本文整理汇总了Java中com.alibaba.dubbo.remoting.Server类的典型用法代码示例。如果您正苦于以下问题:Java Server类的具体用法?Java Server怎么用?Java Server使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Server类属于com.alibaba.dubbo.remoting包,在下文中一共展示了Server类的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testServerClose
import com.alibaba.dubbo.remoting.Server; //导入依赖的package包/类
@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();
}
}
示例2: join
import com.alibaba.dubbo.remoting.Server; //导入依赖的package包/类
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);
}
示例3: HeaderExchangeServer
import com.alibaba.dubbo.remoting.Server; //导入依赖的package包/类
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();
}
示例4: HeaderExchangeServer
import com.alibaba.dubbo.remoting.Server; //导入依赖的package包/类
public HeaderExchangeServer(Server server) {
if (server == null) {
throw new IllegalArgumentException("server == null");
}
this.server = server;
this.heartbeat = server.getUrl().getParameter(Constants.HEARTBEAT_KEY, 0);
//默认的心跳超时时间为3倍的心跳时间
this.heartbeatTimeout = server.getUrl().getParameter(Constants.HEARTBEAT_TIMEOUT_KEY, heartbeat * 3);
if (heartbeatTimeout < heartbeat * 2) {
throw new IllegalStateException("heartbeatTimeout < heartbeatInterval * 2");
}
//开启心跳
startHeatbeatTimer();
}
示例5: HeaderExchangeServer
import com.alibaba.dubbo.remoting.Server; //导入依赖的package包/类
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();
}
示例6: HeaderExchangeServer
import com.alibaba.dubbo.remoting.Server; //导入依赖的package包/类
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();
}
示例7: bind
import com.alibaba.dubbo.remoting.Server; //导入依赖的package包/类
public Server bind(URL url, ChannelHandler listener) throws RemotingException {
return new GrizzlyServer(url, listener);
}
示例8: bind
import com.alibaba.dubbo.remoting.Server; //导入依赖的package包/类
public Server bind(URL url, ChannelHandler listener) throws RemotingException {
return new NettyServer(url, listener);
}
示例9: startServer
import com.alibaba.dubbo.remoting.Server; //导入依赖的package包/类
public Server startServer(int port) throws RemotingException{
final String url = "exchange://127.0.0.1:"+port +"/client.reconnect.test";
return Exchangers.bind(url, new HandlerAdapter());
}
示例10: leave
import com.alibaba.dubbo.remoting.Server; //导入依赖的package包/类
public void leave(URL url) throws RemotingException {
Server server = servers.remove(url);
if (server != null) {
server.close();
}
}
示例11: ServerPeer
import com.alibaba.dubbo.remoting.Server; //导入依赖的package包/类
public ServerPeer(Server server, Map<URL, Client> clients, Group group){
super(server);
this.clients = clients;
this.group = group;
}
示例12: getServer
import com.alibaba.dubbo.remoting.Server; //导入依赖的package包/类
public Server getServer() {
return server;
}