@ SuppressWarnings ( "PMD.ConfusingTernary" ) private void initMessageQueue ( final CommonProperties commonProps ) { try { final String messageClassName = commonProps . getMessageQueueClassName ( ) ; // this would be harder to read when following PMD's advice - ignoring the PMD warning if ( ! commonProps . isMessageQueueEnabled ( ) ) { final String error = "Message queue has been disabled in the JAAS configuration" ; LOG . info ( error ) ; } else if ( messageClassName == null ) { final String error = "Message queue has been enabled in the JAAS configuration, " + "but no message queue class has been configured" ; LOG . error ( error ) ; throw new IllegalStateException ( error ) ; } else { if ( commonProps . isMessageQueueSingleton ( ) ) { LOG . debug ( "Requesting singleton message class instance of '" + messageClassName + "' from the message factory" ) ; this . messageQ = MessageQFactory . getSingleton ( messageClassName , commonProps ) ; } else { LOG . debug ( "Requesting non-singleton message class instance of '" + messageClassName + "' from the message factory" ) ; this . messageQ = MessageQFactory . getInstance ( messageClassName , commonProps ) ; } } } catch ( FactoryException e ) { final String error = "The message class cannot be instantiated. This is most likely a configuration" + " problem. Is the configured class available in the classpath?" ; LOG . error ( error , e ) ; throw new IllegalStateException ( error , e ) ; } }
Initialize the instance - global message queue object