ClusterAgent

This commit is contained in:
Redkale
2020-05-16 17:51:30 +08:00
parent 8834f57582
commit 01a5b32b22
3 changed files with 89 additions and 51 deletions

View File

@@ -124,6 +124,9 @@ public final class Application {
//SNCP传输端的TransportFactory, 注意: 只给SNCP使用
final TransportFactory sncpTransportFactory;
//第三方服务发现管理接口
final ClusterAgent[] clusterAgents;
//全局根ResourceFactory
final ResourceFactory resourceFactory = ResourceFactory.root();
@@ -264,6 +267,7 @@ public final class Application {
AsynchronousChannelGroup transportGroup = null;
final AnyValue resources = config.getAnyValue("resources");
TransportStrategy strategy = null;
List<ClusterAgent> clusters = new ArrayList<>();
int bufferCapacity = 32 * 1024;
int bufferPoolSize = Runtime.getRuntime().availableProcessors() * 8;
int readTimeoutSeconds = TransportFactory.DEFAULT_READTIMEOUTSECONDS;
@@ -307,6 +311,7 @@ public final class Application {
}
logger.log(Level.INFO, Transport.class.getSimpleName() + " configure bufferCapacity = " + bufferCapacity / 1024 + "K; bufferPoolSize = " + bufferPoolSize + "; threads = " + threads + ";");
}
AnyValue[] clusterConfs = resources.getAnyValues("cluster");
}
if (transportGroup == null) {
final AtomicInteger counter = new AtomicInteger();
@@ -331,6 +336,7 @@ public final class Application {
return true;
});
}
this.clusterAgents = clusters == null ? null : clusters.toArray(new ClusterAgent[clusters.size()]);
this.sncpTransportFactory = TransportFactory.create(transportExec, transportPool, transportGroup, (SSLContext) null, readTimeoutSeconds, writeTimeoutSeconds, strategy);
DefaultAnyValue tarnsportConf = DefaultAnyValue.create(TransportFactory.NAME_POOLMAXCONNS, System.getProperty("net.transport.poolmaxconns", "100"))
.addValue(TransportFactory.NAME_PINGINTERVAL, System.getProperty("net.transport.pinginterval", "30"))
@@ -348,6 +354,10 @@ public final class Application {
return sncpTransportFactory;
}
public ClusterAgent[] getClusterAgents() {
return clusterAgents;
}
public RedkaleClassLoader getClassLoader() {
return classLoader;
}

View File

@@ -0,0 +1,18 @@
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package org.redkale.watch;
/**
* 第三方服务发现管理接口cluster
*
*
* 详情见: https://redkale.org
*
* @author zhangjx
*/
public abstract class ClusterAgent {
}