Buggy code:
public class DataSourceDisable implements OperationStepHandler { static final DataSourceDisable INSTANCE = new DataSourceDisable ( ) ; public void execute ( OperationContext context , ModelNode operation ) { final ModelNode model = context . readResourceForUpdate ( EMPTY_ADDRESS ) . getModel ( ) ; model . get ( ENABLED ) . set ( false ) ; if ( ( context . getType ( ) ) == ( Type . SERVER ) ) { context . addStep ( new OperationStepHandler ( ) { public void execute ( final OperationContext context , ModelNode operation ) throws OperationFailedException { final ModelNode address = operation . require ( OP_ADDR ) ; final String dsName = PathAddress . pathAddress ( address ) . getLastElement ( ) . getValue ( ) ; final String jndiName = model . get ( Constants . JNDINAME . getName ( ) ) . asString ( ) ; final ServiceRegistry registry = context . getServiceRegistry ( true ) ; <START_BUG> final ServiceName dataSourceServiceName = SERVICE_NAME_BASE . append ( dsName ) ; <END_BUG> final ServiceController < ? > dataSourceController = registry . getService ( dataSourceServiceName ) ; if ( dataSourceController != null ) { if ( UP . equals ( dataSourceController . getState ( ) ) ) { dataSourceController . setMode ( NEVER ) ; } else { throw new OperationFailedException ( new ModelNode ( ) . set ( ConnectorMessages . MESSAGES . serviceNotEnabled ( "Data-source" , dsName ) ) ) ; } } else { throw new OperationFailedException ( new ModelNode ( ) . set ( ConnectorMessages . MESSAGES . serviceNotAvailable ( "Data-source" , dsName ) ) ) ; } final ServiceName referenceServiceName = DataSourceReferenceFactoryService . SERVICE_NAME_BASE . append ( dsName ) ; final ServiceController < ? > referenceController = registry . getService ( referenceServiceName ) ; if ( referenceController != null ) { referenceController . setMode ( REMOVE ) ; } final ServiceName binderServiceName = ContextNames . bindInfoFor ( jndiName ) . getBinderServiceName ( ) ; final ServiceController < ? > binderController = registry . getService ( binderServiceName ) ; if ( binderController != null ) { binderController . setMode ( REMOVE ) ; } final ServiceName dataSourceConfigServiceName = DataSourceConfigService . SERVICE_NAME_BASE . append ( dsName ) ; final ServiceController < ? > dataSourceConfigController = registry . getService ( dataSourceConfigServiceName ) ; final List < ServiceName > serviceNames = registry . getServiceNames ( ) ; final ServiceName xaDataSourceConfigServiceName = XADataSourceConfigService . SERVICE_NAME_BASE . append ( dsName ) ; final ServiceController < ? > xaDataSourceConfigController = registry . getService ( xaDataSourceConfigServiceName ) ; for ( ServiceName name : serviceNames ) { if ( dataSourceConfigServiceName . append ( "connetion-properties" ) . isParentOf ( name ) ) { final ServiceController < ? > connProperyController = registry . getService ( name ) ; if ( connProperyController != null ) { if ( UP . equals ( connProperyController . getState ( ) ) ) { connProperyController . setMode ( NEVER ) ; } else { throw new OperationFailedException ( new ModelNode ( ) . set ( ConnectorMessages . MESSAGES . serviceAlreadyStarted ( "Data-source.connectionProperty" , name ) ) ) ; } } else { throw new OperationFailedException ( new ModelNode ( ) . set ( ConnectorMessages . MESSAGES . serviceNotAvailable ( "Data-source.connectionProperty" , name ) ) ) ; } } if ( xaDataSourceConfigServiceName . append ( "xa-datasource-properties" ) . isParentOf ( name ) ) { final ServiceController < ? > xaConfigProperyController = registry . getService ( name ) ; if ( xaConfigProperyController != null ) { if ( UP . equals ( xaConfigProperyController . getState ( ) ) ) { xaConfigProperyController . setMode ( NEVER ) ; } else { throw new OperationFailedException ( new ModelNode ( ) . set ( ConnectorMessages . MESSAGES . serviceAlreadyStarted ( "Data-source.xa-config-property" , name ) ) ) ; } } else { throw new OperationFailedException ( new ModelNode ( ) . set ( ConnectorMessages . MESSAGES . serviceNotAvailable ( "Data-source.xa-config-property" , name ) ) ) ; } } } if ( xaDataSourceConfigController != null ) { xaDataSourceConfigController . setMode ( REMOVE ) ; } if ( dataSourceConfigController != null ) { dataSourceConfigController . setMode ( REMOVE ) ; } context . completeStep ( ) ; } } , RUNTIME ) ; } context . completeStep ( ) ; } }

Fix:
final ServiceName dataSourceServiceName = SERVICE_NAME_BASE . append ( jndiName ) ;