本文整理汇总了Java中io.netty.util.internal.logging.InternalLogger类的典型用法代码示例。如果您正苦于以下问题:Java InternalLogger类的具体用法?Java InternalLogger怎么用?Java InternalLogger使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
InternalLogger类属于io.netty.util.internal.logging包,在下文中一共展示了InternalLogger类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createScript
import io.netty.util.internal.logging.InternalLogger; //导入依赖的package包/类
/**
* Creates a new Script object.
*
* @param script
* the script
* @param timeout
*
* @return the script
*/
public static Script createScript(String script, String id,
WrappedProcess process, String[] args, InternalLogger log,
int timeout, String encoding, boolean reload, int debug,
int maxConcInvocations)
{
if (script == null || "".equals(script))
return null;
if (log != null && debug > 1)
log.info("create script: " + script);
if (script.endsWith(".bat") || script.endsWith(".sh"))
return new ShellScript(script, id, process, args, timeout,
maxConcInvocations);
if (script.endsWith(".gv") || script.endsWith(".groovy"))
try
{
return new GroovyScript(script, id, process, args, timeout,
log, encoding, reload, maxConcInvocations);
}
catch (Throwable e)
{
if (log != null)
log.info("Error in createScript " + script, e);
}
return null;
}
示例2: GroovyScript
import io.netty.util.internal.logging.InternalLogger; //导入依赖的package包/类
/**
* Instantiates a new groovy script.
*
* @param script
* the script
* @param timeout
* @throws IOException
* @throws CompilationFailedException
* @throws IllegalAccessException
* @throws InstantiationException
* @throws ClassNotFoundException
*/
public GroovyScript(final String script, final String id,
final WrappedProcess process, final String[] args,
final int timeout, final InternalLogger logger, String encoding,
boolean reload, int maxConcInvocations)
throws CompilationFailedException, IOException,
InstantiationException, IllegalAccessException,
ClassNotFoundException
{
super(script, id, process, args, timeout, maxConcInvocations);
_reload = reload;
_encoding = encoding;
// let's call some method on an instance
_script = getScriptInstance(script, encoding);
binding = (Binding) _script.invokeMethod("getBinding", null);
binding.setVariable("args", args);
binding.setVariable("callCount", 0);
binding.setVariable("context", context);
if (process != null && logger == null)
_logger = process.getInternalWrapperLogger();
else
_logger = logger;
binding.setVariable("logger", _logger);
}
示例3: AHessianJmxClient
import io.netty.util.internal.logging.InternalLogger; //导入依赖的package包/类
public AHessianJmxClient(String discoveryName, int port, boolean debug,
InternalLogger logger) throws Exception
{
_discoveryName = discoveryName;
_port = port;
_debug = debug;
_logger = logger;
Map options = new HashMap();
options.put("sync", true);
options.put("timeout", (long) 5000);
final ChannelPipelineFactoryBuilder<MBeanServerConnection> builder = new ChannelPipelineFactoryBuilder<MBeanServerConnection>()
.serviceThreads(10).reconnect(10)
.rpcServiceInterface(MBeanServerConnection.class)
.serviceOptions(options);
builder.debug();
builder.serializerFactory(new JmxSerializerFactory());
final Set<String> channelOptions = new HashSet();
channelOptions.add("SO_REUSE");
channelOptions.add("TCP_NODELAY");
client = new DefaultClient<MBeanServerConnection>(
OioSocketChannel.class, builder, channelOptions);
}
示例4: logMethodCall
import io.netty.util.internal.logging.InternalLogger; //导入依赖的package包/类
public static void logMethodCall(Object object, String methodName, Object[] arguments) {
String className = getClassName(object);
String logname = "methodCalls." + className + "." + methodName;
InternalLogger objLog = InternalLoggerFactory.getInstance(logname);
if (!objLog.isTraceEnabled()) return;
StringBuilder msg = new StringBuilder(methodName);
msg.append("(");
if (arguments != null) {
for (int i = 0; i < arguments.length;) {
msg.append(normalizedValue(arguments[i]));
if (++i < arguments.length) {
msg.append(",");
}
}
}
msg.append(")");
objLog.log(InternalLogLevel.TRACE, className, msg.toString(), "called from MetaClass.invokeMethod");
}
示例5: init
import io.netty.util.internal.logging.InternalLogger; //导入依赖的package包/类
/**
* Init timeouts and the connection registry and start the netty IO server synchronously
*/
@Override
public void init(Container container) {
super.init(container);
try {
// Configure netty
InternalLoggerFactory.setDefaultFactory(new Slf4JLoggerFactory() {
@Override
public InternalLogger newInstance(String name) {
return new NettyInternalLogger(name);
}
});
ResourceLeakDetector.setLevel(CoreConstants.NettyConstants.RESOURCE_LEAK_DETECTION);
// Start server
startServer();
} catch (InterruptedException e) {
throw new StartupException("Could not start netty server", e);
}
}
示例6: init
import io.netty.util.internal.logging.InternalLogger; //导入依赖的package包/类
/**
* Configure netty and initialize related Components.
* Afterwards call {@link #initClient()} method to start the netty IO client asynchronously.
*/
@Override
public void init(Container container) {
super.init(container);
// Configure netty
InternalLoggerFactory.setDefaultFactory(new Slf4JLoggerFactory() {
@Override
public InternalLogger newInstance(String name) {
return new NettyInternalLogger(name);
}
});
ResourceLeakDetector.setLevel(CoreConstants.NettyConstants.RESOURCE_LEAK_DETECTION);
// And try to connect
isActive = true;
initClient();
// register BroadcastListener
IntentFilter filter = new IntentFilter();
filter.addAction(WifiManager.SUPPLICANT_CONNECTION_CHANGE_ACTION);
filter.addAction(WifiManager.NETWORK_STATE_CHANGED_ACTION);
filter.addAction(WifiManager.WIFI_STATE_CHANGED_ACTION);
filter.addAction(ConnectivityManager.CONNECTIVITY_ACTION);
requireComponent(ContainerService.KEY_CONTEXT).registerReceiver(broadcastReceiver, filter);
}
示例7: retain
import io.netty.util.internal.logging.InternalLogger; //导入依赖的package包/类
public void retain() {
if (counter.incrementAndGet() == 1) {
if (instanceCounter.getAndIncrement() > 0) {
InternalLogger instance = InternalLoggerFactory.getInstance(getClass());
instance.info("Initialized PauseDetectorWrapper more than once.");
}
pauseDetector = new SimplePauseDetector(TimeUnit.MILLISECONDS.toNanos(10), TimeUnit.MILLISECONDS.toNanos(10), 3);
Runtime.getRuntime().addShutdownHook(new Thread("ShutdownHook for SimplePauseDetector") {
@Override
public void run() {
if (pauseDetector != null) {
pauseDetector.shutdown();
}
}
});
}
}
示例8: setAhessianLogger
import io.netty.util.internal.logging.InternalLogger; //导入依赖的package包/类
public static void setAhessianLogger(final Logger log)
{
InternalLoggerFactory.setDefaultFactory(new InternalLoggerFactory()
{
@Override
public InternalLogger newInstance(String name)
{
return (InternalLogger) new JdkLogger(log, "ahessian-jmx");
}
});
}
示例9: Condition
import io.netty.util.internal.logging.InternalLogger; //导入依赖的package包/类
public Condition(YajswConfigurationImpl config,
WrappedProcess wrappedProcess, InternalLogger log)
{
_config = config;
_wp = wrappedProcess;
_log = log;
}
示例10: installLeakTrap
import io.netty.util.internal.logging.InternalLogger; //导入依赖的package包/类
public static LeakCounter installLeakTrap(){
try {
Field loggerField = ResourceLeakDetector.class.getDeclaredField("logger");
loggerField.setAccessible(true);
Field modifiersField = Field.class.getDeclaredField("modifiers");
modifiersField.setAccessible(true);
modifiersField.setInt(loggerField, loggerField.getModifiers() & ~Modifier.FINAL);
InternalLogger leakLogger = (InternalLogger)loggerField.get(null);
if (leakLogger instanceof LeakCounter) {
logger.debug("leak counter already installed.");
return (LeakCounter) leakLogger;
}else if (leakLogger != null){
logger.debug("monkeypatching leak counter into Netty leak detection.");
LeakTrap trap = new LeakTrap(leakLogger);
loggerField.set(null, trap);
return trap;
} else {
throw new NullPointerException("Netty ResourceLeakDetector had null logger reference?");
}
} catch (Throwable t){
t.printStackTrace();
logger.warn("Couldn't monkeypatch leak counter into netty leak detection, returning noop counter to tests.");
return new NoopLeakTrap();
}
}
示例11: newInstance
import io.netty.util.internal.logging.InternalLogger; //导入依赖的package包/类
@Override
public InternalLogger newInstance(final String name) {
return new Netty4InternalESLogger(name);
}
示例12: getLogger
import io.netty.util.internal.logging.InternalLogger; //导入依赖的package包/类
public static InternalLogger getLogger(Class<?> c)
{
return InternalLoggerFactory.getInstance(c);
}
示例13: setLogger
import io.netty.util.internal.logging.InternalLogger; //导入依赖的package包/类
public void setLogger(InternalLogger logger)
{
this.logger = logger;
}
示例14: setLogger
import io.netty.util.internal.logging.InternalLogger; //导入依赖的package包/类
public void setLogger(InternalLogger logger, int debug)
{
_logger = logger;
_debug = debug;
}
示例15: AHessianJmxServer
import io.netty.util.internal.logging.InternalLogger; //导入依赖的package包/类
public AHessianJmxServer(MBeanServer mbeanServer, String ipFilter,
String serviceDiscoveryName, int port, InternalLogger logger,
int debug, InetAddress address) throws Exception
{
// InternalLoggerFactory.setDefaultFactory(new SimpleLoggerFactory());
ChannelPipelineFactoryBuilder builder = new ChannelPipelineFactoryBuilder()
.serializerFactory(new JmxSerializerFactory())
.rpcServiceInterface(MBeanServerConnection.class)
.rpcServerService(mbeanServer).serviceThreads(10)
.ipFilter(ipFilter);
if (debug > 2)
builder.debug();
Set<String> channelOptions = new HashSet();
// channelOptions.add("SO_REUSE");
channelOptions.add("TCP_NODELAY");
int serverPort = port;
DefaultServer server = new DefaultServer(OioServerSocketChannel.class,
builder, channelOptions, serverPort, address);
server.start();
Channel channel = server.getChannel();
Executor executor = Executors.newCachedThreadPool();
if (serverPort == 0)
serverPort = ((InetSocketAddress) channel.localAddress()).getPort();
if (debug > 2 && logger != null)
logger.info("ahessian jmx service bound to port " + serverPort);
DiscoveryServer discovery = new DiscoveryServer();
discovery.setDebug(debug > 2);
discovery.setLogger(logger);
// allow discovery only from localhost. other computers will be ignored
discovery.setIpSet(new IpFilterRuleList("+n:localhost, -n:*"));
discovery.setName(serviceDiscoveryName);
discovery.setPort(serverPort);
discovery.init();
}