Search in sources :

Example 11 with ProtocolServer

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();
}
Also used : ProtocolServer(org.apache.dubbo.rpc.ProtocolServer) ResteasyClient(org.jboss.resteasy.client.jaxrs.ResteasyClient) Map(java.util.Map)

Example 12 with ProtocolServer

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());
}
Also used : Status(org.apache.dubbo.common.status.Status) ProtocolServer(org.apache.dubbo.rpc.ProtocolServer) RemotingServer(org.apache.dubbo.remoting.RemotingServer)

Example 13 with ProtocolServer

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();
    }
}
Also used : ProtocolServer(org.apache.dubbo.rpc.ProtocolServer)

Aggregations

ProtocolServer (org.apache.dubbo.rpc.ProtocolServer)13 RemotingServer (org.apache.dubbo.remoting.RemotingServer)6 IOException (java.io.IOException)2 RpcException (org.apache.dubbo.rpc.RpcException)2 HessianSkeleton (com.caucho.hessian.server.HessianSkeleton)1 ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)1 JsonRpcServer (com.googlecode.jsonrpc4j.JsonRpcServer)1 Server (io.grpc.Server)1 NettyServerBuilder (io.grpc.netty.NettyServerBuilder)1 InvocationTargetException (java.lang.reflect.InvocationTargetException)1 Method (java.lang.reflect.Method)1 SocketTimeoutException (java.net.SocketTimeoutException)1 ArrayList (java.util.ArrayList)1 List (java.util.List)1 Map (java.util.Map)1 ServletException (javax.servlet.ServletException)1 SoapTransportFactory (org.apache.cxf.binding.soap.SoapTransportFactory)1 ServerFactoryBean (org.apache.cxf.frontend.ServerFactoryBean)1 DestinationRegistryImpl (org.apache.cxf.transport.http.DestinationRegistryImpl)1 URL (org.apache.dubbo.common.URL)1