This commit is contained in:
RedKale
2016-06-26 11:15:55 +08:00
parent 56cd881a99
commit 999f55222b
4 changed files with 12 additions and 7 deletions

View File

@@ -85,7 +85,7 @@ public final class NodeHttpServer extends NodeServer {
} }
protected void loadHttpServlet(final AnyValue conf, final ClassFilter<? extends Servlet> filter) throws Exception { protected void loadHttpServlet(final AnyValue conf, final ClassFilter<? extends Servlet> filter) throws Exception {
final StringBuilder sb = logger.isLoggable(Level.FINE) ? new StringBuilder() : null; final StringBuilder sb = logger.isLoggable(Level.INFO) ? new StringBuilder() : null;
final String prefix = conf == null ? "" : conf.getValue("path", ""); final String prefix = conf == null ? "" : conf.getValue("path", "");
final String threadName = "[" + Thread.currentThread().getName() + "] "; final String threadName = "[" + Thread.currentThread().getName() + "] ";
List<FilterEntry<? extends Servlet>> list = new ArrayList(filter.getFilterEntrys()); List<FilterEntry<? extends Servlet>> list = new ArrayList(filter.getFilterEntrys());
@@ -135,7 +135,7 @@ public final class NodeHttpServer extends NodeServer {
sb.append(" mapping to ").append(Arrays.toString(as.getValue())).append(LINE_SEPARATOR); sb.append(" mapping to ").append(Arrays.toString(as.getValue())).append(LINE_SEPARATOR);
} }
} }
if (sb != null && sb.length() > 0) logger.log(Level.FINE, sb.toString()); if (sb != null && sb.length() > 0) logger.log(Level.INFO, sb.toString());
} }
} }

View File

@@ -201,7 +201,7 @@ public abstract class NodeServer {
localServiceWrappers.add(wrapper); localServiceWrappers.add(wrapper);
sncpServer.consumerAccept(wrapper); sncpServer.consumerAccept(wrapper);
rf.inject(cacheListenerService, self); rf.inject(cacheListenerService, self);
if (fine) logger.fine("[" + Thread.currentThread().getName() + "] Load Service " + wrapper.getService()); logger.info("[" + Thread.currentThread().getName() + "] Load Service " + wrapper.getService());
} }
field.set(src, source); field.set(src, source);
rf.inject(source, self); // 给 "datasource.nodeid" 赋值; rf.inject(source, self); // 给 "datasource.nodeid" 赋值;
@@ -236,9 +236,9 @@ public abstract class NodeServer {
Set<String> gs = application.findSncpGroups(sameGroupTransport, diffGroupTransports); Set<String> gs = application.findSncpGroups(sameGroupTransport, diffGroupTransports);
ServiceWrapper wrapper = new ServiceWrapper(CacheSourceService.class, (Service) source, resourceName, sncpServer.getSncpGroup(), gs, null); ServiceWrapper wrapper = new ServiceWrapper(CacheSourceService.class, (Service) source, resourceName, sncpServer.getSncpGroup(), gs, null);
sncpServer.getSncpServer().addService(wrapper); sncpServer.getSncpServer().addService(wrapper);
if (finer) logger.finer("[" + Thread.currentThread().getName() + "] Load Service " + wrapper.getService()); logger.info("[" + Thread.currentThread().getName() + "] Load Service " + wrapper.getService());
} }
logger.finer("[" + Thread.currentThread().getName() + "] Load Source " + source); logger.info("[" + Thread.currentThread().getName() + "] Load Source " + source);
} catch (Exception e) { } catch (Exception e) {
logger.log(Level.SEVERE, "DataSource inject error", e); logger.log(Level.SEVERE, "DataSource inject error", e);
} }
@@ -460,6 +460,10 @@ public abstract class NodeServer {
return serverConf; return serverConf;
} }
public Logger getLogger() {
return logger;
}
public String getSncpGroup() { public String getSncpGroup() {
return sncpGroup; return sncpGroup;
} }

View File

@@ -46,7 +46,8 @@ public final class HttpServer extends Server<String, HttpContext, HttpRequest, H
final int port = this.address.getPort(); final int port = this.address.getPort();
AtomicLong createBufferCounter = watch == null ? new AtomicLong() : watch.createWatchNumber("HTTP_" + port + ".Buffer.creatCounter"); AtomicLong createBufferCounter = watch == null ? new AtomicLong() : watch.createWatchNumber("HTTP_" + port + ".Buffer.creatCounter");
AtomicLong cycleBufferCounter = watch == null ? new AtomicLong() : watch.createWatchNumber("HTTP_" + port + ".Buffer.cycleCounter"); AtomicLong cycleBufferCounter = watch == null ? new AtomicLong() : watch.createWatchNumber("HTTP_" + port + ".Buffer.cycleCounter");
final int rcapacity = Math.max(this.bufferCapacity, 16 * 1024 + 8); //兼容 HTTP 2.0 this.bufferCapacity = Math.max(this.bufferCapacity, 16 * 1024 + 16); //兼容 HTTP 2.0;
final int rcapacity = this.bufferCapacity;
ObjectPool<ByteBuffer> bufferPool = new ObjectPool<>(createBufferCounter, cycleBufferCounter, this.bufferPoolSize, ObjectPool<ByteBuffer> bufferPool = new ObjectPool<>(createBufferCounter, cycleBufferCounter, this.bufferPoolSize,
(Object... params) -> ByteBuffer.allocateDirect(rcapacity), null, (e) -> { (Object... params) -> ByteBuffer.allocateDirect(rcapacity), null, (e) -> {
if (e == null || e.isReadOnly() || e.capacity() != rcapacity) return false; if (e == null || e.isReadOnly() || e.capacity() != rcapacity) return false;

View File

@@ -157,7 +157,7 @@ public class JDBCPoolSource {
watchThread.setName("DataSource-Watch-" + maps.size() + "-Thread"); watchThread.setName("DataSource-Watch-" + maps.size() + "-Thread");
watchThread.setDaemon(true); watchThread.setDaemon(true);
watchThread.start(); watchThread.start();
dataSource.logger.log(Level.FINER, watchThread.getName() + " start watching " + file); dataSource.logger.log(Level.INFO, watchThread.getName() + " start watching " + file);
//----------------------------------------------------------- //-----------------------------------------------------------
list.add(new WeakReference<>(this)); list.add(new WeakReference<>(this));
maps.put(file, new AbstractMap.SimpleEntry<>(watcher, list)); maps.put(file, new AbstractMap.SimpleEntry<>(watcher, list));