use of org.apache.dubbo.rpc.ProtocolServer in project dubbo by alibaba.
the class RestProtocol method destroy.
@Override
public void destroy() {
super.destroy();
if (connectionMonitor != null) {
connectionMonitor.shutdown();
}
for (Map.Entry<String, ProtocolServer> entry : serverMap.entrySet()) {
try {
if (logger.isInfoEnabled()) {
logger.info("Closing the rest server at " + entry.getKey());
}
entry.getValue().close();
} catch (Throwable t) {
logger.warn("Error closing rest server", t);
}
}
serverMap.clear();
if (logger.isInfoEnabled()) {
logger.info("Closing rest clients");
}
for (ResteasyClient client : clients) {
try {
client.close();
} catch (Throwable t) {
logger.warn("Error closing rest client", t);
}
}
clients.clear();
}
use of org.apache.dubbo.rpc.ProtocolServer in project dubbo by alibaba.
the class ServerStatusChecker method check.
@Override
public Status check() {
List<ProtocolServer> servers = DubboProtocol.getDubboProtocol().getServers();
if (servers == null || servers.isEmpty()) {
return new Status(Status.Level.UNKNOWN);
}
Status.Level level = Status.Level.OK;
StringBuilder buf = new StringBuilder();
for (ProtocolServer protocolServer : servers) {
RemotingServer server = protocolServer.getRemotingServer();
if (!server.isBound()) {
level = Status.Level.ERROR;
buf.setLength(0);
buf.append(server.getLocalAddress());
break;
}
if (buf.length() > 0) {
buf.append(",");
}
buf.append(server.getLocalAddress());
buf.append("(clients:");
buf.append(server.getChannels().size());
buf.append(")");
}
return new Status(level, buf.toString());
}
use of org.apache.dubbo.rpc.ProtocolServer in project dubbo by alibaba.
the class ProtocolUtils method closeAll.
public static void closeAll() {
DubboProtocol.getDubboProtocol().destroy();
Collection<ProtocolServer> servers = DubboProtocol.getDubboProtocol().getServers();
for (ProtocolServer server : servers) {
server.close();
}
}
Aggregations