/** Set the OAuth session for this client. */ public synchronized void initOauthSession(OAuthSession session) { this.session = session; this.notifyAll(); }
synchronized void receiveRstStream(ErrorCode errorCode) { if (this.errorCode == null) { this.errorCode = errorCode; notifyAll(); } }
/** * {@code delta} will be negative if a settings frame initial window is smaller than the last. */ void addBytesToWriteWindow(long delta) { bytesLeftInWriteWindow += delta; if (delta > 0) Http2Stream.this.notifyAll(); }
public void proceed() { synchronized (lock) { this.proceed = true; lock.notifyAll(); } }
/** Decrements the running task count. */ private void endTask() { synchronized (lock) { int numRunning = --runningTasks; if (numRunning == 0) { lock.notifyAll(); } } } }
@Override public void shutdown() { synchronized (lock) { shutdown = true; if (runningTasks == 0) { lock.notifyAll(); } } }
@Override public void unlock() { synchronized (globalMutex) { globalMutex.remove(this); // Notify the waiter, other writer or reader globalMutex.notifyAll(); } }
synchronized Http2Stream removeStream(int streamId) { Http2Stream stream = streams.remove(streamId); notifyAll(); // The removed stream may be blocked on a connection-wide window update. return stream; }
@Override public void onFailure(Call call, IOException e) { synchronized (lock) { this.callFailure = (e instanceof UnexpectedException) ? e.getCause() : e; lock.notifyAll(); } }
@Override public void unlock() { synchronized (readerMutex) { currentReaderCount--; // Release the lock only when it is the last reader, it is ensure that the lock is released // when all reader is completely. if (currentReaderCount == 0) { synchronized (globalMutex) { // Notify the waiter, mostly the writer globalMutex.remove(this); globalMutex.notifyAll(); } } } }
public void shutdown() { shutdown = true; connectionManagers.clear(); synchronized (this) { notifyAll(); } } }
public void shutdown() { shutdown = true; connectionManagers.clear(); synchronized (this) { notifyAll(); } } }
/** * Notify this pool that {@code connection} has become idle. Returns true if the connection has * been removed from the pool and should be closed. */ boolean connectionBecameIdle(RealConnection connection) { assert (Thread.holdsLock(this)); if (connection.noNewStreams || maxIdleConnections == 0) { connections.remove(connection); return true; } else { notifyAll(); // Awake the cleanup thread: we may have exceeded the idle connection limit. return false; } }
@Override public void ping(boolean reply, int payload1, int payload2) { if (reply) { synchronized (Http2Connection.this) { awaitingPong = false; Http2Connection.this.notifyAll(); } } else { try { // Send a reply to a client ping if this is a server and vice versa. writerExecutor.execute(new PingRunnable(true, payload1, payload2)); } catch (RejectedExecutionException ignored) { // This connection has been closed. } } }
@Override public void onResponse(Call call, Response response) { synchronized (lock) { this.response = response; this.handshake = response.handshake(); this.url = response.request().url().url(); lock.notifyAll(); } }
/** * Notify all invoker tasks and stop the shared Connection, if any. * @throws JMSException if thrown by JMS API methods * @see #stopSharedConnection */ protected void doStop() throws JMSException { synchronized (this.lifecycleMonitor) { this.running = false; this.lifecycleMonitor.notifyAll(); } if (sharedConnectionEnabled()) { stopSharedConnection(); } }
@Override public void windowUpdate(int streamId, long windowSizeIncrement) { if (streamId == 0) { synchronized (Http2Connection.this) { bytesLeftInWriteWindow += windowSizeIncrement; Http2Connection.this.notifyAll(); } } else { Http2Stream stream = getStream(streamId); if (stream != null) { synchronized (stream) { stream.addBytesToWriteWindow(windowSizeIncrement); } } } }
@Override public <T> Future<T> submit(Callable<T> task) { submitStartCounter++; Future<T> future = super.submit(task); submitCompleteCounter++; synchronized (this) { notifyAll(); } return future; }
@Override public final void run() { synchronized (this.monitor) { try { doRun(); } finally { this.monitor.notifyAll(); } } }
@Override public void close() throws IOException { long bytesDiscarded; synchronized (Http2Stream.this) { closed = true; bytesDiscarded = readBuffer.size(); readBuffer.clear(); Http2Stream.this.notifyAll(); // TODO(jwilson): Unnecessary? } if (bytesDiscarded > 0) { updateConnectionFlowControl(bytesDiscarded); } cancelStreamIfNecessary(); } }