@ Override public void run ( ) { try { MDC . put ( "name" , name ) ; log . info ( "Starting {}..." , name ) ; // Get a connection to the broker String brokerUrl = globalConfig . getString ( ActiveMQConnectionFactory . DEFAULT_BROKER_BIND_URL , "messaging" , "url" ) ; ActiveMQConnectionFactory connectionFactory = new ActiveMQConnectionFactory ( brokerUrl ) ; connection = connectionFactory . createConnection ( ) ; session = connection . createSession ( false , Session . AUTO_ACKNOWLEDGE ) ; consumer = session . createConsumer ( session . createQueue ( QUEUE_ID ) ) ; consumer . setMessageListener ( this ) ; connection . start ( ) ; // Solr solr = initCore ( "solr" ) ; // Timeout 'tick' for buffer (10s) timer = new Timer ( "SolrWrapper:" + toString ( ) , true ) ; timer . scheduleAtFixedRate ( new TimerTask ( ) { @ Override public void run ( ) { checkTimeout ( ) ; } } , 0 , 10000 ) ; } catch ( JMSException ex ) { log . error ( "Error starting message thread!" , ex ) ; } }
Start thread running