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);
}
}
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<>());
}
}
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
}
}
Aggregations