use of com.navercorp.pinpoint.profiler.context.provider.ShutdownHookRegisterProvider in project pinpoint by naver.
the class DefaultAgent method registerStopHandler.
@Override
public void registerStopHandler() {
if (applicationContext instanceof DefaultApplicationContext) {
logger.info("registerStopHandler");
DefaultApplicationContext context = (DefaultApplicationContext) applicationContext;
ShutdownHookRegisterProvider shutdownHookRegisterProvider = context.getShutdownHookRegisterProvider();
ShutdownHookRegister shutdownHookRegister = shutdownHookRegisterProvider.get();
PinpointThreadFactory pinpointThreadFactory = new PinpointThreadFactory("Pinpoint-shutdown-hook", false);
Thread shutdownThread = pinpointThreadFactory.newThread(new Runnable() {
@Override
public void run() {
logger.info("stop() started. threadName:" + Thread.currentThread().getName());
DefaultAgent.this.stop();
}
});
shutdownHookRegister.register(shutdownThread);
}
}
use of com.navercorp.pinpoint.profiler.context.provider.ShutdownHookRegisterProvider in project pinpoint by naver.
the class ConfigModule method bindShutdownHook.
private void bindShutdownHook(ContextConfig contextConfig) {
// for lazy init
ShutdownHookRegisterProvider instance = new ShutdownHookRegisterProvider(contextConfig);
bind(ShutdownHookRegisterProvider.class).toInstance(instance);
}
Aggregations