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

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

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

AbstractFuture.pendingToString介绍

[英]Provide a human-readable explanation of why this future has not yet completed.
[中]提供一个人类可读的解释,解释为什么这个未来尚未完成。

代码示例

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

@Override
public String toString() {
 StringBuilder builder = new StringBuilder().append(super.toString()).append("[status=");
 if (isCancelled()) {
  builder.append("CANCELLED");
 } else if (isDone()) {
  addDoneString(builder);
 } else {
  String pendingDescription;
  try {
   pendingDescription = pendingToString();
  } catch (RuntimeException e) {
   // Don't call getMessage or toString() on the exception, in case the exception thrown by the
   // subclass is implemented with bugs similar to the subclass.
   pendingDescription = "Exception thrown from implementation: " + e.getClass();
  }
  // The future may complete during or before the call to getPendingToString, so we use null
  // as a signal that we should try checking if the future is done again.
  if (pendingDescription != null && !pendingDescription.isEmpty()) {
   builder.append("PENDING, info=[").append(pendingDescription).append("]");
  } else if (isDone()) {
   addDoneString(builder);
  } else {
   builder.append("PENDING");
  }
 }
 return builder.append("]").toString();
}

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

@Override
public String toString() {
 StringBuilder builder = new StringBuilder().append(super.toString()).append("[status=");
 if (isCancelled()) {
  builder.append("CANCELLED");
 } else if (isDone()) {
  addDoneString(builder);
 } else {
  String pendingDescription;
  try {
   pendingDescription = pendingToString();
  } catch (RuntimeException e) {
   // Don't call getMessage or toString() on the exception, in case the exception thrown by the
   // subclass is implemented with bugs similar to the subclass.
   pendingDescription = "Exception thrown from implementation: " + e.getClass();
  }
  // The future may complete during or before the call to getPendingToString, so we use null
  // as a signal that we should try checking if the future is done again.
  if (!isNullOrEmpty(pendingDescription)) {
   builder.append("PENDING, info=[").append(pendingDescription).append("]");
  } else if (isDone()) {
   addDoneString(builder);
  } else {
   builder.append("PENDING");
  }
 }
 return builder.append("]").toString();
}

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

@Override
public String toString() {
 StringBuilder builder = new StringBuilder().append(super.toString()).append("[status=");
 if (isCancelled()) {
  builder.append("CANCELLED");
 } else if (isDone()) {
  addDoneString(builder);
 } else {
  String pendingDescription;
  try {
   pendingDescription = pendingToString();
  } catch (RuntimeException e) {
   // Don't call getMessage or toString() on the exception, in case the exception thrown by the
   // subclass is implemented with bugs similar to the subclass.
   pendingDescription = "Exception thrown from implementation: " + e.getClass();
  }
  // The future may complete during or before the call to getPendingToString, so we use null
  // as a signal that we should try checking if the future is done again.
  if (!isNullOrEmpty(pendingDescription)) {
   builder.append("PENDING, info=[").append(pendingDescription).append("]");
  } else if (isDone()) {
   addDoneString(builder);
  } else {
   builder.append("PENDING");
  }
 }
 return builder.append("]").toString();
}

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

@Override
public String toString() {
 StringBuilder builder = new StringBuilder().append(super.toString()).append("[status=");
 if (isCancelled()) {
  builder.append("CANCELLED");
 } else if (isDone()) {
  addDoneString(builder);
 } else {
  String pendingDescription;
  try {
   pendingDescription = pendingToString();
  } catch (RuntimeException e) {
   // Don't call getMessage or toString() on the exception, in case the exception thrown by the
   // subclass is implemented with bugs similar to the subclass.
   pendingDescription = "Exception thrown from implementation: " + e.getClass();
  }
  // The future may complete during or before the call to getPendingToString, so we use null
  // as a signal that we should try checking if the future is done again.
  if (!isNullOrEmpty(pendingDescription)) {
   builder.append("PENDING, info=[").append(pendingDescription).append("]");
  } else if (isDone()) {
   addDoneString(builder);
  } else {
   builder.append("PENDING");
  }
 }
 return builder.append("]").toString();
}

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

@Override
public String toString() {
 StringBuilder builder = new StringBuilder().append(super.toString()).append("[status=");
 if (isCancelled()) {
  builder.append("CANCELLED");
 } else if (isDone()) {
  addDoneString(builder);
 } else {
  String pendingDescription;
  try {
   pendingDescription = pendingToString();
  } catch (RuntimeException e) {
   // Don't call getMessage or toString() on the exception, in case the exception thrown by the
   // subclass is implemented with bugs similar to the subclass.
   pendingDescription = "Exception thrown from implementation: " + e.getClass();
  }
  // The future may complete during or before the call to getPendingToString, so we use null
  // as a signal that we should try checking if the future is done again.
  if (!isNullOrEmpty(pendingDescription)) {
   builder.append("PENDING, info=[").append(pendingDescription).append("]");
  } else if (isDone()) {
   addDoneString(builder);
  } else {
   builder.append("PENDING");
  }
 }
 return builder.append("]").toString();
}

相关文章