![]() |
![]() |
selenium-server-standalone-2.42.2zeEstimator, Timer timer) { init(objectSizeEstimator, timer, 0L, 0L, 1000L); } public AbstractTrafficShapingHandler(Timer timer, long checkInterval) { init(new DefaultObjectSizeEstimator(), timer, 0L, 0L, checkInterval); } public AbstractTrafficShapingHandler(ObjectSizeEstimator objectSizeEstimator, Timer timer, long checkInterval) { init(objectSizeEstimator, timer, 0L, 0L, checkInterval); } public void configure(long newWriteLimit, long newReadLimit, long newCheckInterval) { configure(newWriteLimit, newReadLimit); configure(newCheckInterval); } public void configure(long newWriteLimit, long newReadLimit) { writeLimit = newWriteLimit; readLimit = newReadLimit; if (trafficCounter != null) { trafficCounter.resetAccounting(System.currentTimeMillis() + 1L); } } public void configure(long newCheckInterval) { checkInterval = newCheckInterval; if (trafficCounter != null) { trafficCounter.configure(checkInterval); } } protected void doAccounting(TrafficCounter counter) {} private class ReopenReadTimerTask implements TimerTask { ChannelHandlerContext ctx; ReopenReadTimerTask(ChannelHandlerContext ctx) { this.ctx = ctx; } public void run(Timeout timeoutArg) throws Exception { if (release.get()) { return; } if ((ctx != null) && (ctx.getChannel() != null) && (ctx.getChannel().isConnected())) { ctx.setAttachment(null); ctx.getChannel().setReadable(true); } } } private static long getTimeToWait(long limit, long bytes, long lastTime, long curtime) { long interval = curtime - lastTime; if (interval == 0L) { return 0L; } return (bytes * 1000L / limit - interval) / 10L * 10L; } public void messageReceived(ChannelHandlerContext arg0, MessageEvent arg1) throws Exception { try { long curtime = System.currentTimeMillis(); long size = objectSizeEstimator.estimateSize(arg1.getMessage()); if (trafficCounter != null) { trafficCounter.bytesRecvFlowControl(arg0, size); if (readLimit == 0L) { return; } long wait = getTimeToWait(readLimit, trafficCounter.getCurrentReadBytes(), trafficCounter.getLastTime(), curtime); if (wait >= 10L) { Channel channel = arg0.getChannel(); if ((channel != null) && (channel.isConnected())) { if (timer == null) { if (release.get()) { return; } Thread.sleep(wait); return; } if (arg0.getAttachment() == null) { arg0.setAttachment(Boolean.TRUE); channel.setReadable(false); TimerTask timerTask = new ReopenReadTimerTask(arg0); timeout = timer.newTimeout(timerTask, wait, TimeUnit.MILLISECONDS); } else { if (release.get()) { return; } Thread.sleep(wait); } } else { if (release.get()) { return; } Thread.sleep(wait); } } } } finally { super.messageReceived(arg0, arg1); } } public void writeRequested(ChannelHandlerContext arg0, MessageEvent arg1) throws Exception { try { long curtime = System.currentTimeMillis(); long size = objectSizeEstimator.estimateSize(arg1.getMessage()); if (trafficCounter != null) { trafficCounter.bytesWriteFlowControl(size); if (writeLimit == 0L) { return; } long wait = getTimeToWait(writeLimit, trafficCounter.getCurrentWrittenBytes(), trafficCounter.getLastTime(), curtime); if (wait >= 10L) { if (release.get()) { return; } Thread.sleep(wait); } } } finally { super.writeRequested(arg0, arg1); } } public void handleDownstream(ChannelHandlerContext ctx, ChannelEvent e) throws Exception { if ((e instanceof ChannelStateEvent)) { ChannelStateEvent cse = (ChannelStateEvent)e; if ((cse.getState() == ChannelState.INTEREST_OPS) && ((((Integer)cse.getValue()).intValue() & 0x1) != 0)) { boolean readSuspended = ctx.getAttachment() != null; if (readSuspended) { e.getFuture().setSuccess(); return; } } } super.handleDownstream(ctx, e); } public TrafficCounter getTrafficCounter() { return trafficCounter; } public void releaseExternalResources() { if (trafficCounter != null) { trafficCounter.stop(); } release.set(true); if (timeout != null) { timeout.cancel(); } } public String toString() { return "TrafficShaping with Write Limit: " + writeLimit + " Read Limit: " + readLimit + " and Counter: " + (trafficCounter != null ? trafficCounter.toString() : "none"); } } /* Location: * Qualified Name: org.jboss.netty.handler.traffic.AbstractTrafficShapingHandler * Java Class Version: 5 (49.0) * JD-Core Version: 0.7.1 */ package org.jboss.netty.handler.traffic; import org.jboss.netty.channel.Channel; import org.jboss.netty.channel.ChannelHandlerContext; import org.jboss.netty.channel.ChannelStateEvent; import org.jboss.netty.util.ObjectSizeEstimator; import org.jboss.netty.util.Timer; public class ChannelTrafficShapingHandler extends AbstractTrafficShapingHandler { public ChannelTrafficShapingHandler(Timer timer, long writeLimit, long readLimit, long checkInterval) { super(timer, writeLimit, readLimit, checkInterval); } public ChannelTrafficShapingHandler(Timer timer, long writeLimit, long readLimit) { super(timer, writeLimit, readLimit); } public ChannelTrafficShapingHandler(Timer timer, long checkInterval) { super(timer, checkInterval); } public ChannelTrafficShapingHandler(Timer timer) { super(timer); } public ChannelTrafficShapingHandler(ObjectSizeEstimator objectSizeEstimator, Timer timer, long writeLimit, long readLimit, long checkInterval) { super(objectSizeEstimator, timer, writeLimit, readLimit, checkInterval); } public ChannelTrafficShapingHandler(ObjectSizeEstimator objectSizeEstimator, Timer timer, long writeLimit, long readLimit) { super(objectSizeEstimator, timer, writeLimit, readLimit); } public ChannelTrafficShapingHandler(ObjectSizeEstimator objectSizeEstimator, Timer timer, long checkInterval) { super(objectSizeEstimator, timer, checkInterval); } public ChannelTrafficShapingHandler(ObjectSizeEstimator objectSizeEstimator, Timer timer) { super(objectSizeEstimator, timer); } public void channelClosed(ChannelHandlerContext ctx, ChannelStateEvent e) throws Exception { if (trafficCounter != null) { trafficCounter.stop(); } super.channelClosed(ctx, e); } public void channelConnected(ChannelHandlerContext ctx, ChannelStateEvent e) throws Exception { ctx.setAttachment(Boolean.TRUE); ctx.getChannel().setReadable(false); if (trafficCounter == null) { if (timer != null) { trafficCounter = new TrafficCounter(this, timer, "ChannelTC" + ctx.getChannel().getId(), checkInterval); } } if (trafficCounter != null) { trafficCounter.start(); } super.channelConnected(ctx, e); ctx.setAttachment(null); ctx.getChannel().setReadable(true); } } /* Location: * Qualified Name: org.jboss.netty.handler.traffic.ChannelTrafficShapingHandler * Java Class Version: 5 (49.0) * JD-Core Version: 0.7.1 */ package org.jboss.netty.handler.traffic; import org.jboss.netty.channel.ChannelHandler.Sharable; import org.jboss.netty.util.ObjectSizeEstimator; import org.jboss.netty.util.Timer; @ChannelHandler.Sharable public class GlobalTrafficShapingHandler extends AbstractTrafficShapingHandler { void createGlobalTrafficCounter() { if (timer != null) { TrafficCounter tc = new TrafficCounter(this, timer, "GlobalTC", checkInterval); setTrafficCounter(tc); tc.start(); } } public GlobalTrafficShapingHandler(Timer timer, long writeLimit, long readLimit, long checkInterval) { super(timer, writeLimit, readLimit, checkInterval); createGlobalTrafficCounter(); } public GlobalTrafficShapingHandler(Timer timer, long writeLimit, long readLimit) { super(timer, writeLimit, readLimit); createGlobalTrafficCounter(); } public GlobalTrafficShapingHandler(Timer timer, long checkInterval) { super(timer, checkInterval); createGlobalTrafficCounter(); } public GlobalTrafficShapingHandler(Timer timer) { super(timer); createGlobalTrafficCounter(); } public GlobalTrafficShapingHandler(ObjectSizeEstimator objectSizeEstimator, Timer timer, long writeLimit, long readLimit, long checkInterval) { super(objectSizeEstimator, timer, writeLimit, readLimit, checkInterval); createGlobalTrafficCounter(); } public GlobalTrafficShapingHandler(ObjectSizeEstimator objectSizeEstimator, Timer timer, long writeLimit, long readLimit) { super(objectSizeEstimator, timer, writeLimit, readLimit); createGlobalTrafficCounter(); } public GlobalTrafficShapingHandler(ObjectSizeEstimator objectSizeEstimator, Timer timer, long checkInterval) { super(objectSizeEstimator, timer, checkInterval); createGlobalTrafficCounter(); } public GlobalTrafficShapingHandler(ObjectSizeEstimator objectSizeEstimator, Timer timer) { super(objectSizeEstimator, timer); createGlobalTrafficCounter(); } } /* Location: * Qualified Name: org.jboss.netty.handler.traffic.GlobalTrafficShapingHandler * Java Class Version: 5 (49.0) * JD-Core Version: 0.7.1 */ package org.jboss.netty.handler.traffic; import java.util.concurrent.TimeUnit; import java.util.concurrent.atomic.AtomicBoolean; import java.util.concurrent.atomic.AtomicLong; import org.jboss.netty.util.Timeout; import org.jboss.netty.util.Timer; import org.jboss.netty.util.TimerTask; class TrafficCounter$TrafficMonitoringTask implements TimerTask { private final AbstractTrafficShapingHandler trafficShapingHandler1; private final TrafficCounter counter; protected TrafficCounter$TrafficMonitoringTask(AbstractTrafficShapingHandler trafficShapingHandler, TrafficCounter counter) { trafficShapingHandler1 = trafficShapingHandler; this.counter = counter; } public void run(Timeout timeout) throws Exception { if (!counter.monitorActive.get()) { return; } long endTime = System.currentTimeMillis(); counter.resetAccounting(endTime); if (trafficShapingHandler1 != null) { trafficShapingHandler1.doAccounting(counter); } timeout = TrafficCounter.access$000(counter).newTimeout(this, counter.checkInterval.get(), TimeUnit.MILLISECONDS); } } /* Location: * Qualified Name: org.jboss.netty.handler.traffic.TrafficCounter.TrafficMonitoringTask * Java Class Version: 5 (49.0) * JD-Core Version: 0.7.1 */ package org.jboss.netty.handler.traffic; import java.util.concurrent.TimeUnit; import java.util.concurrent.atomic.AtomicBoolean; import java.util.concurrent.atomic.AtomicLong; import org.jboss.netty.channel.ChannelHandlerContext; import org.jboss.netty.util.Timeout; import org.jboss.netty.util.Timer; import org.jboss.netty.util.TimerTask; public class TrafficCounter { private final AtomicLong currentWrittenBytes = new AtomicLong(); private final AtomicLong currentReadBytes = new AtomicLong(); private final AtomicLong cumulativeWrittenBytes = new AtomicLong(); private final AtomicLong cumulativeReadBytes = new AtomicLong(); private long lastCumulativeTime; private long lastWriteThroughput; private long lastReadThroughput; private final AtomicLong lastTime = new AtomicLong(); private long lastWrittenBytes; private long lastReadBytes; AtomicLong checkInterval = new AtomicLong(1000L); final String name; private final AbstractTrafficShapingHandler trafficShapingHandler; private final Timer timer; private TimerTask timerTask; private volatile Timeout timeout; AtomicBoolean monitorActive = new AtomicBoolean(); private static class TrafficMonitoringTask implements TimerTask { private final AbstractTrafficShapingHandler trafficShapingHandler1; private final TrafficCounter counter; protected TrafficMonitoringTask(AbstractTrafficShapingHandler trafficShapingHandler, TrafficCounter counter) { trafficShapingHandler1 = trafficShapingHandler; this.counter = counter; } public void run(Timeout timeout) throws Exception { if (!counter.monitorActive.get()) { return; } long endTime = System.currentTimeMillis(); counter.resetAccounting(endTime); if (trafficShapingHandler1 != null) { trafficShapingHandler1.doAccounting(counter); } timeout = counter.timer.newTimeout(this, counter.checkInterval.get(), TimeUnit.MILLISECONDS); } } public void start() { synchronized (lastTime) { if (monitorActive.get()) { return; } lastTime.set(System.currentTimeMillis()); if (checkInterval.get() > 0L) { monitorActive.set(true); timerTask = new TrafficMonitoringTask(trafficShapingHandler, this); timeout = timer.newTimeout(timerTask, checkInterval.get(), TimeUnit.MILLISECONDS); } } } public void stop() { synchronized (lastTime) { if (!monitorActive.get()) { return; } monitorActive.set(false); resetAccounting(System.currentTimeMillis()); if (trafficShapingHandler != null) { trafficShapingHandler.doAccounting(this); } if (timeout != null) { timeout.cancel(); } } } void resetAccounting(long newLastTime) { synchronized (lastTime) { long interval = newLastTime - lastTime.getAndSet(newLastTime); if (interval == 0L) { return; } lastReadBytes = currentReadBytes.getAndSet(0L); lastWrittenBytes = currentWrittenBytes.getAndSet(0L); lastReadThroughput = (lastReadBytes / interval * 1000L); lastWriteThroughput = (lastWrittenBytes / interval * 1000L); } } public TrafficCounter(AbstractTrafficShapingHandler trafficShapingHandler, Timer timer, String name, long checkInterval) { this.trafficShapingHandler = trafficShapingHandler; this.timer = timer; this.name = name; lastCumulativeTime = System.currentTimeMillis(); configure(checkInterval); } public void configure(long newcheckInterval) { long newInterval = newcheckInterval / 10L * 10L; if (checkInterval.get() != newInterval) { checkInterval.set(newInterval); if (newInterval <= 0L) { stop(); lastTime.set(System.currentTimeMillis()); } else { start(); } } } void bytesRecvFlowControl(ChannelHandlerContext ctx, long recv) { currentReadBytes.addAndGet(recv); cumulativeReadBytes.addAndGet(recv); } void bytesWriteFlowControl(long write) { currentWrittenBytes.addAndGet(write); cumulativeWrittenBytes.addAndGet(write); } public long getCheckInterval() { return checkInterval.get(); } public long getLastReadThroughput() { return lastReadThroughput; } public long getLastWriteThroughput() { return lastWriteThroughput; } public long getLastReadBytes() { return lastReadBytes; } public long getLastWrittenBytes() { return lastWrittenBytes; } public long getCurrentReadBytes() { return currentReadBytes.get(); } public long getCurrentWrittenBytes() { return currentWrittenBytes.get(); } public long getLastTime() { return lastTime.get(); } public long getCumulativeWrittenBytes() { return cumulativeWrittenBytes.get(); } public long getCumulativeReadBytes() { return cumulativeReadBytes.get(); } public long getLastCumulativeTime() { return lastCumulativeTime; } public void resetCumulativeTime() { lastCumulativeTime = System.currentTimeMillis(); cumulativeReadBytes.set(0L); cumulativeWrittenBytes.set(0L); } public String getName() { return name; } public String toString() { return "Monitor " + name + " Current Speed Read: " + (lastReadThroughput >> 10) + " KB/s, Write: " + (lastWriteThroughput >> 10) + " KB/s Current Read: " + (currentReadBytes.get() >> 10) + " KB Current Write: " + (currentWrittenBytes.get() >> 10) + " KB"; } } /* Location: * Qualified Name: org.jboss.netty.handler.traffic.TrafficCounter * Java Class Version: 5 (49.0) * JD-Core Version: 0.7.1 */ package org.jboss.netty.logging; class AbstractInternalLogger$1 {} /* Location: * Qualified Name: org.jboss.netty.logging.AbstractInternalLogger.1 * Java Class Version: 5 (49.0) * JD-Core Version: 0.7.1 */ package org.jboss.netty.logging; public abstract class AbstractInternalLogger implements InternalLogger { public boolean isEnabled(InternalLogLevel level) { switch (level) { case DEBUG: return isDebugEnabled(); case INFO: return isInfoEnabled(); case WARN: return isWarnEnabled(); case ERROR: return isErrorEnabled(); } throw new Error(); } public void log(InternalLogLevel level, String msg, Throwable cause) { switch (level) { case DEBUG: debug(msg, cause); break; case INFO: info(msg, cause); break; case WARN: warn(msg, cause); break; case ERROR: error(msg, cause); break; default: throw new Error(); } } public void log(InternalLogLevel level, String msg) { switch (level) { case DEBUG: debug(msg); break; case INFO: info(msg); break; case WARN: warn(msg); break; case ERROR: error(msg); break; default: throw new Error(); } } } /* Location: * Qualified Name: org.jboss.netty.logging.AbstractInternalLogger * Java Class Version: 5 (49.0) * JD-Core Version: 0.7.1 */ package org.jboss.netty.logging; import org.apache.commons.logging.Log; class CommonsLogger extends AbstractInternalLogger { private final Log logger; private final String loggerName; CommonsLogger(Log logger, String loggerName) { this.logger = logger; this.loggerName = loggerName; } public void debug(String msg) { logger.debug(msg); } public void debug(String msg, Throwable cause) { logger.debug(msg, cause); } public void error(String msg) { logger.error(msg); } public void error(String msg, Throwable cause) { logger.error(msg, cause); } public void info(String msg) { logger.info(msg); } public void info(String msg, Throwable cause) { logger.info(msg, cause); } public boolean isDebugEnabled() { return logger.isDebugEnabled(); } public boolean isErrorEnabled() { return logger.isErrorEnabled(); } public boolean isInfoEnabled() { return logger.isInfoEnabled(); } public boolean isWarnEnabled() { return logger.isWarnEnabled(); } public void warn(String msg) { logger.warn(msg); } public void warn(String msg, Throwable cause) { logger.warn(msg, cause); } public String toString() { return loggerName; } } /* Location: * Qualified Name: org.jboss.netty.logging.CommonsLogger * Java Class Version: 5 (49.0) * JD-Core Version: 0.7.1 */ package org.jboss.netty.logging; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; public class CommonsLoggerFactory extends InternalLoggerFactory { public InternalLogger newInstance(String name) { Log logger = LogFactory.getLog(name); return new CommonsLogger(logger, name); } } /* Location: * Qualified Name: org.jboss.netty.logging.CommonsLoggerFactory * Java Class Version: 5 (49.0) * JD-Core Version: 0.7.1 */ package org.jboss.netty.logging; public enum InternalLogLevel { DEBUG, INFO, WARN, ERROR; private InternalLogLevel() {} } /* Location: * Qualified Name: org.jboss.netty.logging.InternalLogLevel * Java Class Version: 5 (49.0) * JD-Core Version: 0.7.1 */ package org.jboss.netty.logging; public abstract interface InternalLogger { public abstract boolean isDebugEnabled(); public abstract boolean isInfoEnabled(); public abstract boolean isWarnEnabled(); public abstract boolean isErrorEnabled(); public abstract boolean isEnabled(InternalLogLevel paramInternalLogLevel); public abstract void debug(String paramString); public abstract void debug(String paramString, Throwable paramThrowable); public abstract void info(String paramString); public abstract void info(String paramString, Throwable paramThrowable); public abstract void warn(String paramString); public abstract void warn(String paramString, Throwable paramThrowable); public abstract void error(String paramString); public abstract void error(String paramString, Throwable paramThrowable); public abstract void log(InternalLogLevel paramInternalLogLevel, String paramString); public abstract void log(InternalLogLevel paramInternalLogLevel, String paramString, Throwable paramThrowable); } /* Location: * Qualified Name: org.jboss.netty.logging.InternalLogger * Java Class Version: 5 (49.0) * JD-Core Version: 0.7.1 */ package org.jboss.netty.logging; import org.jboss.netty.util.internal.StackTraceSimplifier; final class InternalLoggerFactory$1 implements InternalLogger { InternalLoggerFactory$1(InternalLogger paramInternalLogger) {} public void debug(String msg) { val$logger.debug(msg); } public void debug(String msg, Throwable cause) { StackTraceSimplifier.simplify(cause); val$logger.debug(msg, cause); } public void error(String msg) { val$logger.error(msg); } public void error(String msg, Throwable cause) { StackTraceSimplifier.simplify(cause); val$logger.error(msg, cause); } public void info(String msg) { val$logger.info(msg); } public void info(String msg, Throwable cause) { StackTraceSimplifier.simplify(cause); val$logger.info(msg, cause); } public boolean isDebugEnabled() { return val$logger.isDebugEnabled(); } public boolean isErrorEnabled() { return val$logger.isErrorEnabled(); } public boolean isInfoEnabled() { return val$logger.isInfoEnabled(); } public boolean isWarnEnabled() { return val$logger.isWarnEnabled(); } public void warn(String msg) { val$logger.warn(msg); } public void warn(String msg, Throwable cause) { StackTraceSimplifier.simplify(cause); val$logger.warn(msg, cause); } public boolean isEnabled(InternalLogLevel level) { return val$logger.isEnabled(level); } public void log(InternalLogLevel level, String msg) { val$logger.log(level, msg); } public void log(InternalLogLevel level, String msg, Throwable cause) { StackTraceSimplifier.simplify(cause); val$logger.log(level, msg, cause); } } /* Location: * Qualified Name: org.jboss.netty.logging.InternalLoggerFactory.1 * Java Class Version: 5 (49.0) * JD-Core Version: 0.7.1 */ package org.jboss.netty.logging; import org.jboss.netty.util.internal.StackTraceSimplifier; public abstract class InternalLoggerFactory { private static volatile InternalLoggerFactory defaultFactory = new JdkLoggerFactory(); static { StackTraceSimplifier.simplify(new Exception()); } public static InternalLoggerFactory getDefaultFactory() { return defaultFactory; } public static void setDefaultFactory(InternalLoggerFactory defaultFactory) { if (defaultFactory == null) { throw new NullPointerException("defaultFactory"); } defaultFactory = defaultFactory; } public static InternalLogger getInstance(Class<?> clazz) { return getInstance(clazz.getName()); } public static InternalLogger getInstance(String name) { InternalLogger logger = getDefaultFactory().newInstance(name); new InternalLogger() { public void debug(String msg) { val$logger.debug(msg); } public void debug(String msg, Throwable cause) { StackTraceSimplifier.simplify(cause); val$logger.debug(msg, cause); } public void error(String msg) { val$logger.error(msg); } public void error(String msg, Throwable cause) { StackTraceSimplifier.simplify(cause); val$logger.error(msg, cause); } public void info(String msg) { val$logger.info(msg); } public void info(String msg, Throwable cause) { StackTraceSimplifier.simplify(cause); val$logger.info(msg, cause); } public boolean isDebugEnabled() { return val$logger.isDebugEnabled(); } public boolean isErrorEnabled() { return val$logger.isErrorEnabled(); } public boolean isInfoEnabled() { return val$logger.isInfoEnabled(); } public boolean isWarnEnabled() { return val$logger.isWarnEnabled(); } public void warn(String msg) { val$logger.warn(msg); } public void warn(String msg, Throwable cause) { StackTraceSimplifier.simplify(cause); val$logger.warn(msg, cause); } public boolean isEnabled(InternalLogLevel level) { return val$logger.isEnabled(level); } public void log(InternalLogLevel level, String msg) { val$logger.log(level, msg); } public void log(InternalLogLevel level, String msg, Throwable cause) { StackTraceSimplifier.simplify(cause); val$logger.log(level, msg, cause); } }; } public abstract InternalLogger newInstance(String paramString); } /* Location: * Qualified Name: org.jboss.netty.logging.InternalLoggerFactory * Java Class Version: 5 (49.0) * JD-Core Version: 0.7.1 */ package org.jboss.netty.logging; import org.jboss.logging.Logger; class JBossLogger extends AbstractInternalLogger { private final Logger logger; JBossLogger(Logger logger) { this.logger = logger; } public void debug(String msg) { logger.debug(msg); } public void debug(String msg, Throwable cause) { logger.debug(msg, cause); } public void error(String msg) { logger.error(msg); } public void error(String msg, Throwable cause) { logger.error(msg, cause); } public void info(String msg) { logger.info(msg); } public void info(String msg, Throwable cause) { logger.info(msg, cause); } public boolean isDebugEnabled() { return logger.isDebugEnabled(); } public boolean isErrorEnabled() { return true; } public boolean isInfoEnabled() { return logger.isInfoEnabled(); } public boolean isWarnEnabled() { return true; } public void warn(String msg) { logger.warn(msg); } public void warn(String msg, Throwable cause) { logger.warn(msg, cause); } public String toString() { return String.valueOf(logger.getName()); } } /* Location: * Qualified Name: org.jboss.netty.logging.JBossLogger * Java Class Version: 5 (49.0) * JD-Core Version: 0.7.1 */ package org.jboss.netty.logging; import org.jboss.logging.Logger; public class JBossLoggerFactory extends InternalLoggerFactory { public InternalLogger newInstance(String name) { Logger logger = Logger.getLogger(name); return new JBossLogger(logger); } } /* Location: * Qualified Name: org.jboss.netty.logging.JBossLoggerFactory * Java Class Version: 5 (49.0) * JD-Core Version: 0.7.1 */ package org.jboss.netty.logging; import java.util.logging.Level; import java.util.logging.Logger; class JdkLogger extends AbstractInternalLogger { private final Logger logger; private final String loggerName; JdkLogger(Logger logger, String loggerName) { this.logger = logger; this.loggerName = loggerName; } public void debug(String msg) { logger.logp(Level.FINE, loggerName, null, msg); } public void debug(String msg, Throwable cause) { logger.logp(Level.FINE, loggerName, null, msg, cause); } public void error(String msg) { logger.logp(Level.SEVERE, loggerName, null, msg); } public void error(String msg, Throwable cause) { logger.logp(Level.SEVERE, loggerName, null, msg, cause); } public void info(String msg) { logger.logp(Level.INFO, loggerName, null, msg); } public void info(String msg, Throwable cause) { logger.logp(Level.INFO, loggerName, null, msg, cause); } public boolean isDebugEnabled() { return logger.isLoggable(Level.FINE); } public boolean isErrorEnabled() { return logger.isLoggable(Level.SEVERE); } public boolean isInfoEnabled() { return logger.isLoggable(Level.INFO); } public boolean isWarnEnabled() { return logger.isLoggable(Level.WARNING); } public void warn(String msg) { logger.logp(Level.WARNING, loggerName, null, msg); } public void warn(String msg, Throwable cause) { logger.logp(Level.WARNING, loggerName, null, msg, cause); } public String toString() { return loggerName; } } /* Location: * Qualified Name: org.jboss.netty.logging.JdkLogger * Java Class Version: 5 (49.0) * JD-Core Version: 0.7.1 */ package org.jboss.netty.logging; import java.util.logging.Logger; public class JdkLoggerFactory extends InternalLoggerFactory { public InternalLogger newInstance(String name) { Logger logger = Logger.getLogger(name); return new JdkLogger(logger, name); } } /* Location: * Qualified Name: org.jboss.netty.logging.JdkLoggerFactory * Java Class Version: 5 (49.0) * JD-Core Version: 0.7.1 */ package org.jboss.netty.logging; import org.apache.log4j.Logger; class Log4JLogger extends AbstractInternalLogger { private final Logger logger; Log4JLogger(Logger logger) { this.logger = logger; } public void debug(String msg) { logger.debug(msg); } public void debug(String msg, Throwable cause) { logger.debug(msg, cause); } public void error(String msg) { logger.error(msg); } public void error(String msg, Throwable cause) { logger.error(msg, cause); } public void info(String msg) { logger.info(msg); } public void info(String msg, Throwable cause) { logger.info(msg, cause); } public boolean isDebugEnabled() { return logger.isDebugEnabled(); } public boolean isErrorEnabled() { return true; } public boolean isInfoEnabled() { return logger.isInfoEnabled(); } public boolean isWarnEnabled() { return true; } public void warn(String msg) { logger.warn(msg); } public void warn(String msg, Throwable cause) { logger.warn(msg, cause); } public String toString() { return String.valueOf(logger.getName()); } } /* Location: * Qualified Name: org.jboss.netty.logging.Log4JLogger * Java Class Version: 5 (49.0) * JD-Core Version: 0.7.1 */ package org.jboss.netty.logging; import org.apache.log4j.Logger; public class Log4JLoggerFactory extends InternalLoggerFactory { public InternalLogger newInstance(String name) { Logger logger = Logger.getLogger(name); return new Log4JLogger(logger); } } /* Location: * Qualified Name: org.jboss.netty.logging.Log4JLoggerFactory * Java Class Version: 5 (49.0) * JD-Core Version: 0.7.1 */ package org.jboss.netty.logging; import org.osgi.service.log.LogService; class OsgiLogger extends AbstractInternalLogger { private final OsgiLoggerFactory parent; private final InternalLogger fallback; private final String name; private final String prefix; OsgiLogger(OsgiLoggerFactory parent, String name, InternalLogger fallback) { this.parent = parent; this.name = name; this.fallback = fallback; prefix = ("[" + name + "] "); } public void debug(String msg) { LogService logService = parent.getLogService(); if (logService != null) { logService.log(4, prefix + msg); } else { fallback.debug(msg); } } public void debug(String msg, Throwable cause) { LogService logService = parent.getLogService(); if (logService != null) { logService.log(4, prefix + msg, cause); } else { fallback.debug(msg, cause); } } public void error(String msg) { LogService logService = parent.getLogService(); if (logService != null) { logService.log(1, prefix + msg); } else { fallback.error(msg); } } public void error(String msg, Throwable cause) { LogService logService = parent.getLogService(); if (logService != null) { logService.log(1, prefix + msg, cause); } else { fallback.error(msg, cause); } } public void info(String msg) { LogService logService = parent.getLogService(); if (logService != null) { logService.log(3, prefix + msg); } else { fallback.info(msg); } } public void info(String msg, Throwable cause) { LogService logService = parent.getLogService(); if (logService != null) { logService.log(3, prefix + msg, cause); } else { fallback.info(msg, cause); } } public boolean isDebugEnabled() { return true; } public boolean isErrorEnabled() { return true; } public boolean isInfoEnabled() { return true; } public boolean isWarnEnabled() { return true; } public void warn(String msg) { LogService logService = parent.getLogService(); if (logService != null) { logService.log(2, prefix + msg); } else { fallback.warn(msg); } } public void warn(String msg, Throwable cause) { LogService logService = parent.getLogService(); if (logService != null) { logService.log(2, prefix + msg, cause); } else { fallback.warn(msg, cause); } } public String toString() { return name; } } /* Location: * Qualified Name: org.jboss.netty.logging.OsgiLogger * Java Class Version: 5 (49.0) * JD-Core Version: 0.7.1 */ package org.jboss.netty.logging; import org.osgi.framework.BundleContext; import org.osgi.framework.ServiceReference; import org.osgi.service.log.LogService; import org.osgi.util.tracker.ServiceTracker; import org.osgi.util.tracker.ServiceTrackerCustomizer; class OsgiLoggerFactory$1 extends ServiceTracker { OsgiLoggerFactory$1(OsgiLoggerFactory paramOsgiLoggerFactory, BundleContext x0, String x1, ServiceTrackerCustomizer x2) { super(x0, x1, x2); } public Object addingService(ServiceReference reference) { LogService service = (LogService)super.addingService(reference); this$0.logService = service; return service; } public void removedService(ServiceReference reference, Object service) { this$0.logService = null; } } /* Location: * Qualified Name: org.jboss.netty.logging.OsgiLoggerFactory.1 * Java Class Version: 5 (49.0) * JD-Core Version: 0.7.1 */ package org.jboss.netty.logging; import org.osgi.framework.BundleContext; import org.osgi.framework.ServiceReference; import org.osgi.service.log.LogService; import org.osgi.util.tracker.ServiceTracker; import org.osgi.util.tracker.ServiceTrackerCustomizer; public class OsgiLoggerFactory extends InternalLoggerFactory { private final ServiceTracker logServiceTracker; private final InternalLoggerFactory fallback; volatile LogService logService; public OsgiLoggerFactory(BundleContext ctx) { this(ctx, null); } public OsgiLoggerFactory(BundleContext ctx, InternalLoggerFactory fallback) { if (ctx == null) { throw new NullPointerException("ctx"); } if (fallback == null) { fallback = InternalLoggerFactory.getDefaultFactory(); if ((fallback instanceof OsgiLoggerFactory)) { fallback = new JdkLoggerFactory(); } } this.fallback = fallback; logServiceTracker = new ServiceTracker(ctx, "org.osgi.service.log.LogService", null) { public Object addingService(ServiceReference reference) { LogService service = (LogService)super.addingService(reference); logService = service; return service; } public void removedService(ServiceReference reference, Object service) { logService = null; } }; logServiceTracker.open(); } public InternalLoggerFactory getFallback() { return fallback; } public LogService getLogService() { return logService; } public void destroy() { logService = null; logServiceTracker.close(); } public InternalLogger newInstance(String name) { return new OsgiLogger(this, name, fallback.newInstance(name)); } } /* Location: * Qualified Name: org.jboss.netty.logging.OsgiLoggerFactory * Java Class Version: 5 (49.0) * JD-Core Version: 0.7.1 */ package org.jboss.netty.logging; import org.slf4j.Logger; class Slf4JLogger extends AbstractInternalLogger { private final Logger logger; Slf4JLogger(Logger logger) { this.logger = logger; } public void debug(String msg) { logger.debug(msg); } public void debug(String msg, Throwable cause) { logger.debug(msg, cause); } public void error(String msg) { logger.error(msg); } public void error(String msg, Throwable cause) { logger.error(msg, cause); } public void info(String msg) { logger.info(msg); } public void info(String msg, Throwable cause) { logger.info(msg, cause); } public boolean isDebugEnabled() { return logger.isDebugEnabled(); } public boolean isErrorEnabled() { return logger.isErrorEnabled(); } public boolean isInfoEnabled() { return logger.isInfoEnabled(); } public boolean isWarnEnabled() { return logger.isWarnEnabled(); } public void warn(String msg) { logger.warn(msg); } public void warn(String msg, Throwable cause) { logger.warn(msg, cause); } public String toString() { return String.valueOf(logger.getName()); } } /* Location: * Qualified Name: org.jboss.netty.logging.Slf4JLogger * Java Class Version: 5 (49.0) * JD-Core Version: 0.7.1 */ package org.jboss.netty.logging; import org.slf4j.Logger; import org.slf4j.LoggerFactory; public class Slf4JLoggerFactory extends InternalLoggerFactory { public InternalLogger newInstance(String name) { Logger logger = LoggerFactory.getLogger(name); return new Slf4JLogger(logger); } } /* Location: * Qualified Name: org.jboss.netty.logging.Slf4JLoggerFactory * Java Class Version: 5 (49.0) * JD-Core Version: 0.7.1 */ p Further reading...For more information on Java 1.5 Tiger, you may find Java 1.5 Tiger, A developer's Notebook by D. Flanagan and B. McLaughlin from O'Reilly of interest.New!JAR listings
|