Buggy code:
public abstract class AbstractModelControllerClient implements ModelControllerClient , ManagementOperationHandler { private final Map < Integer , AbstractModelControllerClient . ExecuteRequestContext > activeRequests = Collections . synchronizedMap ( new HashMap < Integer , AbstractModelControllerClient . ExecuteRequestContext > ( ) ) ; protected final ExecutorService executor = Executors . newCachedThreadPool ( ) ; final Logger log = Logger . getLogger ( "org.jboss.as.controller.client" ) ; @ Override public void close ( ) throws IOException { } @ Override public ModelNode execute ( ModelNode operation ) throws IOException { } @ Override public ModelNode execute ( Operation operation ) throws IOException { } @ Override public ModelNode execute ( ModelNode operation , OperationMessageHandler messageHandler ) throws IOException { } @ Override public ModelNode execute ( Operation operation , OperationMessageHandler messageHandler ) throws IOException { } @ Override public AsyncFuture < ModelNode > executeAsync ( ModelNode operation , OperationMessageHandler messageHandler ) { } @ Override public AsyncFuture < ModelNode > executeAsync ( Operation operation , OperationMessageHandler messageHandler ) { } @ Override public ManagementRequestHandler getRequestHandler ( final byte id ) { } protected abstract ManagementClientChannelStrategy getClientChannelStrategy ( ) throws IOException , URISyntaxException { } private ModelNode executeSynch ( ModelNode operation , OperationAttachments attachments , OperationMessageHandler messageHandler ) throws IOException { } private AsyncFuture < ModelNode > executeAsync ( ModelNode operation , OperationAttachments attachments , OperationMessageHandler messageHandler ) { } private class ExecuteRequest extends ManagementRequest < ModelNode > { private final AbstractModelControllerClient . ExecuteRequestContext executeRequestContext ; private final ModelNode operation ; private final boolean async ; ExecuteRequest ( final int batchId , final boolean async , final ModelNode operation , final OperationMessageHandler messageHandler , final OperationAttachments attachments ) { } @ Override protected byte getRequestCode ( ) { } protected CloseHandler < Channel > getRequestCloseHandler ( ) { } @ Override protected void writeRequest ( final int protocolVersion , final FlushableDataOutput output ) throws IOException { } protected ManagementResponseHandler < ModelNode > getResponseHandler ( ) { return new ManagementResponseHandler < ModelNode > ( ) { @ Override protected ModelNode readResponse ( final DataInput input ) throws IOException { log . tracef ( "Client<seq2seq4repair_space>reading<seq2seq4repair_space>response<seq2seq4repair_space>%d" , getBatchId ( ) ) ; try { ProtocolUtils . expectHeader ( input , PARAM_RESPONSE ) ; ModelNode node = new ModelNode ( ) ; node . readExternal ( input ) ; log . tracef ( "Client<seq2seq4repair_space>read<seq2seq4repair_space>response<seq2seq4repair_space>%d<seq2seq4repair_space>successfully" , getBatchId ( ) ) ; return node ; } catch ( Exception e ) { log . tracef ( e , "Client<seq2seq4repair_space>read<seq2seq4repair_space>response<seq2seq4repair_space>%d<seq2seq4repair_space>with<seq2seq4repair_space>error" , getBatchId ( ) ) ; setError ( e ) ; if ( e instanceof IOException ) { throw ( ( IOException ) ( e ) ) ; } if ( e instanceof RuntimeException ) { throw ( ( RuntimeException ) ( e ) ) ; } throw new IOException ( e ) ; } finally { DEFAULT . freeBatchId ( getBatchId ( ) ) ; <START_BUG> activeRequests . remove ( getCurrentRequestId ( ) ) ; <END_BUG> executeRequestContext . done ( ) ; } } } ; } @ Override protected void setError ( final Exception e ) { } } private class HandleReportRequestHandler extends ManagementRequestHandler { @ Override protected void readRequest ( final DataInput input ) throws IOException { } protected void processRequest ( ) { } } private class ReadAttachmentInputStreamRequestHandler extends ManagementRequestHandler { InputStream attachmentInput ; byte [ ] bytes ; @ Override protected void readRequest ( final DataInput input ) throws IOException { } protected void processRequest ( ) throws RequestProcessingException { } @ Override protected void writeResponse ( final FlushableDataOutput output ) throws IOException { } } private static class ExecuteRequestContext { final AbstractModelControllerClient . ExecuteRequest executeRequest ; final OperationMessageHandler messageHandler ; final OperationAttachments attachments ; volatile boolean done ; ExecuteRequestContext ( final AbstractModelControllerClient . ExecuteRequest executeRequest , final OperationMessageHandler messageHandler , final OperationAttachments attachments ) { } CloseHandler < Channel > getRequestCloseHandler ( ) { } OperationMessageHandler getMessageHandler ( ) { } OperationAttachments getAttachments ( ) { } void done ( ) { } } private class DelegatingCancellableAsyncFuture implements AsyncFuture < ModelNode > { private final AsyncFuture < ModelNode > delegate ; private final int batchId ; private volatile boolean isCancelled ; public DelegatingCancellableAsyncFuture ( AsyncFuture < ModelNode > delegate , int batchId ) { } public Status await ( ) throws InterruptedException { } public Status await ( long timeout , TimeUnit unit ) throws InterruptedException { } public ModelNode getUninterruptibly ( ) throws CancellationException , ExecutionException { } public ModelNode getUninterruptibly ( long timeout , TimeUnit unit ) throws CancellationException , ExecutionException , TimeoutException { } public Status awaitUninterruptibly ( ) { } public Status awaitUninterruptibly ( long timeout , TimeUnit unit ) { } public boolean isDone ( ) { } public Status getStatus ( ) { } public < A > void addListener ( Listener < ? extends ModelNode , A > listener , A attachment ) { } public ModelNode get ( ) throws InterruptedException , ExecutionException { } public ModelNode get ( long timeout , TimeUnit unit ) throws InterruptedException , ExecutionException , TimeoutException { } @ Override public boolean isCancelled ( ) { } @ Override public boolean cancel ( boolean interruptionDesired ) { } @ Override public void asyncCancel ( boolean interruptionDesired ) { } private class CancelAsyncRequest extends ManagementRequest < Void > { public CancelAsyncRequest ( ) { } @ Override protected byte getRequestCode ( ) { } @ Override protected ManagementResponseHandler < Void > getResponseHandler ( ) { return ManagementResponseHandler . EMPTY_RESPONSE ; } } } }

Fix:
activeRequests . remove ( getBatchId ( ) ) ;