本文整理汇总了Java中org.apache.ignite.compute.ComputeJobResult类的典型用法代码示例。如果您正苦于以下问题:Java ComputeJobResult类的具体用法?Java ComputeJobResult怎么用?Java ComputeJobResult使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ComputeJobResult类属于org.apache.ignite.compute包,在下文中一共展示了ComputeJobResult类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: invalidate
import org.apache.ignite.compute.ComputeJobResult; //导入依赖的package包/类
/** {@inheritDoc} */
@Override public void invalidate(Iterable<Metadata> subPath, final IgniteBiInClosure<String, Set<Object>> action) {
Map<String, List<Metadata>> names = getSnapshotsByCache(subPath);
if (!names.isEmpty()) {
ignite.compute().execute(new ComputeTaskSplitAdapter<Map<String, List<Metadata>>, Void>() {
/** {@inheritDoc} */
@Override protected Collection<? extends ComputeJob> split(int gridSize,
Map<String, List<Metadata>> byCache) throws IgniteException {
List<ComputeJob> result = new ArrayList<>();
for (Map.Entry<String, List<Metadata>> entry : byCache.entrySet()) {
String cacheName = entry.getKey();
for (Metadata metadata : entry.getValue()) {
result.add(new ProcessAllKeysJob(cacheName, metadata, action));
}
}
return result;
}
/** {@inheritDoc} */
@Override public Void reduce(List<ComputeJobResult> results) throws IgniteException {
return null;
}
}, names);
}
}
开发者ID:epam,项目名称:Lagerta,代码行数:26,代码来源:KeyValueManagerImpl.java
示例2: restoreData
import org.apache.ignite.compute.ComputeJobResult; //导入依赖的package包/类
/**
* Performs restore operaton on given resource names.
*
* @param source base path to existing backup.
* @param names of resources included in this backup.
*/
private void restoreData(final URI source, Iterable<String> names) {
failOnExistingTransactions();
ignite.compute().execute(new ComputeTaskSplitAdapter<Iterable<String>, Object>() {
/** {@inheritDoc} */
@Override protected Collection<? extends ComputeJob> split(int gridSize,
Iterable<String> arg) throws IgniteException {
List<ComputeJob> result = new ArrayList<>();
for (String name : arg) {
result.add(new RestoreJob(source, name));
}
return result;
}
/** {@inheritDoc} */
@Nullable @Override public Object reduce(List<ComputeJobResult> results) throws IgniteException {
return null;
}
}, names);
}
开发者ID:epam,项目名称:Lagerta,代码行数:26,代码来源:CommandServiceImpl.java
示例3: reduce
import org.apache.ignite.compute.ComputeJobResult; //导入依赖的package包/类
/** {@inheritDoc} */
@Override public Integer reduce(List<ComputeJobResult> results) {
if (log.isInfoEnabled())
log.info("Reducing job [job=" + this + ", results=" + results + ']');
if (results.size() < SPLIT_COUNT)
fail();
int sum = 0;
for (ComputeJobResult result : results) {
if (result.getData() != null)
sum += (Integer)result.getData();
}
return sum;
}
开发者ID:apache,项目名称:ignite,代码行数:18,代码来源:GridSessionSetFutureAttributeWaitListenerSelfTest.java
示例4: reduce
import org.apache.ignite.compute.ComputeJobResult; //导入依赖的package包/类
/** {@inheritDoc} */
@Override public Collection<Line> reduce(List<ComputeJobResult> results) {
Collection<Line> lines = new TreeSet<>(new Comparator<Line>() {
@Override public int compare(Line line1, Line line2) {
return line1.rangePosition() < line2.rangePosition() ? -1 :
line1.rangePosition() > line2.rangePosition() ? 1 : line1.lineIndex() - line2.lineIndex();
}
});
for (ComputeJobResult res : results) {
if (res.getException() != null)
throw res.getException();
Collection<Line> line = res.getData();
if (line != null)
lines.addAll(line);
}
return lines;
}
开发者ID:apache,项目名称:ignite,代码行数:22,代码来源:IgfsMapReduceExample.java
示例5: reduce
import org.apache.ignite.compute.ComputeJobResult; //导入依赖的package包/类
/** {@inheritDoc} */
@Override public Object reduce(List<ComputeJobResult> results) {
assert results.size() == 2;
for (ComputeJobResult res : results) {
log.info("Job result: " + res.getData());
}
String name1 = results.get(0).getData();
String name2 = results.get(1).getData();
assert name1.equals(name2);
assert !name1.equals(ignite1.name());
assert name1.equals(ignite2.name());
return null;
}
开发者ID:apache,项目名称:ignite,代码行数:19,代码来源:GridJobStealingZeroActiveJobsSelfTest.java
示例6: reduce
import org.apache.ignite.compute.ComputeJobResult; //导入依赖的package包/类
/** {@inheritDoc} */
@Override public Integer reduce(List<ComputeJobResult> results) {
if (log.isInfoEnabled())
log.info("Reducing job [job=" + this + ", results=" + results + ']');
if (results.size() < SPLIT_COUNT)
fail("Results size is less than split count: " + results.size());
int sum = 0;
for (ComputeJobResult res : results) {
if (res.getData() == null)
fail("Got null result data: " + res);
else
log.info("Reducing result: " + res.getData());
sum += (Integer)res.getData();
}
return sum;
}
开发者ID:apache,项目名称:ignite,代码行数:22,代码来源:GridSessionJobWaitTaskAttributeSelfTest.java
示例7: reduce
import org.apache.ignite.compute.ComputeJobResult; //导入依赖的package包/类
/**
* @param taskRes Task result.
* @param results Results.
* @return Data collector task result.
*/
protected VisorNodeDataCollectorTaskResult reduce(VisorNodeDataCollectorTaskResult taskRes,
List<ComputeJobResult> results) {
for (ComputeJobResult res : results) {
VisorNodeDataCollectorJobResult jobRes = res.getData();
if (jobRes != null) {
UUID nid = res.getNode().id();
IgniteException unhandledEx = res.getException();
if (unhandledEx == null)
reduceJobResult(taskRes, jobRes, nid);
else {
// Ignore nodes that left topology.
if (!(unhandledEx instanceof ClusterGroupEmptyException))
taskRes.getUnhandledEx().put(nid, new VisorExceptionWrapper(unhandledEx));
}
}
}
taskRes.setActive(ignite.active());
return taskRes;
}
开发者ID:apache,项目名称:ignite,代码行数:30,代码来源:VisorNodeDataCollectorTask.java
示例8: reduce0
import org.apache.ignite.compute.ComputeJobResult; //导入依赖的package包/类
/** {@inheritDoc} */
@Nullable @Override protected VisorLogSearchTaskResult reduce0(List<ComputeJobResult> results) {
List<VisorLogSearchResult> searchRes = new ArrayList<>();
Map<Exception, UUID> exRes = U.newHashMap(0);
// Separate successfully executed results and exceptions.
for (ComputeJobResult result : results) {
if (result.getException() != null)
exRes.put(result.getException(), result.getNode().id());
else if (result.getData() != null) {
Collection<VisorLogSearchResult> data = result.getData();
searchRes.addAll(data);
}
}
return new VisorLogSearchTaskResult(exRes.isEmpty() ? null : exRes, searchRes.isEmpty() ? null : searchRes);
}
开发者ID:apache,项目名称:ignite,代码行数:19,代码来源:VisorLogSearchTask.java
示例9: GridFailoverContextImpl
import org.apache.ignite.compute.ComputeJobResult; //导入依赖的package包/类
/**
* Initializes failover context.
*
* @param taskSes Grid task session.
* @param jobRes Failed job result.
* @param loadMgr Load manager.
* @param partId Partition.
* @param affCacheName Affinity cache name.
* @param topVer Affinity topology version.
*/
public GridFailoverContextImpl(GridTaskSessionImpl taskSes,
ComputeJobResult jobRes,
GridLoadBalancerManager loadMgr,
int partId,
@Nullable String affCacheName,
@Nullable AffinityTopologyVersion topVer) {
assert taskSes != null;
assert jobRes != null;
assert loadMgr != null;
this.taskSes = taskSes;
this.jobRes = jobRes;
this.loadMgr = loadMgr;
this.partId = partId;
this.affCacheName = affCacheName;
this.topVer = topVer;
}
开发者ID:apache,项目名称:ignite,代码行数:28,代码来源:GridFailoverContextImpl.java
示例10: reduce
import org.apache.ignite.compute.ComputeJobResult; //导入依赖的package包/类
/** {@inheritDoc} */
@Nullable @Override public Void reduce(List<ComputeJobResult> results) {
assert results.isEmpty() : "Should not cache result in java for interop task";
lock.readLock().lock();
try {
assert !done;
ctx.gateway().computeTaskReduce(taskPtr);
}
finally {
lock.readLock().unlock();
}
return null;
}
开发者ID:apache,项目名称:ignite,代码行数:18,代码来源:PlatformAbstractTask.java
示例11: reduce
import org.apache.ignite.compute.ComputeJobResult; //导入依赖的package包/类
/** {@inheritDoc} */
@SuppressWarnings("ThrowableResultOfMethodCallIgnored")
@Nullable @Override public GridRestResponse reduce(List<ComputeJobResult> results) throws IgniteException {
Map<String, GridCacheSqlMetadata> map = new HashMap<>();
for (ComputeJobResult r : results) {
if (!r.isCancelled() && r.getException() == null) {
for (GridCacheSqlMetadata m : r.<Collection<GridCacheSqlMetadata>>getData()) {
if (!map.containsKey(m.cacheName()))
map.put(m.cacheName(), m);
}
}
}
Collection<GridCacheSqlMetadata> metas = new ArrayList<>(map.size());
metas.addAll(map.values());
return new GridRestResponse(metas);
}
开发者ID:apache,项目名称:ignite,代码行数:21,代码来源:GridCacheCommandHandler.java
示例12: reduce
import org.apache.ignite.compute.ComputeJobResult; //导入依赖的package包/类
@Override
public String reduce(List<ComputeJobResult> results) throws IgniteException {
StringBuilder answer = new StringBuilder();
for (ComputeJobResult res : results) {
Object data = res.getData();
answer.append(data).append(",");
}
answer.deleteCharAt(answer.length() - 1);
return answer.toString();
}
开发者ID:HydAu,项目名称:Camel,代码行数:11,代码来源:TestIgniteComputeResources.java
示例13: reduce
import org.apache.ignite.compute.ComputeJobResult; //导入依赖的package包/类
/** {@inheritDoc} */
@Nullable @Override public R reduce(List<ComputeJobResult> results) {
if (!F.isEmpty(results)) {
ComputeJobResult res = results.get(0);
return res.getData();
}
else
return null;
}
开发者ID:apache,项目名称:ignite,代码行数:11,代码来源:HadoopProtocolTaskAdapter.java
示例14: reduce
import org.apache.ignite.compute.ComputeJobResult; //导入依赖的package包/类
/** {@inheritDoc} */
@Override public String reduce(List<ComputeJobResult> results) {
if (log.isInfoEnabled())
log.info("Aggregating job [job=" + this + ", results=" + results + ']');
if (results.size() != SPLIT_COUNT)
fail("Invalid results size.");
return "interrupt-task-data";
}
开发者ID:apache,项目名称:ignite,代码行数:11,代码来源:GridSessionCancelSiblingsFromFutureSelfTest.java
示例15: result
import org.apache.ignite.compute.ComputeJobResult; //导入依赖的package包/类
/** {@inheritDoc} */
@Override public ComputeJobResultPolicy result(ComputeJobResult res, List<ComputeJobResult> received) {
if (res.getException() != null)
throw res.getException();
return received.size() == SPLIT_COUNT ? ComputeJobResultPolicy.REDUCE : ComputeJobResultPolicy.WAIT;
}
开发者ID:apache,项目名称:ignite,代码行数:8,代码来源:GridSessionFutureWaitJobAttributeSelfTest.java
示例16: reduce
import org.apache.ignite.compute.ComputeJobResult; //导入依赖的package包/类
/** {@inheritDoc} */
@Override public Integer reduce(List<ComputeJobResult> results) {
if (log.isInfoEnabled())
log.info("Reducing job [job=" + this + ", results=" + results + ']');
int res = 0;
for (ComputeJobResult result : results)
res += (Integer)result.getData();
return res;
}
开发者ID:apache,项目名称:ignite,代码行数:13,代码来源:GridTaskFailoverSelfTest.java
示例17: reduce
import org.apache.ignite.compute.ComputeJobResult; //导入依赖的package包/类
/** {@inheritDoc} */
@Override public Integer reduce(List<ComputeJobResult> results) {
int sum = 0;
for (ComputeJobResult res : results)
sum += res.<Integer>getData();
return sum;
}
开发者ID:apache,项目名称:ignite,代码行数:10,代码来源:TaskCommandHandlerSelfTest.java
示例18: result
import org.apache.ignite.compute.ComputeJobResult; //导入依赖的package包/类
/** {@inheritDoc} */
@Override public ComputeJobResultPolicy result(ComputeJobResult res, List<ComputeJobResult> received) {
log.info("Task result state: " + state);
assert state != null;
assert state == testState;
return super.result(res, received);
}
开发者ID:apache,项目名称:ignite,代码行数:10,代码来源:GridTaskInstanceExecutionSelfTest.java
示例19: reduce
import org.apache.ignite.compute.ComputeJobResult; //导入依赖的package包/类
/** {@inheritDoc} */
@Override public R reduce(List<ComputeJobResult> res) {
for (ComputeJobResult r : res)
if (r.getException() == null)
return r.getData();
throw new IgniteException("Failed to find successful job result: " + res);
}
开发者ID:apache,项目名称:ignite,代码行数:9,代码来源:GridClosureProcessor.java
示例20: reduce
import org.apache.ignite.compute.ComputeJobResult; //导入依赖的package包/类
@SuppressWarnings({"ProhibitedExceptionThrown"})
@Override public Serializable reduce(List<ComputeJobResult> results) {
assert results != null;
if (failType == FailType.REDUCE)
throw new RuntimeException("Failed out of reduce method.");
return (Serializable)results;
}
开发者ID:apache,项目名称:ignite,代码行数:10,代码来源:GridRuntimeExceptionSelfTest.java
注:本文中的org.apache.ignite.compute.ComputeJobResult类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论