public final void dispatch ( AbstractMessage message ) throws JMSException { // Security LocalConnection conn = ( LocalConnection ) getConnection ( ) ; if ( conn . isSecurityEnabled ( ) ) { Destination destination = message . getJMSDestination ( ) ; if ( destination instanceof Queue ) { String queueName = ( ( Queue ) destination ) . getQueueName ( ) ; if ( conn . isRegisteredTemporaryQueue ( queueName ) ) { // OK, temporary destination } else if ( queueName . equals ( FFMQConstants . ADM_REQUEST_QUEUE ) ) { conn . checkPermission ( Resource . SERVER , Action . REMOTE_ADMIN ) ; } else if ( queueName . equals ( FFMQConstants . ADM_REPLY_QUEUE ) ) { // Only the internal admin thread can produce on this queue if ( conn . getSecurityContext ( ) != null ) throw new FFMQException ( "Access denied to administration queue " + queueName , "ACCESS_DENIED" ) ; } else { // Standard queue conn . checkPermission ( destination , Action . PRODUCE ) ; } } else if ( destination instanceof Topic ) { String topicName = ( ( Topic ) destination ) . getTopicName ( ) ; if ( conn . isRegisteredTemporaryTopic ( topicName ) ) { // OK, temporary destination } else { // Standard topic conn . checkPermission ( destination , Action . PRODUCE ) ; } } else throw new InvalidDestinationException ( "Unsupported destination : " + destination ) ; } if ( debugEnabled ) log . debug ( this + " [PUT] in " + message . getJMSDestination ( ) + " - " + message ) ; externalAccessLock . readLock ( ) . lock ( ) ; try { checkNotClosed ( ) ; pendingPuts . add ( message ) ; if ( ! transacted ) commitUpdates ( false , null , true ) ; // FIXME Async commit ? } finally { externalAccessLock . readLock ( ) . unlock ( ) ; } }
Called from producers when sending a message