Buggy code:
public abstract class PoolOperations implements OperationStepHandler { private final PoolOperations . PoolMatcher matcher ; protected PoolOperations ( PoolOperations . PoolMatcher matcher ) { } public void execute ( OperationContext context , ModelNode operation ) throws OperationFailedException { final PathAddress address = PathAddress . pathAddress ( operation . require ( OP_ADDR ) ) ; final String jndiName ; if ( address . getElement ( 0 ) . getKey ( ) . equals ( DEPLOYMENT ) ) { jndiName = address . getLastElement ( ) . getValue ( ) ; } else { jndiName = Util . getJndiName ( context . readModel ( EMPTY_ADDRESS ) ) ; } if ( ( context . getType ( ) ) == ( Type . SERVER ) ) { context . addStep ( new OperationStepHandler ( ) { public void execute ( OperationContext context , ModelNode operation ) throws OperationFailedException { <START_BUG> final ServiceController < ? > managementRepoService = context . getServiceRegistry ( false ) . getService ( MANAGEMENT_REPOSISTORY_SERVICE ) ; <END_BUG> if ( managementRepoService != null ) { ModelNode operationResult = null ; try { final ManagementRepository repository = ( ( ManagementRepository ) ( managementRepoService . getValue ( ) ) ) ; final List < Pool > pools = matcher . match ( jndiName , repository ) ; if ( pools . isEmpty ( ) ) { throw ConnectorMessages . MESSAGES . failedToMatchPool ( jndiName ) ; } for ( Pool pool : pools ) { operationResult = invokeCommandOn ( pool ) ; } } catch ( Exception e ) { throw new OperationFailedException ( new ModelNode ( ) . set ( ConnectorMessages . MESSAGES . failedToInvokeOperation ( e . getLocalizedMessage ( ) ) ) ) ; } if ( operationResult != null ) { context . getResult ( ) . set ( operationResult ) ; } } context . completeStep ( ) ; } } , RUNTIME ) ; } context . completeStep ( ) ; } protected abstract ModelNode invokeCommandOn ( Pool pool ) throws Exception { } public static class FlushIdleConnectionInPool extends PoolOperations { public static PoolOperations . FlushIdleConnectionInPool DS_INSTANCE = new PoolOperations . FlushIdleConnectionInPool ( new PoolOperations . DsPoolMatcher ( ) ) ; public static PoolOperations . FlushIdleConnectionInPool RA_INSTANCE = new PoolOperations . FlushIdleConnectionInPool ( new PoolOperations . RaPoolMatcher ( ) ) ; protected FlushIdleConnectionInPool ( PoolOperations . PoolMatcher matcher ) { } @ Override protected ModelNode invokeCommandOn ( Pool pool ) { } } public static class FlushAllConnectionInPool extends PoolOperations { public static PoolOperations . FlushAllConnectionInPool DS_INSTANCE = new PoolOperations . FlushAllConnectionInPool ( new PoolOperations . DsPoolMatcher ( ) ) ; public static PoolOperations . FlushAllConnectionInPool RA_INSTANCE = new PoolOperations . FlushAllConnectionInPool ( new PoolOperations . RaPoolMatcher ( ) ) ; protected FlushAllConnectionInPool ( PoolOperations . PoolMatcher matcher ) { } @ Override protected ModelNode invokeCommandOn ( Pool pool ) { } } public static class TestConnectionInPool extends PoolOperations { public static PoolOperations . TestConnectionInPool DS_INSTANCE = new PoolOperations . TestConnectionInPool ( new PoolOperations . DsPoolMatcher ( ) ) ; public static PoolOperations . TestConnectionInPool RA_INSTANCE = new PoolOperations . TestConnectionInPool ( new PoolOperations . RaPoolMatcher ( ) ) ; protected TestConnectionInPool ( PoolOperations . PoolMatcher matcher ) { } @ Override protected ModelNode invokeCommandOn ( Pool pool ) throws Exception { } } private static interface PoolMatcher { List < Pool > match ( String jndiName , ManagementRepository repository ) { } } private static class DsPoolMatcher implements PoolOperations . PoolMatcher { public List < Pool > match ( String jndiName , ManagementRepository repository ) { } } private static class RaPoolMatcher implements PoolOperations . PoolMatcher { public List < Pool > match ( String jndiName , ManagementRepository repository ) { } } }

Fix:
final ServiceController < ? > managementRepoService = context . getServiceRegistry ( false ) . getService ( MANAGEMENT_REPOSITORY_SERVICE ) ;