本文整理了Java中scala.util.Try.isSuccess()
方法的一些代码示例,展示了Try.isSuccess()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Try.isSuccess()
方法的具体详情如下:
包路径:scala.util.Try
类名称:Try
方法名:isSuccess
暂无
代码示例来源:origin: vert-x3/vertx-mysql-postgresql-client
@Override
public Void apply(Try<T> v1) {
if (v1.isSuccess()) {
fut.complete();
} else {
fut.fail(v1.failed().get());
}
return null;
}
}, ec);
代码示例来源:origin: vert-x3/vertx-mysql-postgresql-client
@Override
public Void apply(Try<V> v1) {
if (v1.isSuccess()) {
code.handle(Future.succeededFuture(v1.get()));
} else {
code.handle(Future.failedFuture(v1.failed().get()));
}
return null;
}
};
代码示例来源:origin: vert-x3/vertx-mysql-postgresql-client
@Override
public Void apply(Try<T> v1) {
if (v1.isSuccess()) {
fut.complete(v1.get());
} else {
fut.fail(v1.failed().get());
}
return null;
}
}, ec);
代码示例来源:origin: org.talend.components/processing-runtime
private List<Object> getInputFields(IndexedRecord inputRecord, String columnName) {
// Adapt non-avpath syntax to avpath.
// TODO: This should probably not be automatic, use the actual syntax.
if (!columnName.startsWith("."))
columnName = "." + columnName;
Try<scala.collection.immutable.List<Evaluator.Ctx>> result = wandou.avpath.package$.MODULE$.select(inputRecord,
columnName);
List<Object> values = new ArrayList<Object>();
if (result.isSuccess()) {
for (Evaluator.Ctx ctx : JavaConversions.asJavaCollection(result.get())) {
values.add(ctx.value());
}
} else {
// Evaluating the expression failed, and we can handle the exception.
Throwable t = result.failed().get();
throw ProcessingErrorCode.createAvpathSyntaxError(t, columnName, -1);
}
return values;
}
代码示例来源:origin: org.talend.components/processing-runtime
/**
* Use an AVPath to extract data from an indexed record
*
* @param record an indexed record
* @param avPath the path to elements to extract (can be one or multiples elements)
* @return the extracted data as a list.
*/
public static List<Evaluator.Ctx> getInputFields(IndexedRecord record, String avPath) {
// Adapt non-avpath syntax to avpath.
// TODO: This should probably not be automatic, use the actual syntax.
if (!avPath.startsWith("."))
avPath = "." + avPath;
Try<scala.collection.immutable.List<Evaluator.Ctx>> result =
wandou.avpath.package$.MODULE$.select(record, avPath);
List<Evaluator.Ctx> results = new ArrayList<Evaluator.Ctx>();
if (result.isSuccess()) {
for (Evaluator.Ctx ctx : JavaConversions.asJavaCollection(result.get())) {
results.add(ctx);
}
} else {
// Evaluating the expression failed, and we can handle the exception.
throw ProcessingErrorCode.createAvpathSyntaxError(result.failed().get(), avPath, -1);
}
return results;
}
代码示例来源:origin: Talend/components
private List<Object> getInputFields(IndexedRecord inputRecord, String columnName) {
// Adapt non-avpath syntax to avpath.
// TODO: This should probably not be automatic, use the actual syntax.
if (!columnName.startsWith("."))
columnName = "." + columnName;
Try<scala.collection.immutable.List<Evaluator.Ctx>> result = wandou.avpath.package$.MODULE$.select(inputRecord,
columnName);
List<Object> values = new ArrayList<Object>();
if (result.isSuccess()) {
for (Evaluator.Ctx ctx : JavaConversions.asJavaCollection(result.get())) {
values.add(ctx.value());
}
} else {
// Evaluating the expression failed, and we can handle the exception.
Throwable t = result.failed().get();
throw ProcessingErrorCode.createAvpathSyntaxError(t, columnName, -1);
}
return values;
}
代码示例来源:origin: Talend/components
/**
* Use an AVPath to extract data from an indexed record
*
* @param record an indexed record
* @param avPath the path to elements to extract (can be one or multiples elements)
* @return the extracted data as a list.
*/
public static List<Evaluator.Ctx> getInputFields(IndexedRecord record, String avPath) {
// Adapt non-avpath syntax to avpath.
// TODO: This should probably not be automatic, use the actual syntax.
if (!avPath.startsWith("."))
avPath = "." + avPath;
Try<scala.collection.immutable.List<Evaluator.Ctx>> result =
wandou.avpath.package$.MODULE$.select(record, avPath);
List<Evaluator.Ctx> results = new ArrayList<Evaluator.Ctx>();
if (result.isSuccess()) {
for (Evaluator.Ctx ctx : JavaConversions.asJavaCollection(result.get())) {
results.add(ctx);
}
} else {
// Evaluating the expression failed, and we can handle the exception.
throw ProcessingErrorCode.createAvpathSyntaxError(result.failed().get(), avPath, -1);
}
return results;
}
代码示例来源:origin: com.lightbend.akka/akka-stream-alpakka-file
@Override
public void preStart() {
chunkCallback =
createAsyncCallback(
(tryInteger) -> {
if (tryInteger.isSuccess()) {
int readBytes = tryInteger.get();
if (readBytes > 0) {
buffer.flip();
push(out, ByteString.fromByteBuffer(buffer));
position += readBytes;
buffer.clear();
} else {
// hit end, try again in a while
scheduleOnce("poll", pollingInterval);
}
} else {
failStage(tryInteger.failed().get());
}
});
}
代码示例来源:origin: org.opendaylight.controller/sal-distributed-datastore
final TransactionContextWrapper newTransactionContextWrapper(final TransactionProxy parent, final String shardName) {
final TransactionContextWrapper transactionContextWrapper =
new TransactionContextWrapper(parent.getIdentifier(), actorContext);
Future<PrimaryShardInfo> findPrimaryFuture = findPrimaryShard(shardName, parent.getIdentifier());
if(findPrimaryFuture.isCompleted()) {
Try<PrimaryShardInfo> maybe = findPrimaryFuture.value().get();
if(maybe.isSuccess()) {
onFindPrimaryShardSuccess(maybe.get(), parent, shardName, transactionContextWrapper);
} else {
onFindPrimaryShardFailure(maybe.failed().get(), parent, shardName, transactionContextWrapper);
}
} else {
findPrimaryFuture.onComplete(new OnComplete<PrimaryShardInfo>() {
@Override
public void onComplete(final Throwable failure, final PrimaryShardInfo primaryShardInfo) {
if (failure == null) {
onFindPrimaryShardSuccess(primaryShardInfo, parent, shardName, transactionContextWrapper);
} else {
onFindPrimaryShardFailure(failure, parent, shardName, transactionContextWrapper);
}
}
}, actorContext.getClientDispatcher());
}
return transactionContextWrapper;
}
内容来源于网络,如有侵权,请联系作者删除!