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

x33g5p2x  于11个月前 转载在 其他  
字(6.0k)|赞(0)|评价(0)|浏览(30)

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

AbstractFuture.userObjectToString介绍

[英]Helper for printing user supplied objects into our toString method.
[中]将用户提供的对象打印到toString方法中的助手。

代码示例

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

private void addDoneString(StringBuilder builder) {
 try {
  V value = getUninterruptibly(this);
  builder.append("SUCCESS, result=[").append(userObjectToString(value)).append("]");
 } catch (ExecutionException e) {
  builder.append("FAILURE, cause=[").append(e.getCause()).append("]");
 } catch (CancellationException e) {
  builder.append("CANCELLED"); // shouldn't be reachable
 } catch (RuntimeException e) {
  builder.append("UNKNOWN, cause=[").append(e.getClass()).append(" thrown from get()]");
 }
}

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

private void addDoneString(StringBuilder builder) {
 try {
  V value = getDone(this);
  builder.append("SUCCESS, result=[").append(userObjectToString(value)).append("]");
 } catch (ExecutionException e) {
  builder.append("FAILURE, cause=[").append(e.getCause()).append("]");
 } catch (CancellationException e) {
  builder.append("CANCELLED"); // shouldn't be reachable
 } catch (RuntimeException e) {
  builder.append("UNKNOWN, cause=[").append(e.getClass()).append(" thrown from get()]");
 }
}

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

private void addDoneString(StringBuilder builder) {
 try {
  V value = getDone(this);
  builder.append("SUCCESS, result=[").append(userObjectToString(value)).append("]");
 } catch (ExecutionException e) {
  builder.append("FAILURE, cause=[").append(e.getCause()).append("]");
 } catch (CancellationException e) {
  builder.append("CANCELLED"); // shouldn't be reachable
 } catch (RuntimeException e) {
  builder.append("UNKNOWN, cause=[").append(e.getClass()).append(" thrown from get()]");
 }
}

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

/**
 * Provide a human-readable explanation of why this future has not yet completed.
 *
 * @return null if an explanation cannot be provided because the future is done.
 * @since 23.0
 */
protected @Nullable String pendingToString() {
 Object localValue = value;
 if (localValue instanceof SetFuture) {
  return "setFuture=[" + userObjectToString(((SetFuture) localValue).future) + "]";
 } else if (this instanceof ScheduledFuture) {
  return "remaining delay=["
    + ((ScheduledFuture) this).getDelay(TimeUnit.MILLISECONDS)
    + " ms]";
 }
 return null;
}

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

/**
 * Provide a human-readable explanation of why this future has not yet completed.
 *
 * @return null if an explanation cannot be provided because the future is done.
 * @since 23.0
 */
@NullableDecl
protected String pendingToString() {
 Object localValue = value;
 if (localValue instanceof SetFuture) {
  return "setFuture=[" + userObjectToString(((SetFuture) localValue).future) + "]";
 } else if (this instanceof ScheduledFuture) {
  return "remaining delay=["
    + ((ScheduledFuture) this).getDelay(TimeUnit.MILLISECONDS)
    + " ms]";
 }
 return null;
}

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

/**
 * Provide a human-readable explanation of why this future has not yet completed.
 *
 * @return null if an explanation cannot be provided because the future is done.
 * @since 23.0
 */
@NullableDecl
protected String pendingToString() {
 Object localValue = value;
 if (localValue instanceof SetFuture) {
  return "setFuture=[" + userObjectToString(((SetFuture) localValue).future) + "]";
 } else if (this instanceof ScheduledFuture) {
  return "remaining delay=["
    + ((ScheduledFuture) this).getDelay(TimeUnit.MILLISECONDS)
    + " ms]";
 }
 return null;
}

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

private void addDoneString(StringBuilder builder) {
 try {
  V value = getDone(this);
  builder.append("SUCCESS, result=[").append(userObjectToString(value)).append("]");
 } catch (ExecutionException e) {
  builder.append("FAILURE, cause=[").append(e.getCause()).append("]");
 } catch (CancellationException e) {
  builder.append("CANCELLED"); // shouldn't be reachable
 } catch (RuntimeException e) {
  builder.append("UNKNOWN, cause=[").append(e.getClass()).append(" thrown from get()]");
 }
}

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

private void addDoneString(StringBuilder builder) {
 try {
  V value = getDone(this);
  builder.append("SUCCESS, result=[").append(userObjectToString(value)).append("]");
 } catch (ExecutionException e) {
  builder.append("FAILURE, cause=[").append(e.getCause()).append("]");
 } catch (CancellationException e) {
  builder.append("CANCELLED"); // shouldn't be reachable
 } catch (RuntimeException e) {
  builder.append("UNKNOWN, cause=[").append(e.getClass()).append(" thrown from get()]");
 }
}

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

/**
 * Provide a human-readable explanation of why this future has not yet completed.
 *
 * @return null if an explanation cannot be provided because the future is done.
 * @since 23.0
 */
protected @Nullable String pendingToString() {
 Object localValue = value;
 if (localValue instanceof SetFuture) {
  return "setFuture=[" + userObjectToString(((SetFuture) localValue).future) + "]";
 } else if (this instanceof ScheduledFuture) {
  return "remaining delay=["
    + ((ScheduledFuture) this).getDelay(TimeUnit.MILLISECONDS)
    + " ms]";
 }
 return null;
}

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

/**
 * Provide a human-readable explanation of why this future has not yet completed.
 *
 * @return null if an explanation cannot be provided because the future is done.
 * @since 23.0
 */
@NullableDecl
protected String pendingToString() {
 Object localValue = value;
 if (localValue instanceof SetFuture) {
  return "setFuture=[" + userObjectToString(((SetFuture) localValue).future) + "]";
 } else if (this instanceof ScheduledFuture) {
  return "remaining delay=["
    + ((ScheduledFuture) this).getDelay(TimeUnit.MILLISECONDS)
    + " ms]";
 }
 return null;
}

相关文章