private BrowserSession createBrowserSession ( SIDestinationAddress destinationAddress , DestinationType destinationType , SelectionCriteria criteria , boolean system , String alternateUser , boolean gatherMessages ) throws SIConnectionUnavailableException , SIConnectionDroppedException , SIErrorException , SITemporaryDestinationNotFoundException , SIResourceException , SINotPossibleInCurrentConfigurationException , SISelectorSyntaxException , SIDiscriminatorSyntaxException { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( tc , "createBrowserSession" , new Object [ ] { destinationAddress , destinationType , criteria , Boolean . valueOf ( gatherMessages ) } ) ; // Finding a destination could take some time so we don't have the // connection locked (on closed) when we do this. DestinationHandler destination = _destinationManager . getDestination ( ( JsDestinationAddress ) destinationAddress , false ) ; // Check that this is the correct destination type checkDestinationType ( destinationType , destinationAddress , destination , system ) ; if ( destination . getDestinationType ( ) == DestinationType . SERVICE ) { //Cant browse a service destination if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "createBrowserSession" , "cannot browse a service destination" ) ; throw new SINotPossibleInCurrentConfigurationException ( nls . getFormattedMessage ( "INVALID_DESTINATION_USAGE_ERROR_CWSIP0022" , new Object [ ] { destination . getName ( ) , _messageProcessor . getMessagingEngineName ( ) } , null ) ) ; } // Check that this temporary destination was created by this connection. checkTemporary ( destination , false ) ; // Check authority to browse this destination // If security is disabled then we'll bypass the check checkDestinationAuthority ( destination , MessagingSecurityConstants . OPERATION_TYPE_BROWSE , null ) ; //if the destination turns out to be pub-sub then that doesn't make sense //so we'll just set it back to null if ( destination . isPubSub ( ) ) { destination = null ; } BrowserSession browser = null ; // Synchronize on the close object, we don't want the connection closing // while we try to add the browser. synchronized ( this ) { // See if this connection has been closed checkNotClosed ( ) ; //create a browser session with the given destination //if the destination was null - it was pub sub - this will create a browser //session which never returns any messages browser = new BrowserSessionImpl ( destination , criteria , this , destinationAddress , gatherMessages ) ; synchronized ( _browsers ) { //store a reference _browsers . add ( browser ) ; } } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "createBrowserSession" , browser ) ; return browser ; }
Creates the Browser session .