本文整理汇总了Java中com.google.appengine.tools.pipeline.Value类的典型用法代码示例。如果您正苦于以下问题:Java Value类的具体用法?Java Value怎么用?Java Value使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Value类属于com.google.appengine.tools.pipeline包,在下文中一共展示了Value类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: run
import com.google.appengine.tools.pipeline.Value; //导入依赖的package包/类
@Override
public Value<Integer> run(String userEmail) {
// Invoke ComplexJob on three promised values
PromisedValue<Integer> x = newPromise();
PromisedValue<Integer> y = newPromise();
PromisedValue<Integer> z = newPromise();
FutureValue<Integer> intermediate = futureCall(new ComplexJob(), x, y, z);
// Kick off the process of retrieving the data from the external agent
getIntFromUser("Please give 1st int", userEmail, x.getHandle());
getIntFromUser("Please give 2nd int", userEmail, y.getHandle());
getIntFromUser("Please give 3rd int", userEmail, z.getHandle());
// Send the user the intermediate result and ask for one more integer
FutureValue<Integer> oneMoreInt =
futureCall(new PromptJob(), intermediate, immediate(userEmail));
// Invoke MultJob on intermediate and oneMoreInt
return futureCall(new MultJob(), intermediate, oneMoreInt);
}
示例2: run
import com.google.appengine.tools.pipeline.Value; //导入依赖的package包/类
@Override
public Value<Integer> run(Pair<Integer, Integer> intPair) {
try {
int a = intPair.getFirst();
int b = intPair.getSecond();
// Assume a<=b
if (a == b) {
return immediate(a);
} else {
// Else a<b
FutureValue<Integer> difference = futureCall(new DiffJob(), immediate(b), immediate(a));
FutureValue<Integer> gcd = futureCall(new GCDJob(), immediate(a), difference);
return gcd;
}
} catch (Exception e) {
throw new RuntimeException(e);
}
}
示例3: run
import com.google.appengine.tools.pipeline.Value; //导入依赖的package包/类
@Override
public Value<MapReduceResult<String>> run() {
MapReduceResult<String> result =
new MapReduceResult<String>() {
@Override
public Counters getCounters() {
throw new UnsupportedOperationException();
}
@Override
public String getOutputResult() {
return "foobar";
}};
return immediate(result);
}
示例4: run
import com.google.appengine.tools.pipeline.Value; //导入依赖的package包/类
@Override
public Value<SortedMap<Character, Integer>> run(String text) {
String[] words = text.split("[^a-zA-Z]");
List<FutureValue<SortedMap<Character, Integer>>> countsForEachWord = new LinkedList<>();
for (String word : words) {
countsForEachWord.add(futureCall(new SingleWordCounterJob(), immediate(word)));
}
return futureCall(new CountCombinerJob(), futureList(countsForEachWord));
}
示例5: execute
import com.google.appengine.tools.pipeline.Value; //导入依赖的package包/类
private Value<Void> execute() {
List<? extends IdRef<?>> markerIds = sinkMarkerIds();
FutureValue<Void> waitForClearSink = null;
if (cursor != null) {
waitForClearSink = futureCall(new DrainSinkJob(), immediate(pipeClazz), immediate(sinkId.getUri()), immediate(cursor));
} else {
clearSink();
}
destroySinkMarkers(markerIds);
return waitForClearSink;
}
示例6: execute
import com.google.appengine.tools.pipeline.Value; //导入依赖的package包/类
private Value<Void> execute() {
List<Value<Void>> jobs = new LinkedList<>();
List<? extends IdRef<?>> ids = sourceIds();
if (cursor != null) {
jobs.add(futureCall(new FlushSourcesJob(), immediate(pipeClazz), immediate(cursor)));
}
for (IdRef<?> id : ids) {
jobs.add(futureCall(new FlushSourceJob(), immediate(pipeClazz), immediate(id.getUri())));
}
return futureCall(new WaiterJob(), futureList(jobs));
}
示例7: execute
import com.google.appengine.tools.pipeline.Value; //导入依赖的package包/类
private Value<Void> execute() {
List<Value<Void>> jobs = new LinkedList<>();
List<? extends IdRef<?>> ids = sinkIds();
if (cursor != null) {
jobs.add(futureCall(new DrainSinksJob(), immediate(pipeClazz), immediate(cursor)));
}
for (IdRef<?> id : ids) {
jobs.add(futureCall(new DrainSinkJob(), immediate(pipeClazz), immediate(id.getUri()), null));
}
return futureCall(new WaiterJob(), futureList(jobs));
}
示例8: registerNewJobRecord
import com.google.appengine.tools.pipeline.Value; //导入依赖的package包/类
public static JobRecord registerNewJobRecord(UpdateSpec updateSpec, JobRecord jobRecord,
Object[] params) {
if (logger.isLoggable(Level.FINE)) {
logger.fine("registerNewJobRecord job(\"" + jobRecord + "\")");
}
updateSpec.setRootJobKey(jobRecord.getRootJobKey());
Key generatorKey = jobRecord.getGeneratorJobKey();
// Add slots to the RunBarrier corresponding to the input parameters
String graphGuid = jobRecord.getGraphGuid();
for (Object param : params) {
Value<?> value;
if (null != param && param instanceof Value<?>) {
value = (Value<?>) param;
} else {
value = new ImmediateValue<>(param);
}
registerSlotsWithBarrier(updateSpec, value, jobRecord.getRootJobKey(), generatorKey,
jobRecord.getQueueSettings(), graphGuid, jobRecord.getRunBarrierInflated());
}
if (0 == jobRecord.getRunBarrierInflated().getWaitingOnKeys().size()) {
// If the run barrier is not waiting on anything, add a phantom filled
// slot in order to trigger a HandleSlotFilledTask in order to trigger
// a RunJobTask.
Slot slot = new Slot(jobRecord.getRootJobKey(), generatorKey, graphGuid);
jobRecord.getRunBarrierInflated().addPhantomArgumentSlot(slot);
registerSlotFilled(updateSpec, jobRecord.getQueueSettings(), slot, null);
}
// Register the newly created objects with the UpdateSpec.
// The slots in the run Barrier have already been registered
// and the finalize Barrier doesn't have any slots yet.
// Any HandleSlotFilledTasks have also been registered already.
Group updateGroup = updateSpec.getNonTransactionalGroup();
updateGroup.includeBarrier(jobRecord.getRunBarrierInflated());
updateGroup.includeBarrier(jobRecord.getFinalizeBarrierInflated());
updateGroup.includeSlot(jobRecord.getOutputSlotInflated());
updateGroup.includeJob(jobRecord);
updateGroup.includeJobInstanceRecord(jobRecord.getJobInstanceInflated());
return jobRecord;
}
示例9: throwUnrecognizedValueException
import com.google.appengine.tools.pipeline.Value; //导入依赖的package包/类
private static void throwUnrecognizedValueException(Value<?> value) {
throw new RuntimeException(
"Internal logic error: Unrecognized implementation of Value interface: "
+ value.getClass().getName());
}
示例10: run
import com.google.appengine.tools.pipeline.Value; //导入依赖的package包/类
@Override
public Value<Object> run() throws Exception {
return futureCallUnchecked(settings, jobInstance, params);
}
示例11: run
import com.google.appengine.tools.pipeline.Value; //导入依赖的package包/类
@Override
public Value<Void> run(Class<? extends Pipe> pipeClazz) throws Exception {
init(pipeClazz);
return execute();
}
示例12: execute
import com.google.appengine.tools.pipeline.Value; //导入依赖的package包/类
private Value<Void> execute() {
JobSetting.WaitForSetting waitClearSinks = waitFor(futureCall(new DrainSinksJob(), immediate(pipeClazz), null));
return futureCall(new FlushSourcesJob(), immediate(pipeClazz), null, waitClearSinks);
}
示例13: run
import com.google.appengine.tools.pipeline.Value; //导入依赖的package包/类
@Override
public Value<Void> run(Class<? extends Pipe> pipeClazz, String sourceUri) throws Exception {
init(pipeClazz, sourceUri);
return execute();
}
示例14: execute
import com.google.appengine.tools.pipeline.Value; //导入依赖的package包/类
private Value<Void> execute() {
flushSource();
return null;
}
示例15: run
import com.google.appengine.tools.pipeline.Value; //导入依赖的package包/类
@Override
public Value<Void> run(Class<? extends Pipe> pipeClazz, String sinkUri, String cursor) throws Exception {
init(pipeClazz, sinkUri, cursor);
return execute();
}