• 如果您觉得本站非常有看点,那么赶紧使用Ctrl+D 收藏吧

Java DistributedExecutorService类的典型用法和代码示例

java 2次浏览

本文整理汇总了Java中org.infinispan.distexec.DistributedExecutorService的典型用法代码示例。如果您正苦于以下问题:Java DistributedExecutorService类的具体用法?Java DistributedExecutorService怎么用?Java DistributedExecutorService使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。

DistributedExecutorService类属于org.infinispan.distexec包,在下文中一共展示了DistributedExecutorService类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: submitDistributable

点赞 2

import org.infinispan.distexec.DistributedExecutorService; //导入依赖的package包/类
@Override
public List<Future<Long>> submitDistributable(String cacheName,
                                              Callable<Long> callable,
                                              String... keys)
{
    Cache c = getCache(cacheName);

    DistributedExecutorService des  = new DefaultExecutorService(c);

    return des.submitEverywhere(callable, keys);

    // TODO executors will probably leak, find a better solution where I shut down an
    // executor that is not in use anymore.
}
 

开发者ID:NovaOrdis,
项目名称:playground,
代码行数:15,
代码来源:ProcessingNode.java

示例2: execute

点赞 2

import org.infinispan.distexec.DistributedExecutorService; //导入依赖的package包/类
@Override
public void execute() throws Exception
{
    Cache c = ca.getCache("SOURCE-CACHE");

    DistributedExecutorService des = new DefaultExecutorService(c);

    Callable callable = new ExampleDistributedCallable();
    //Callable<String> callable = new ExampleCallable<String>();

    List<Future<DistributedCallableResponse>> results = null;

    if (submitEverywhere)
    {
        if (keys.isEmpty())
        {
            System.out.println("> submitting everywhere, no input keys");
            results = des.submitEverywhere(callable);
            System.out.println("> submission everywhere, no input keys, ok");
        }
        else
        {
            results = des.submitEverywhere(callable, keys);
            System.out.println("> submission to all nodes ok, key set " + keys);
        }
    }
    else
    {
        Future<DistributedCallableResponse> result = des.submit(callable, keys);
        System.out.println("> submission to one node ok, key set " + keys);
        results = Arrays.asList(result);
    }

    for (Future<DistributedCallableResponse> f : results)
    {
        System.out.println("> got response from " + f.get().getNodeName());
    }

    System.out.println("> execution ok");
}
 

开发者ID:NovaOrdis,
项目名称:playground,
代码行数:41,
代码来源:LaunchDistributedCallable.java

示例3: rot

点赞 2

import org.infinispan.distexec.DistributedExecutorService; //导入依赖的package包/类
public List<Future> rot(int offset) {
    DistributedExecutorService des = new DefaultExecutorService(cache);
    return des.submitEverywhere(new Rotate(offset));
}
 

开发者ID:ugol,
项目名称:jdg-playground,
代码行数:5,
代码来源:JDG.java


版权声明:本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系管理员进行删除。
喜欢 (0)