This commit is contained in:
Redkale
2018-04-02 18:48:56 +08:00
parent 7bf8d60ddf
commit 2f7bebfc17

View File

@@ -166,6 +166,13 @@ public abstract class Server<K extends Serializable, C extends Context, R extend
return Long.decode(value); return Long.decode(value);
} }
protected static String formatLenth(long value) {
if (value > 1024 * 1024 * 1024) return value / (1024 * 1024 * 1024) + "G";
if (value > 1024 * 1024) return value / (1024 * 1024) + "M";
if (value > 1024) return value / (1024) + "K";
return value + "B";
}
public void destroy(final AnyValue config) throws Exception { public void destroy(final AnyValue config) throws Exception {
this.prepare.destroy(context, config); this.prepare.destroy(context, config);
} }
@@ -227,7 +234,7 @@ public abstract class Server<K extends Serializable, C extends Context, R extend
serverChannel.accept(); serverChannel.accept();
final String threadName = "[" + Thread.currentThread().getName() + "] "; final String threadName = "[" + Thread.currentThread().getName() + "] ";
logger.info(threadName + this.getClass().getSimpleName() + ("TCP".equalsIgnoreCase(protocol) ? "" : ("." + protocol)) + " listen: " + address logger.info(threadName + this.getClass().getSimpleName() + ("TCP".equalsIgnoreCase(protocol) ? "" : ("." + protocol)) + " listen: " + address
+ ", threads: " + threads + ", bufferCapacity: " + bufferCapacity / 1024 + "K, bufferPoolSize: " + bufferPoolSize + ", responsePoolSize: " + responsePoolSize + ", threads: " + threads + ", maxbody: " + formatLenth(context.maxbody) + ", bufferCapacity: " + bufferCapacity / 1024 + "K, bufferPoolSize: " + bufferPoolSize + ", responsePoolSize: " + responsePoolSize
+ ", started in " + (System.currentTimeMillis() - context.getServerStartTime()) + " ms"); + ", started in " + (System.currentTimeMillis() - context.getServerStartTime()) + " ms");
} }