nl_tokens: Handles an event from OSGi and places it in the appropriate queue .
pl_tokens: public void handleEvent ( Event event ) { String topic = event . getTopic ( ) ; LOGGER . debug ( "Got Event {} {} " , event , handlers ) ; Collection < IndexingHandler > contentIndexHandler = handlers . get ( topic ) ; if ( contentIndexHandler != null && contentIndexHandler . size ( ) > 0 ) { try { int ttl = Utils . toInt ( event . getProperty ( TopicIndexer . TTL ) , Integer . MAX_VALUE ) ; for ( IndexingHandler indexingHandler : contentIndexHandler ) { if ( indexingHandler instanceof QoSIndexHandler ) { ttl = Math . <mask> ( ttl , Utils . defaultMax ( ( ( QoSIndexHandler ) indexingHandler ) . getTtl ( event ) ) ) ; } } QueueManager q = null ; // queues is ordered by ascending ttl, so the fastest queue is queues[0], // if the ttl is less that that, we can't satisfy it, so we will put it // in the fastest queue if ( ttl < queues [ 0 ] . batchDelay ) { LOGGER . warn ( "Unable to satisfy TTL of {} on event {}, posting to the highest priority queue. " + "If this message is logged a lot please adjust the queues or change the event ttl to something that can be satisfied. " + "Filling the highest priority queue is counter productive. " , ttl , event ) ; queues [ 0 ] . saveEvent ( event ) ; } else { for ( QueueManager qm : queues ) { if ( ttl < qm . batchDelay ) { q . saveEvent ( event ) ; q = null ; break ; } q = qm ; } if ( q != null ) { q . saveEvent ( event ) ; } } } catch ( IOException e ) { LOGGER . warn ( e . getMessage ( ) , e ) ; } } }