Buggy code:
public class BoundedQueueThreadPoolAdd implements ModelAddOperationHandler { static final OperationHandler INSTANCE = new BoundedQueueThreadPoolAdd ( ) ; @ Override public OperationResult execute ( final OperationContext context , final ModelNode operation , final ResultHandler resultHandler ) { final BoundedOperationParameters params = ThreadsSubsystemThreadPoolOperationUtils . parseBoundedThreadPoolOperationParameters ( operation ) ; final ModelNode model = context . getSubModel ( ) ; model . get ( NAME ) . set ( params . getName ( ) ) ; if ( ( params . getThreadFactory ( ) ) != null ) { model . get ( CommonAttributes . THREAD_FACTORY ) . set ( params . getThreadFactory ( ) ) ; } if ( ( ( params . getProperties ( ) ) != null ) && ( ( params . getProperties ( ) . asList ( ) . size ( ) ) > 0 ) ) { model . get ( CommonAttributes . PROPERTIES ) . set ( params . getProperties ( ) ) ; } if ( ( params . getMaxThreads ( ) ) != null ) { model . get ( CommonAttributes . MAX_THREADS ) . set ( operation . get ( CommonAttributes . MAX_THREADS ) ) ; } if ( ( params . getKeepAliveTime ( ) ) != null ) { model . get ( CommonAttributes . KEEPALIVE_TIME ) . set ( operation . get ( CommonAttributes . KEEPALIVE_TIME ) ) ; } model . get ( CommonAttributes . BLOCKING ) . set ( params . isBlocking ( ) ) ; if ( ( params . getHandoffExecutor ( ) ) != null ) { model . get ( CommonAttributes . HANDOFF_EXECUTOR ) . set ( params . getHandoffExecutor ( ) ) ; } model . get ( CommonAttributes . ALLOW_CORE_TIMEOUT ) . set ( params . isAllowCoreTimeout ( ) ) ; if ( ( params . getQueueLength ( ) ) != null ) { model . get ( CommonAttributes . QUEUE_LENGTH ) . set ( operation . get ( CommonAttributes . QUEUE_LENGTH ) ) ; } if ( ( params . getCoreThreads ( ) ) != null ) { model . get ( CommonAttributes . CORE_THREADS ) . set ( operation . get ( CommonAttributes . CORE_THREADS ) ) ; } final ModelNode compensating = Util . getResourceRemoveOperation ( params . getAddress ( ) ) ; if ( ( context . getRuntimeContext ( ) ) != null ) { context . getRuntimeContext ( ) . setRuntimeTask ( new RuntimeTask ( ) { public void execute ( RuntimeTaskContext context ) throws OperationFailedException { ServiceTarget target = context . getServiceTarget ( ) ; final ServiceName serviceName = ThreadsServices . executorName ( params . getName ( ) ) ; final BoundedQueueThreadPoolService service = new BoundedQueueThreadPoolService ( params . getCoreThreads ( ) . getScaledCount ( ) , params . getMaxThreads ( ) . getScaledCount ( ) , params . getQueueLength ( ) . getScaledCount ( ) , params . isBlocking ( ) , params . getKeepAliveTime ( ) , params . isAllowCoreTimeout ( ) ) ; final ServiceBuilder < Executor > serviceBuilder = target . addService ( serviceName , service ) ; <START_BUG> ThreadsSubsystemThreadPoolOperationUtils . addThreadFactoryDependency ( params . getThreadFactory ( ) , serviceName , serviceBuilder , service . getThreadFactoryInjector ( ) , target ) ; <END_BUG> serviceBuilder . addListener ( new ResultHandler . ServiceStartListener ( resultHandler ) ) ; serviceBuilder . install ( ) ; } } ) ; } else { resultHandler . handleResultComplete ( ) ; } return new org . jboss . as . controller . BasicOperationResult ( compensating ) ; } }

Fix:
ThreadsSubsystemThreadPoolOperationUtils . addThreadFactoryDependency ( params . getThreadFactory ( ) , serviceName , serviceBuilder , service . getThreadFactoryInjector ( ) , target , ( ( params . getName ( ) ) + "-threads" ) ) ;