void (int requestId, R response) { synchronized (myLock) { myTimeoutHandlers.remove(requestId); } final AbstractResponseToRequestHandler handler; synchronized (myLock) { handler = myHandlers.remove(requestId); if (handler == null) return; } //noinspection unchecked if (!handler.processResponse(response)) { synchronized (myLock) { myHandlers.put(requestId, handler); } } }