public void onApplicationEvent(ApplicationEvent event) {
   if (startedDeployedWar(event) || startedEmbeddedServer(event)) {
     registrator.register();
   } else if (admin.isAutoDeregistration() && event instanceof ContextClosedEvent) {
     registrator.deregister();
   }
 }
 @Override
 public void onApplicationEvent(ApplicationEvent event) {
   if (startedDeployedWar(event) || startedEmbeddedServer(event)) {
     executor.execute(
         new Runnable() {
           @Override
           public void run() {
             registrator.register();
           }
         });
   } else if (admin.isAutoDeregistration() && event instanceof ContextClosedEvent) {
     registrator.deregister();
   }
 }