void checkSynchronousUsage ( String methodName ) throws JMSException { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( this , tc , "checkSynchronousUsage" , methodName ) ; // Generate an exception if the session is in async mode, and the call // has not originated from within onMessage if ( isAsync ( ) && ! Thread . holdsLock ( asyncDeliveryLock ) ) { throw ( JMSException ) JmsErrorUtils . newThrowable ( javax . jms . IllegalStateException . class , "ASYNC_IN_PROGRESS_CWSIA0082" , new Object [ ] { methodName } , tc ) ; } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( this , tc , "checkSynchronousUsage" ) ; }
Utility method to generate JMSExceptions if a synchronous method is called on an asynchronous session . This method should be called at the beginning of every method that should not work if the owning session is being used for asynchronous receipt .