java.lang.Object.notifyAll()方法的使用及代码示例

x33g5p2x  于2022-01-16 转载在 其他  
字(4.9k)|赞(0)|评价(0)|浏览(152)

本文整理了Java中java.lang.Object.notifyAll()方法的一些代码示例,展示了Object.notifyAll()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Object.notifyAll()方法的具体详情如下:
包路径:java.lang.Object
类名称:Object
方法名:notifyAll

Object.notifyAll介绍

暂无

代码示例

代码示例来源:origin: square/okhttp

/** Set the OAuth session for this client. */
public synchronized void initOauthSession(OAuthSession session) {
 this.session = session;
 this.notifyAll();
}

代码示例来源:origin: square/okhttp

synchronized void receiveRstStream(ErrorCode errorCode) {
 if (this.errorCode == null) {
  this.errorCode = errorCode;
  notifyAll();
 }
}

代码示例来源:origin: square/okhttp

/**
 * {@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();
}

代码示例来源:origin: square/okhttp

public void proceed() {
 synchronized (lock) {
  this.proceed = true;
  lock.notifyAll();
 }
}

代码示例来源:origin: google/guava

/** Decrements the running task count. */
 private void endTask() {
  synchronized (lock) {
   int numRunning = --runningTasks;
   if (numRunning == 0) {
    lock.notifyAll();
   }
  }
 }
}

代码示例来源:origin: google/guava

@Override
public void shutdown() {
 synchronized (lock) {
  shutdown = true;
  if (runningTasks == 0) {
   lock.notifyAll();
  }
 }
}

代码示例来源:origin: iluwatar/java-design-patterns

@Override
public void unlock() {
 synchronized (globalMutex) {
  globalMutex.remove(this);
  // Notify the waiter, other writer or reader
  globalMutex.notifyAll();
 }
}

代码示例来源:origin: square/okhttp

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;
}

代码示例来源:origin: square/okhttp

@Override public void onFailure(Call call, IOException e) {
 synchronized (lock) {
  this.callFailure = (e instanceof UnexpectedException) ? e.getCause() : e;
  lock.notifyAll();
 }
}

代码示例来源:origin: iluwatar/java-design-patterns

@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();
   }
  }
 }
}

代码示例来源:origin: apache/incubator-dubbo

public void shutdown() {
    shutdown = true;
    connectionManagers.clear();
    synchronized (this) {
      notifyAll();
    }
  }
}

代码示例来源:origin: apache/incubator-dubbo

public void shutdown() {
    shutdown = true;
    connectionManagers.clear();
    synchronized (this) {
      notifyAll();
    }
  }
}

代码示例来源:origin: square/okhttp

/**
 * 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;
 }
}

代码示例来源:origin: square/okhttp

@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.
  }
 }
}

代码示例来源:origin: square/okhttp

@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();
 }
}

代码示例来源:origin: spring-projects/spring-framework

/**
 * 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();
  }
}

代码示例来源:origin: square/okhttp

@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);
   }
  }
 }
}

代码示例来源:origin: spring-projects/spring-framework

@Override
public <T> Future<T> submit(Callable<T> task) {
  submitStartCounter++;
  Future<T> future = super.submit(task);
  submitCompleteCounter++;
  synchronized (this) {
    notifyAll();
  }
  return future;
}

代码示例来源:origin: spring-projects/spring-framework

@Override
public final void run() {
  synchronized (this.monitor) {
    try {
      doRun();
    }
    finally {
      this.monitor.notifyAll();
    }
  }
}

代码示例来源:origin: square/okhttp

@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();
 }
}

相关文章