Package java.util.concurrent

Examples of java.util.concurrent.Callable


     * The bit flag associated with this column family is set in the
     * header and this is used to decide if the log file can be deleted.
    */
    public void discardCompletedSegments(final String tableName, final String cf, final CommitLogSegment.CommitLogContext context) throws IOException
    {
        Callable task = new Callable()
        {
            public Object call() throws IOException
            {
                int id = Table.open(tableName).getColumnFamilyId(cf);
                discardCompletedSegmentsInternal(context, id);
View Full Code Here


     * The bit flag associated with this column family is set in the
     * header and this is used to decide if the log file can be deleted.
    */
    void onMemtableFlush(final String tableName, final String cf, final CommitLog.CommitLogContext cLogCtx) throws IOException
    {
        Callable task = new Callable()
        {
            public Object call() throws IOException
            {
                Table table = Table.open(tableName);
                int id = table.getColumnFamilyId(cf);
View Full Code Here

public class WebAsyncTaskController {

    @RequestMapping("/webAsyncTask1")
    public WebAsyncTask<String> webAsyncTask1(final Model model) {
        long timeout = 10L * 1000; //自定义超时时间 10秒
        WebAsyncTask webAsyncTask = new WebAsyncTask(timeout, new Callable() {
            @Override
            public String call() throws Exception {
                Thread.sleep(2L * 1000);
                model.addAttribute("msg", "hello web async task");
                String viewName = "msg";
View Full Code Here

    }

    @RequestMapping("/webAsyncTask2")
    public WebAsyncTask<String> webAsyncTask2(final Model model) {
        long timeout = 10L * 1000; //自定义超时时间 1秒
        WebAsyncTask webAsyncTask = new WebAsyncTask(timeout, new Callable() {
            @Override
            public String call() throws Exception {
                Thread.sleep(2L * 1000);
                throw new RuntimeException("出错了");
            }
View Full Code Here

    @RequestMapping("/listener3")
    @ResponseBody
    public WebAsyncTask<String> listener3() {
        long timeout = 10L * 1000; //自定义超时时间 10秒
        final WebAsyncTask webAsyncTask = new WebAsyncTask(timeout, new Callable() {
            @Override
            public String call() throws Exception {
                Thread.sleep(2L * 1000);
                return "success";
            }
        });

        webAsyncTask.onTimeout(new Callable() {
            @Override
            public Object call() throws Exception {
                System.out.println("====异步任务超时了");
                return "error";
            }
View Full Code Here

    @RequestMapping("/listener4")
    @ResponseBody
    public WebAsyncTask<String> listener4() {
        long timeout = 10L * 1000; //自定义超时时间 10秒
        final WebAsyncTask webAsyncTask = new WebAsyncTask(timeout, new Callable() {
            @Override
            public String call() throws Exception {
                Thread.sleep(20L * 1000);
                return "success";
            }
        });

        webAsyncTask.onTimeout(new Callable() {
            @Override
            public Object call() throws Exception {
                System.out.println("====异步任务超时了");
                return "error";
            }
View Full Code Here

               if (log.isTraceEnabled()) {
                  log.tracef("Replicating cluster listener to other nodes %s for cluster listener with id %s",
                             members, generatedId);
               }
               Callable callable = new ClusterListenerReplicateCallable(generatedId, ourAddress, filter, converter);
               for (Address member : members) {
                  if (!member.equals(ourAddress)) {
                     decs.submit(member, callable);
                  }
               }
View Full Code Here

         throw new PersistenceException("Execution exception!", eacs.getFirstException());
      }
   }

   private void submitProcessTask(final CacheLoaderTask cacheLoaderTask, CompletionService<Void> ecs, final TaskContext taskContext, final Set<Object> batch) {
      ecs.submit(new Callable() {
         @Override
         public Object call() throws Exception {
            try {
               for (Object k : batch) {
                  if (taskContext.isStopped())
View Full Code Here

   }

   @Override
   protected Callable<?> createPushStateTask()
   {
      return new Callable()
      {
         public Object call() throws Exception
         {
            final boolean debugEnabled = log.isDebugEnabled();
View Full Code Here

   }

   @Override
   protected Callable<?> createPushStateTask()
   {
      return new Callable()
      {
         public Object call() throws Exception
         {
            final boolean debugEnabled = log.isDebugEnabled();
View Full Code Here

TOP

Related Classes of java.util.concurrent.Callable

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.