com.google.common.util.concurrent.Monitor.waitForUninterruptibly()方法的使用及代码示例

x33g5p2x  于2022-01-25 转载在 其他  
字(7.5k)|赞(0)|评价(0)|浏览(144)

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

Monitor.waitForUninterruptibly介绍

[英]Waits for the guard to be satisfied. Waits indefinitely. May be called only by a thread currently occupying this monitor.
[中]等待警卫满意。无限期地等待。只能由当前占用此监视器的线程调用。

代码示例

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

void awaitStopped(long timeout, TimeUnit unit) throws TimeoutException {
 monitor.enter();
 try {
  if (!monitor.waitForUninterruptibly(stoppedGuard, timeout, unit)) {
   throw new TimeoutException(
     "Timeout waiting for the services to stop. The following "
       + "services have not stopped: "
       + Multimaps.filterKeys(servicesByState, not(in(EnumSet.of(TERMINATED, FAILED)))));
  }
 } finally {
  monitor.leave();
 }
}

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

void awaitHealthy(long timeout, TimeUnit unit) throws TimeoutException {
 monitor.enter();
 try {
  if (!monitor.waitForUninterruptibly(awaitHealthGuard, timeout, unit)) {
   throw new TimeoutException(
     "Timeout waiting for the services to become healthy. The "
       + "following services have not started: "
       + Multimaps.filterKeys(servicesByState, in(ImmutableSet.of(NEW, STARTING))));
  }
  checkHealthy();
 } finally {
  monitor.leave();
 }
}

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

void awaitStopped(long timeout, TimeUnit unit) throws TimeoutException {
 monitor.enter();
 try {
  if (!monitor.waitForUninterruptibly(stoppedGuard, timeout, unit)) {
   throw new TimeoutException(
     "Timeout waiting for the services to stop. The following "
       + "services have not stopped: "
       + Multimaps.filterKeys(servicesByState, not(in(EnumSet.of(TERMINATED, FAILED)))));
  }
 } finally {
  monitor.leave();
 }
}

代码示例来源:origin: wildfly/wildfly

void awaitStopped(long timeout, TimeUnit unit) throws TimeoutException {
 monitor.enter();
 try {
  if (!monitor.waitForUninterruptibly(stoppedGuard, timeout, unit)) {
   throw new TimeoutException(
     "Timeout waiting for the services to stop. The following "
       + "services have not stopped: "
       + Multimaps.filterKeys(servicesByState, not(in(EnumSet.of(TERMINATED, FAILED)))));
  }
 } finally {
  monitor.leave();
 }
}

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

void awaitHealthy(long timeout, TimeUnit unit) throws TimeoutException {
 monitor.enter();
 try {
  if (!monitor.waitForUninterruptibly(awaitHealthGuard, timeout, unit)) {
   throw new TimeoutException(
     "Timeout waiting for the services to become healthy. The "
       + "following services have not started: "
       + Multimaps.filterKeys(servicesByState, in(ImmutableSet.of(NEW, STARTING))));
  }
  checkHealthy();
 } finally {
  monitor.leave();
 }
}

代码示例来源:origin: wildfly/wildfly

void awaitHealthy(long timeout, TimeUnit unit) throws TimeoutException {
 monitor.enter();
 try {
  if (!monitor.waitForUninterruptibly(awaitHealthGuard, timeout, unit)) {
   throw new TimeoutException(
     "Timeout waiting for the services to become healthy. The "
       + "following services have not started: "
       + Multimaps.filterKeys(servicesByState, in(ImmutableSet.of(NEW, STARTING))));
  }
  checkHealthy();
 } finally {
  monitor.leave();
 }
}

代码示例来源:origin: stackoverflow.com

monitor.enterWhenUninterruptibly(notPaused);
try {
  monitor.waitForUninterruptibly(notPaused);
} finally {
  monitor.leave();

代码示例来源:origin: org.jboss.eap/wildfly-client-all

void awaitStopped(long timeout, TimeUnit unit) throws TimeoutException {
 monitor.enter();
 try {
  if (!monitor.waitForUninterruptibly(stoppedGuard, timeout, unit)) {
   throw new TimeoutException(
     "Timeout waiting for the services to stop. The following "
       + "services have not stopped: "
       + Multimaps.filterKeys(servicesByState, not(in(EnumSet.of(TERMINATED, FAILED)))));
  }
 } finally {
  monitor.leave();
 }
}

代码示例来源:origin: com.diffplug.guava/guava-concurrent

void awaitStopped(long timeout, TimeUnit unit) throws TimeoutException {
  monitor.enter();
  try {
    if (!monitor.waitForUninterruptibly(stoppedGuard, timeout, unit)) {
      throw new TimeoutException("Timeout waiting for the services to stop. The following "
          + "services have not stopped: "
          + Multimaps.filterKeys(servicesByState,
              not(in(EnumSet.of(TERMINATED, FAILED)))));
    }
  } finally {
    monitor.leave();
  }
}

代码示例来源:origin: org.kill-bill.billing/killbill-platform-osgi-bundles-logger

void awaitStopped(long timeout, TimeUnit unit) throws TimeoutException {
 monitor.enter();
 try {
  if (!monitor.waitForUninterruptibly(stoppedGuard, timeout, unit)) {
   throw new TimeoutException(
     "Timeout waiting for the services to stop. The following "
       + "services have not stopped: "
       + Multimaps.filterKeys(servicesByState, not(in(EnumSet.of(TERMINATED, FAILED)))));
  }
 } finally {
  monitor.leave();
 }
}

代码示例来源:origin: org.hudsonci.lib.guava/guava

void awaitHealthy() {
 monitor.enter();
 try {
  monitor.waitForUninterruptibly(awaitHealthGuard);
 } finally {
  monitor.leave();
 }
}

代码示例来源:origin: com.google.guava/guava-jdk5

void awaitStopped(long timeout, TimeUnit unit) throws TimeoutException {
 monitor.enter();
 try {
  if (!monitor.waitForUninterruptibly(stoppedGuard, timeout, unit)) {
   throw new TimeoutException("Timeout waiting for the services to stop. The following "
     + "services have not stopped: " 
     + Multimaps.filterKeys(servicesByState, 
       not(in(ImmutableSet.of(TERMINATED, FAILED))))); 
  }
 } finally {
  monitor.leave();
 }
}

代码示例来源:origin: Nextdoor/bender

void awaitStopped(long timeout, TimeUnit unit) throws TimeoutException {
 monitor.enter();
 try {
  if (!monitor.waitForUninterruptibly(stoppedGuard, timeout, unit)) {
   throw new TimeoutException("Timeout waiting for the services to stop. The following "
     + "services have not stopped: " 
     + Multimaps.filterKeys(servicesByState, 
       not(in(ImmutableSet.of(TERMINATED, FAILED))))); 
  }
 } finally {
  monitor.leave();
 }
}

代码示例来源:origin: org.hudsonci.lib.guava/guava

boolean awaitStopped(long timeout, TimeUnit unit) {
 monitor.enter();
 try {
  return monitor.waitForUninterruptibly(stoppedGuard, timeout, unit);
 } finally {
  monitor.leave();
 }
}

代码示例来源:origin: org.hudsonci.lib.guava/guava

void awaitStopped() {
 monitor.enter();
 try {
  monitor.waitForUninterruptibly(stoppedGuard);
 } finally {
  monitor.leave();
 }
}

代码示例来源:origin: org.hudsonci.lib.guava/guava

boolean awaitHealthy(long timeout, TimeUnit unit) {
 monitor.enter();
 try {
  if (monitor.waitForUninterruptibly(awaitHealthGuard, timeout, unit)) {
   return true;
  }
  return false;
 } finally {
  monitor.leave();
 }
}

代码示例来源:origin: dCache/dcache

public void awaitTerminationUninterruptibly()
{
  monitor.enter();
  try {
    monitor.waitForUninterruptibly(isTerminated);
  } finally {
    monitor.leave();
  }
}

代码示例来源:origin: com.google.guava/guava-jdk5

void awaitHealthy(long timeout, TimeUnit unit) throws TimeoutException {
 monitor.enter();
 try {
  if (!monitor.waitForUninterruptibly(awaitHealthGuard, timeout, unit)) {
   throw new TimeoutException("Timeout waiting for the services to become healthy. The "
     + "following services have not started: " 
     + Multimaps.filterKeys(servicesByState, in(ImmutableSet.of(NEW, STARTING))));
  }
  checkHealthy();
 } finally {
  monitor.leave();
 }
}

代码示例来源:origin: com.diffplug.guava/guava-concurrent

void awaitHealthy(long timeout, TimeUnit unit) throws TimeoutException {
  monitor.enter();
  try {
    if (!monitor.waitForUninterruptibly(awaitHealthGuard, timeout, unit)) {
      throw new TimeoutException("Timeout waiting for the services to become healthy. The "
          + "following services have not started: "
          + Multimaps.filterKeys(servicesByState, in(ImmutableSet.of(NEW, STARTING))));
    }
    checkHealthy();
  } finally {
    monitor.leave();
  }
}

代码示例来源:origin: Nextdoor/bender

void awaitHealthy(long timeout, TimeUnit unit) throws TimeoutException {
 monitor.enter();
 try {
  if (!monitor.waitForUninterruptibly(awaitHealthGuard, timeout, unit)) {
   throw new TimeoutException("Timeout waiting for the services to become healthy. The "
     + "following services have not started: " 
     + Multimaps.filterKeys(servicesByState, in(ImmutableSet.of(NEW, STARTING))));
  }
  checkHealthy();
 } finally {
  monitor.leave();
 }
}

相关文章