Search in sources :

Example 1 with ClusterAgent

use of org.redkale.cluster.ClusterAgent in project redkale by redkale.

the class NodeServer method preInitServices.

// Service.init执行之前调用
protected void preInitServices(Set<Service> localServices, Set<Service> remoteServices) {
    final ClusterAgent cluster = application.clusterAgent;
    if (!application.isCompileMode() && cluster != null) {
        NodeProtocol pros = getClass().getAnnotation(NodeProtocol.class);
        String protocol = pros.value().toUpperCase();
        if (!cluster.containsProtocol(protocol))
            return;
        if (!cluster.containsPort(server.getSocketAddress().getPort()))
            return;
        cluster.register(this, protocol, localServices, remoteServices);
    }
}
Also used : ClusterAgent(org.redkale.cluster.ClusterAgent)

Example 2 with ClusterAgent

use of org.redkale.cluster.ClusterAgent in project redkale by redkale.

the class NodeHttpServer method postLoadServlets.

// loadServlet执行之后调用
@Override
protected void postLoadServlets() {
    final ClusterAgent cluster = application.clusterAgent;
    if (!application.isCompileMode() && cluster != null) {
        NodeProtocol pros = getClass().getAnnotation(NodeProtocol.class);
        String protocol = pros.value().toUpperCase();
        if (!cluster.containsProtocol(protocol))
            return;
        if (!cluster.containsPort(server.getSocketAddress().getPort()))
            return;
        cluster.register(this, protocol, dynServletMap.keySet(), new HashSet<>());
    }
}
Also used : ClusterAgent(org.redkale.cluster.ClusterAgent)

Example 3 with ClusterAgent

use of org.redkale.cluster.ClusterAgent in project redkale by redkale.

the class NodeServer method preDestroyServices.

// Service.destroy执行之前调用
protected void preDestroyServices(Set<Service> localServices, Set<Service> remoteServices) {
    if (!application.isCompileMode() && application.clusterAgent != null) {
        // 服务注销
        final ClusterAgent cluster = application.clusterAgent;
        NodeProtocol pros = getClass().getAnnotation(NodeProtocol.class);
        String protocol = pros.value().toUpperCase();
        if (cluster.containsProtocol(protocol) && cluster.containsPort(server.getSocketAddress().getPort())) {
            cluster.deregister(this, protocol, localServices, remoteServices);
            afterClusterDeregisterOnPreDestroyServices(cluster, protocol);
        }
    }
    if (!application.isCompileMode() && !this.messageAgents.isEmpty()) {
    // MQ
    }
}
Also used : ClusterAgent(org.redkale.cluster.ClusterAgent)

Aggregations

ClusterAgent (org.redkale.cluster.ClusterAgent)3