Code example for BlockingQueue

Methods: take

0
    userLogCleaner.start();
    monitorLogEvents.start();
  } 
 
  protected void monitor() throws Exception { 
    UserLogEvent event = userLogEvents.take();
    processEvent(event);
  } 
 
  protected void processEvent(UserLogEvent event) throws IOException {
    if (event instanceof JvmFinishedEvent) {
      doJvmFinishedAction((JvmFinishedEvent) event);
    } else if (event instanceof JobCompletedEvent) {
      doJobCompletedAction((JobCompletedEvent) event);
    } else if (event instanceof JobStartedEvent) {
      doJobStartedAction((JobStartedEvent) event);
    } else if (event instanceof DeleteJobEvent) {
      doDeleteJobAction((DeleteJobEvent) event);
    } else {  
      LOG.warn("Unknown event " + event.getEventType() + " passed.");
    }