org.redisson.api.mapreduce.RCollator Java Examples

The following examples show how to use org.redisson.api.mapreduce.RCollator. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: CoordinatorTask.java    From redisson with Apache License 2.0 5 votes vote down vote up
public CoordinatorTask(BaseMapperTask<KOut, VOut> mapperTask, RReducer<KOut, VOut> reducer, 
        String mapName, String resultMapName, Class<?> mapCodecClass, Class<?> objectClass,
        RCollator<KOut, VOut, Object> collator, long timeout, long startTime) {
    super();
    this.mapperTask = mapperTask;
    this.reducer = reducer;
    this.objectName = mapName;
    this.objectCodecClass = mapCodecClass;
    this.objectClass = objectClass;
    this.resultMapName = resultMapName;
    this.collator = collator;
    this.timeout = timeout;
    this.startTime = startTime;
}
 
Example #2
Source File: MapReduceExecutor.java    From redisson with Apache License 2.0 5 votes vote down vote up
private <R> RFuture<R> executeMapperAsync(String resultMapName, RCollator<KOut, VOut, R> collator) {
    if (mapper == null) {
        throw new NullPointerException("Mapper is not defined");
    }
    if (reducer == null) {
        throw new NullPointerException("Reducer is not defined");
    }
    
    Callable<Object> task = createTask(resultMapName, (RCollator<KOut, VOut, Object>) collator);
    return (RFuture<R>) executorService.submit(task);
}
 
Example #3
Source File: CollatorTask.java    From redisson with Apache License 2.0 5 votes vote down vote up
public CollatorTask(RedissonClient redisson, RCollator<KOut, VOut, R> collator, String resultMapName, Class<?> codecClass) {
    super();
    this.redisson = redisson;
    this.collator = collator;
    this.resultMapName = resultMapName;
    this.codecClass = codecClass;
}
 
Example #4
Source File: TracingRMapReduceExecutor.java    From java-redis-client with Apache License 2.0 4 votes vote down vote up
@Override
public <R> R execute(RCollator<KOut, VOut, R> collator) {
  Span span = tracingRedissonHelper.buildSpan("execute");
  span.setTag("collator", nullable(collator));
  return tracingRedissonHelper.decorate(span, () -> executor.execute(collator));
}
 
Example #5
Source File: TracingRMapReduceExecutor.java    From java-redis-client with Apache License 2.0 4 votes vote down vote up
@Override
public <R> RFuture<R> executeAsync(RCollator<KOut, VOut, R> collator) {
  Span span = tracingRedissonHelper.buildSpan("executeAsync");
  span.setTag("collator", nullable(collator));
  return tracingRedissonHelper.prepareRFuture(span, () -> executor.executeAsync(collator));
}
 
Example #6
Source File: MapReduceExecutor.java    From redisson with Apache License 2.0 4 votes vote down vote up
@Override
public <R> R execute(RCollator<KOut, VOut, R> collator) {
    return connectionManager.getCommandExecutor().get(executeAsync(collator));
}
 
Example #7
Source File: MapReduceExecutor.java    From redisson with Apache License 2.0 4 votes vote down vote up
@Override
public <R> RFuture<R> executeAsync(final RCollator<KOut, VOut, R> collator) {
    check(collator);
    
    return executeMapperAsync(resultMapName, collator);
}
 
Example #8
Source File: RedissonCollectionMapReduce.java    From redisson with Apache License 2.0 4 votes vote down vote up
@Override
protected Callable<Object> createTask(String resultMapName, RCollator<KOut, VOut, Object> collator) {
    CollectionMapperTask<VIn, KOut, VOut> mapperTask = new CollectionMapperTask<VIn, KOut, VOut>(mapper, objectClass, objectCodec.getClass());
    return new CoordinatorTask<KOut, VOut>(mapperTask, reducer, objectName, resultMapName, objectCodec.getClass(), objectClass, collator, timeout, System.currentTimeMillis());
}
 
Example #9
Source File: RedissonMapReduce.java    From redisson with Apache License 2.0 4 votes vote down vote up
@Override
protected Callable<Object> createTask(String resultMapName, RCollator<KOut, VOut, Object> collator) {
    MapperTask<KIn, VIn, KOut, VOut> mapperTask = new MapperTask<KIn, VIn, KOut, VOut>(mapper, objectClass, objectCodec.getClass());
    return new CoordinatorTask<KOut, VOut>(mapperTask, reducer, objectName, resultMapName, objectCodec.getClass(), objectClass, collator, timeout, System.currentTimeMillis());
}
 
Example #10
Source File: MapReduceExecutor.java    From redisson with Apache License 2.0 votes vote down vote up
protected abstract Callable<Object> createTask(String resultMapName, RCollator<KOut, VOut, Object> collator);