void addtoAsysncSendQueue ( JmsMsgProducerImpl msgProducer , CompletionListener cListner , Message msg , int sendMethodType , Object [ ] params ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( this , tc , "addtoAsysncSendQueue" , new Object [ ] { msgProducer , cListner , cListner , sendMethodType , params } ) ; _asyncSendQueue . offer ( new AysncSendDetails ( msgProducer , cListner , msg , sendMethodType , params ) ) ; if ( null == _asyncSendRunThread ) { //initialize asyncSendRunThread _asyncSendRunThread = new Thread ( new AsyncSendTask ( ) ) ; /** * setting _asyncSendRunThread as daemon thread. So when all non-daemon threads are complete, this thread would get terminated. * So in case if thin client main (alonw with non-daemon threads)are exited, the prgoramm will be exited even though this thread * is doing any back ground work. The application has to esnure to wait till all async send work is done before exiting the main. */ _asyncSendRunThread . setDaemon ( true ) ; } //when AsyncSend is in progess, the message object should not get accessed by anyone other than SIB // inusebyAsyncSend and AsyncThreadId are used to restrict access for Message object. if ( ( msg != null ) && msg instanceof JmsMessageImpl ) { ( ( JmsMessageImpl ) msg ) . setAsyncSendInProgress ( true ) ; } if ( ! _asyncSendRunThread . isAlive ( ) ) { //The asyncRunThread is not running... then kick off try { _asyncSendRunThread . start ( ) ; } catch ( Exception e ) { //absorb the exception and add to trace. if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) SibTr . debug ( tc , "addtoAsysncSendQueue: starting asyncRunThread failed" , e ) ; } } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( this , tc , "addtoAsysncSendQueue" ) ; }
Adds AsynSend operation details to the Queue . This function would get called only in case of non - managed environements .