@Override
 public void handleEvent(EventContext context) {
   timer.purge(); // Get rid of finished tasks
   if (context instanceof GarbageCollectContext) {
     GarbageCollectContext gcc = (GarbageCollectContext) context;
     if (gcc.getDelay() > 0) {
       final long delay = gcc.getDelay();
       gcc.setDelay(0);
       scheduleDGC(gcc, delay);
     } else {
       gcRunning = true;
       collector.doGC(gcc.getType());
       gcRunning = false;
       // We want to let inline gc clean stuff up (quickly) before another young/full gc happens
       garbageCollectionManager.scheduleInlineGarbageCollectionIfNecessary();
       if (gcc instanceof PeriodicGarbageCollectContext) {
         // Rearm and requeue if it's a periodic gc.
         PeriodicGarbageCollectContext pgcc = (PeriodicGarbageCollectContext) gcc;
         pgcc.reset();
         gcSink.add(pgcc);
       }
     }
   } else if (context instanceof InlineGCContext) {
     garbageCollectionManager.inlineCleanup();
   } else {
     throw new AssertionError("Unknown context type: " + context.getClass().getName());
   }
 }
 @Override
 protected void initialize(ConfigurationContext context) {
   super.initialize(context);
   ServerConfigurationContext scc = (ServerConfigurationContext) context;
   collector = scc.getObjectManager().getGarbageCollector();
   collector.setState(gcState);
   garbageCollectionManager = scc.getGarbageCollectionManager();
   gcSink = scc.getStage(ServerConfigurationContext.GARBAGE_COLLECT_STAGE).getSink();
 }