private void removeAsyncListener ( ) throws JMSException { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( this , tc , "removeAsyncListener" ) ; // if the consumer is null, there is nothing to do if ( consumer != null ) { try { // stop the coreConsumerSession coreConsumerSession . stop ( ) ; // remove the callback coreConsumerSession . deregisterAsynchConsumerCallback ( ) ; // restart the coreConsumerSession if necessary if ( session . getState ( ) == STARTED ) { // Do not deliver message immediately on start. coreConsumerSession . start ( false ) ; } // null out our consumer instance consumer = null ; } catch ( SIIncorrectCallException sice ) { // No FFDC code needed // stop/start methods ok for default message. deregisterAsynchConsumerCallback can throw // an SIIincorrectCallException is session is not stopped, but this shouldn't be possible // with the code above. // d238447 FFDC review. See comment in next catch block. Generate FFDC. throw ( JMSException ) JmsErrorUtils . newThrowable ( JMSException . class , "EXCEPTION_RECEIVED_CWSIA0085" , new Object [ ] { sice , "JmsMsgConsumerImpl.removeAsyncListener" } , sice , "JmsMsgConsumerImpl.removeASyncListener#1" , this , tc ) ; } catch ( SIException sice ) { // No FFDC code needed // stop/start methods ok for default message. deregisterAsynchConsumerCallback can throw // an SIIincorrectCallException is session is not stopped, but this shouldn't be possible // with the code above. // d238447 FFDC review. We are dealing with: // SISessionUnavailableException, SISessionDroppedException, // SIConnectionUnavailableException, SIConnectionDroppedException, // SIResourceException, SIConnectionLostException; // SIIncorrectCallException // Of these SIIncorrectCallE is probably the only one that warrents FFDC at this level, // so a new catch block for IncorrectCallE added above, no FFDCs here. throw ( JMSException ) JmsErrorUtils . newThrowable ( JMSException . class , "EXCEPTION_RECEIVED_CWSIA0085" , new Object [ ] { sice , "JmsMsgConsumerImpl.removeAsyncListener" } , sice , null , // null probeId = no FFDC. this , tc ) ; } } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( this , tc , "removeAsyncListener" ) ; }
This method is used to remove an existing asynchronous consumer from the core consumer object and reset the JMS consumer back to sychronous receipt mode .