private SIBusMessage internalReceiveNoWait ( SITransaction tran , Reliability unrecoverableReliability , SIDestinationAddress destAddr , DestinationType destinationType , SelectionCriteria criteria , Reliability reliability , String alternateUser , boolean system ) throws SIConnectionDroppedException , SIConnectionUnavailableException , SIConnectionLostException , SILimitExceededException , SINotAuthorizedException , SIDestinationLockedException , SITemporaryDestinationNotFoundException , SIResourceException , SIErrorException , SIIncorrectCallException , SINotPossibleInCurrentConfigurationException { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( tc , "internalReceiveNoWait" , new Object [ ] { destAddr , alternateUser , destinationType , criteria , tran , reliability , unrecoverableReliability , Boolean . valueOf ( system ) } ) ; if ( destAddr == null ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "internalReceiveNoWait" , "SIIncorrectCallException - null destAddr" ) ; throw new SIIncorrectCallException ( nls_cwsir . getFormattedMessage ( "RECEIVE_NO_WAIT_CWSIR0091" , null , null ) ) ; } SIBusMessage message = null ; if ( tran != null && ! ( ( TransactionCommon ) tran ) . isAlive ( ) ) { SIIncorrectCallException e = new SIIncorrectCallException ( nls . getFormattedMessage ( "TRANSACTION_RECEIVE_USAGE_ERROR_CWSIP0777" , new Object [ ] { destAddr } , null ) ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "internalReceiveNoWait" , e ) ; throw e ; } try { //TODO there may be some optimization we can do here to just receive one message //Create a consumer session ConsumerSession session = internalCreateConsumerSession ( destAddr , alternateUser , destinationType , criteria , reliability , false , //enableReadAhead false , //noLocal false , //forwardScanning system , unrecoverableReliability , false , // bifurcatable false , // mqInterop true , // ignoreIntialIndoubts false // gatherMessages ) ; session . start ( false ) ; //receive one message message = session . receiveNoWait ( tran ) ; //close the session session . close ( ) ; } catch ( SISessionUnavailableException e ) { // No FFDC code needed SibTr . exception ( tc , e ) ; // If any of these calls failed due to being closed the connection // must have been closed. Call checkNotClosed() to force out the // correct exception. checkNotClosed ( ) ; // Just in case the connection isn't closed we better re-throw the // original exception. if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "internalReceiveNoWait" , e ) ; throw new SIMPConnectionUnavailableException ( nls_cwsik . getFormattedMessage ( "DELIVERY_ERROR_SIRC_22" , // OBJECT_CLOSED_ERROR_CWSIP0091 new Object [ ] { _messageProcessor . getMessagingEngineName ( ) } , null ) , e ) ; } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "internalReceiveNoWait" , message ) ; return message ; }
Internal implementation for receiving no wait