protected void createDestination ( ConnectionContext context , Endpoint endpoint ) throws JMSException { if ( endpoint == null ) { throw new IllegalStateException ( "Endpoint is null" ) ; } if ( context == null ) { throw new IllegalStateException ( "The context is null" ) ; } Session session = context . getSession ( ) ; if ( session == null ) { throw new IllegalStateException ( "The context had a null session" ) ; } Destination dest ; if ( endpoint . getType ( ) == Endpoint . Type . QUEUE ) { if ( endpoint . isTemporary ( ) ) { dest = session . createTemporaryQueue ( ) ; } else { dest = session . createQueue ( getDestinationName ( endpoint ) ) ; } } else { if ( endpoint . isTemporary ( ) ) { dest = session . createTemporaryTopic ( ) ; } else { dest = session . createTopic ( getDestinationName ( endpoint ) ) ; } } context . setDestination ( dest ) ; }
Creates a destination using the context s session . The destination correlates to the given named queue or topic .