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

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

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

Monitor.initNanoTime介绍

[英]Returns System.nanoTime() unless the timeout has already elapsed. Returns 0L if and only if the timeout has already elapsed.
[中]返回系统。nanoTime(),除非超时已过。当且仅当超时已过时返回0L。

代码示例

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

try {
 if (fair || !lock.tryLock()) {
  startTime = initNanoTime(timeoutNanos);
  for (long remainingNanos = timeoutNanos; ; ) {
   try {
     final long remainingNanos;
     if (startTime == 0L) {
      startTime = initNanoTime(timeoutNanos);
      remainingNanos = timeoutNanos;
     } else {

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

final long startTime = initNanoTime(timeoutNanos);
boolean interrupted = Thread.interrupted();
try {

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

startTime = initNanoTime(timeoutNanos);
if (!lock.tryLock(time, unit)) {
 return false;

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

/**
 * A boolean condition for which a thread may wait. A {@code Guard} is associated with a single
 * {@code Monitor}. The monitor may check the guard at arbitrary times from any thread occupying
 * the monitor, so code should not be written to rely on how often a guard might or might not be
 * checked.
 *
 * <p>If a {@code Guard} is passed into any method of a {@code Monitor} other than the one it is
 * associated with, an {@link IllegalMonitorStateException} is thrown.
 *
 * @since 10.0
 */
@Beta
public abstract static class Guard {
 @Weak final Monitor monitor;
 final Condition condition;
 @GuardedBy("monitor.lock")
 int waiterCount = 0;
 /** The next active guard */
 @GuardedBy("monitor.lock")
 @NullableDecl Guard next;
 protected Guard(Monitor monitor) {
  this.monitor = checkNotNull(monitor, "monitor");
  this.condition = monitor.lock.newCondition();
 }
 /**

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

try {
 if (fair || !lock.tryLock()) {
  startTime = initNanoTime(timeoutNanos);
  for (long remainingNanos = timeoutNanos; ; ) {
   try {
     final long remainingNanos;
     if (startTime == 0L) {
      startTime = initNanoTime(timeoutNanos);
      remainingNanos = timeoutNanos;
     } else {

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

final long startTime = initNanoTime(timeoutNanos);
boolean interrupted = Thread.interrupted();
try {

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

startTime = initNanoTime(timeoutNanos);
if (!lock.tryLock(time, unit)) {
 return false;

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

try {
  if (fair || !lock.tryLock()) {
    startTime = initNanoTime(timeoutNanos);
    for (long remainingNanos = timeoutNanos;;) {
      try {
          final long remainingNanos;
          if (startTime == 0L) {
            startTime = initNanoTime(timeoutNanos);
            remainingNanos = timeoutNanos;
          } else {

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

final long startTime = initNanoTime(timeoutNanos);
boolean interrupted = Thread.interrupted();
try {

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

try {
 if (fair || !lock.tryLock()) {
  startTime = initNanoTime(timeoutNanos);
  for (long remainingNanos = timeoutNanos; ; ) {
   try {
     final long remainingNanos;
     if (startTime == 0L) {
      startTime = initNanoTime(timeoutNanos);
      remainingNanos = timeoutNanos;
     } else {

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

try {
 if (fair || !lock.tryLock()) {
  startTime = initNanoTime(timeoutNanos);
  for (long remainingNanos = timeoutNanos; ; ) {
   try {
     final long remainingNanos;
     if (startTime == 0L) {
      startTime = initNanoTime(timeoutNanos);
      remainingNanos = timeoutNanos;
     } else {

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

final long startTime = initNanoTime(timeoutNanos);
boolean interrupted = Thread.interrupted();
try {

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

startTime = initNanoTime(timeoutNanos);
if (!lock.tryLock(time, unit)) {
  return false;

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

final long startTime = initNanoTime(timeoutNanos);
boolean interrupted = Thread.interrupted();
try {

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

startTime = initNanoTime(timeoutNanos);
if (!lock.tryLock(time, unit)) {
 return false;

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

startTime = initNanoTime(timeoutNanos);
if (!lock.tryLock(time, unit)) {
 return false;

相关文章