test_class.declarator: ioManager = new IOManagerAsync()
test_class.modifier: private static final
test_class.original_string: private static final IOManager ioManager = new IOManagerAsync();
test_class.type: IOManager
test_class.var_name: ioManager
test_class.declarator: mockBuffer = mock(Buffer.class)
test_class.modifier: private static final
test_class.original_string: private static final Buffer mockBuffer = mock(Buffer.class);
test_class.type: Buffer
test_class.var_name: mockBuffer
test_class.declarator: writer
test_class.modifier: private
test_class.original_string: private AsynchronousBufferFileWriter writer;
test_class.type: AsynchronousBufferFileWriter
test_class.var_name: writer
test_class.file: flink-runtime/src/test/java/org/apache/flink/runtime/io/disk/iomanager/AsynchronousBufferFileWriterTest.java
test_class.identifier: AsynchronousBufferFileWriterTest
test_case.body: @Test
  	public void testConcurrentSubscribeAndHandleRequest() throws Exception {
  		final ExecutorService executor = Executors.newFixedThreadPool(2);
  
  		final TestNotificationListener listener = new TestNotificationListener();
  
  		final Callable<Boolean> subscriber = new Callable<Boolean>() {
  			@Override
  			public Boolean call() throws Exception {
  				return writer.registerAllRequestsProcessedListener(listener);
  			}
  		};
  
  		final Callable<Void> requestHandler = new Callable<Void>() {
  			@Override
  			public Void call() throws Exception {
  				handleRequest();
  				return null;
  			}
  		};
  
  		try {
  			// Repeat this to provoke races
  			for (int i = 0; i < 50000; i++) {
  				listener.reset();
  
  				addRequest();
  
  				Future<Void> handleRequestFuture = executor.submit(requestHandler);
  				Future<Boolean> subscribeFuture = executor.submit(subscriber);
  
  				handleRequestFuture.get();
  
  				try {
  					if (subscribeFuture.get()) {
  						assertEquals("Race: Successfully subscribed, but was never notified.", 1, listener.getNumberOfNotifications());
  					}
  					else {
  						assertEquals("Race: Never subscribed successfully, but was notified.", 0, listener.getNumberOfNotifications());
  					}
  				}
  				catch (Throwable t) {
  					System.out.println(i);
  					Assert.fail(t.getMessage());
  				}
  			}
  		}
  		finally {
  			executor.shutdownNow();
  		}
  	}
test_case.class_method_signature: AsynchronousBufferFileWriterTest.testConcurrentSubscribeAndHandleRequest()
test_case.full_signature: @Test public void testConcurrentSubscribeAndHandleRequest()
test_case.identifier: testConcurrentSubscribeAndHandleRequest
test_case.invocations: newFixedThreadPool registerAllRequestsProcessedListener handleRequest reset addRequest submit submit get get assertEquals getNumberOfNotifications assertEquals getNumberOfNotifications println fail getMessage shutdownNow
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void testConcurrentSubscribeAndHandleRequest()
focal_class.declarator: CALLBACK = new RecyclingCallback()
focal_class.modifier: private static final
focal_class.original_string: private static final RecyclingCallback CALLBACK = new RecyclingCallback();
focal_class.type: RecyclingCallback
focal_class.var_name: CALLBACK
focal_class.file: flink-runtime/src/main/java/org/apache/flink/runtime/io/disk/iomanager/AsynchronousBufferFileWriter.java
focal_class.identifier: AsynchronousBufferFileWriter
focal_class.interfaces: implements BufferFileWriter
focal_class.class_method_signature: AsynchronousBufferFileWriter.AsynchronousBufferFileWriter(ID channelID, RequestQueue<WriteRequest> requestQueue)
focal_class.full_signature: protected  AsynchronousBufferFileWriter(ID channelID, RequestQueue<WriteRequest> requestQueue)
focal_class.identifier: AsynchronousBufferFileWriter
focal_class.modifiers: protected
focal_class.parameters: (ID channelID, RequestQueue<WriteRequest> requestQueue)
focal_class.signature:  AsynchronousBufferFileWriter(ID channelID, RequestQueue<WriteRequest> requestQueue)
focal_class.class_method_signature: AsynchronousBufferFileWriter.writeBlock(Buffer buffer)
focal_class.full_signature: @Override public void writeBlock(Buffer buffer)
focal_class.identifier: writeBlock
focal_class.modifiers: @Override public
focal_class.parameters: (Buffer buffer)
focal_class.return: void
focal_class.signature: void writeBlock(Buffer buffer)
focal_class.class_method_signature: AsynchronousBufferFileWriter.getNumberOfOutstandingRequests()
focal_class.full_signature: @Override public int getNumberOfOutstandingRequests()
focal_class.identifier: getNumberOfOutstandingRequests
focal_class.modifiers: @Override public
focal_class.parameters: ()
focal_class.return: int
focal_class.signature: int getNumberOfOutstandingRequests()
focal_class.class_method_signature: AsynchronousBufferFileWriter.registerAllRequestsProcessedListener(NotificationListener listener)
focal_class.full_signature: @Override public boolean registerAllRequestsProcessedListener(NotificationListener listener)
focal_class.identifier: registerAllRequestsProcessedListener
focal_class.modifiers: @Override public
focal_class.parameters: (NotificationListener listener)
focal_class.return: boolean
focal_class.signature: boolean registerAllRequestsProcessedListener(NotificationListener listener)
focal_class.superclass: extends AsynchronousFileIOChannel<Buffer, WriteRequest>
focal_method.body: @Override
  	public boolean registerAllRequestsProcessedListener(NotificationListener listener) throws IOException {
  		return super.registerAllRequestsProcessedListener(listener);
  	}
focal_method.class_method_signature: AsynchronousBufferFileWriter.registerAllRequestsProcessedListener(NotificationListener listener)
focal_method.full_signature: @Override public boolean registerAllRequestsProcessedListener(NotificationListener listener)
focal_method.identifier: registerAllRequestsProcessedListener
focal_method.invocations: registerAllRequestsProcessedListener
focal_method.modifiers: @Override public
focal_method.parameters: (NotificationListener listener)
focal_method.return: boolean
focal_method.signature: boolean registerAllRequestsProcessedListener(NotificationListener listener)