增加SERVER_EXECUTOR线程池的资源注入

This commit is contained in:
Redkale
2018-01-12 09:14:10 +08:00
parent 21af487aab
commit 1cd5fe0b02
4 changed files with 32 additions and 7 deletions

View File

@@ -31,6 +31,8 @@ public abstract class Server<K extends Serializable, C extends Context, R extend
public static final String RESNAME_SERVER_ROOT = "SERVER_ROOT";
public static final String RESNAME_SERVER_EXECUTOR = "SERVER_EXECUTOR";
protected final Logger logger = Logger.getLogger(this.getClass().getSimpleName());
//-------------------------------------------------------------
@@ -90,7 +92,7 @@ public abstract class Server<K extends Serializable, C extends Context, R extend
//最大连接数
protected int maxconns;
protected Server(long serverStartTime, String protocol, PrepareServlet<K, C, R, P, S> servlet) {
this.serverStartTime = serverStartTime;
this.protocol = protocol;
@@ -146,6 +148,10 @@ public abstract class Server<K extends Serializable, C extends Context, R extend
this.prepare.destroy(context, config);
}
public ThreadPoolExecutor getExecutor() {
return executor;
}
public InetSocketAddress getSocketAddress() {
return address;
}
@@ -192,7 +198,7 @@ public abstract class Server<K extends Serializable, C extends Context, R extend
}
serverChannel.bind(address, backlog);
serverChannel.setMaxconns(this.maxconns);
serverChannel.accept();
serverChannel.accept();
final String threadName = "[" + Thread.currentThread().getName() + "] ";
logger.info(threadName + this.getClass().getSimpleName() + ("TCP".equalsIgnoreCase(protocol) ? "" : ("." + protocol)) + " listen: " + address
+ ", threads: " + threads + ", bufferCapacity: " + bufferCapacity + ", bufferPoolSize: " + bufferPoolSize + ", responsePoolSize: " + responsePoolSize