当前位置: 首页>>代码示例>>Java>>正文


Java AbstractExecutorService类代码示例

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


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

示例1: immediateExecutorService

import java.util.concurrent.AbstractExecutorService; //导入依赖的package包/类
private ExecutorService immediateExecutorService() {
  return new AbstractExecutorService() {
    @Override public void shutdown() {

    }

    @Override public List<Runnable> shutdownNow() {
      return null;
    }

    @Override public boolean isShutdown() {
      return false;
    }

    @Override public boolean isTerminated() {
      return false;
    }

    @Override public boolean awaitTermination(long l, TimeUnit timeUnit) throws InterruptedException {
      return false;
    }

    @Override public void execute(Runnable runnable) {
      runnable.run();
    }
  };
}
 
开发者ID:apollographql,项目名称:apollo-android,代码行数:28,代码来源:ApolloWatcherTest.java

示例2: EmptyFunctionBlacklist

import java.util.concurrent.AbstractExecutorService; //导入依赖的package包/类
public EmptyFunctionBlacklist() {
  super("EMPTY", new AbstractExecutorService() {

    @Override
    public void shutdown() {
    }

    @Override
    public List<Runnable> shutdownNow() {
      return null;
    }

    @Override
    public boolean isShutdown() {
      return true;
    }

    @Override
    public boolean isTerminated() {
      return true;
    }

    @Override
    public boolean awaitTermination(final long timeout, final TimeUnit unit) throws InterruptedException {
      return true;
    }

    @Override
    public void execute(final Runnable command) {
    }

  });
}
 
开发者ID:DevStreet,项目名称:FinanceAnalytics,代码行数:34,代码来源:EmptyFunctionBlacklist.java

示例3: getDefaultExecutorService

import java.util.concurrent.AbstractExecutorService; //导入依赖的package包/类
@Override
protected ExecutorService getDefaultExecutorService() {
    if (isMultiThreaded()) {
        return super.getDefaultExecutorService();
    }
    return new AbstractExecutorService() {

        boolean terminated;

        public void shutdown() {
            terminated = true;
        }

        public List<Runnable> shutdownNow() {
            shutdown();
            return null;
        }

        public boolean isShutdown() {
            return terminated;
        }

        public boolean isTerminated() {
            return terminated;
        }

        public boolean awaitTermination(long l, TimeUnit timeUnit) throws InterruptedException {
            shutdown();
            return terminated;
        }

        public void execute(Runnable runnable) {
            runnable.run();
        }
    };
}
 
开发者ID:offbye,项目名称:DroidDLNA,代码行数:37,代码来源:MockUpnpServiceConfiguration.java

示例4: FriendlyCompletionService

import java.util.concurrent.AbstractExecutorService; //导入依赖的package包/类
public FriendlyCompletionService(Executor executor) {
    if (executor == null)
        throw new NullPointerException();
    this.executor = executor;

    if (executor instanceof AbstractExecutorService) {
        this.aes = (AbstractExecutorService) executor;
    } else {
        this.aes = null;
    }

    this.completionQueue = new LinkedBlockingQueue<Future<V>>();
}
 
开发者ID:riotopsys,项目名称:Factotum,代码行数:14,代码来源:FriendlyCompletionService.java

示例5: newSynchronousExecutorService

import java.util.concurrent.AbstractExecutorService; //导入依赖的package包/类
/**
 * Create an {@link ExecutorService} which runs jobs in main thread.
 */
public static ExecutorService newSynchronousExecutorService() {
    return new AbstractExecutorService() {
        @Override
        public void execute(Runnable command) {
            command.run();
        }

        @Override
        public void shutdown() {
            throw new UnsupportedOperationException();
        }

        @Override
        public List<Runnable> shutdownNow() {
            throw new UnsupportedOperationException();
        }

        @Override
        public boolean isShutdown() {
            throw new UnsupportedOperationException();
        }

        @Override
        public boolean isTerminated() {
            throw new UnsupportedOperationException();
        }

        @Override
        public boolean awaitTermination(long timeout, TimeUnit unit) throws InterruptedException {
            throw new UnsupportedOperationException();
        }
    };
}
 
开发者ID:Yelp,项目名称:yelp-android,代码行数:37,代码来源:AsyncTestUtils.java

示例6: pendClientTask

import java.util.concurrent.AbstractExecutorService; //导入依赖的package包/类
public void pendClientTask(ClientTask task, AbstractExecutorService executor) {
    if (sessionCreatedOnServer.get()) {
        executor.execute(task);
    } else {
        synchronized (sessionCreatedOnServer) {
            if (sessionCreatedOnServer.get()) {
                executor.execute(task);
            } else {
                pendingTasks.add(task);
            }
        }
    }
}
 
开发者ID:igniterealtime,项目名称:Openfire-connectionmanager,代码行数:14,代码来源:ClientSession.java

示例7: onSessionCreatedOnServer

import java.util.concurrent.AbstractExecutorService; //导入依赖的package包/类
public void onSessionCreatedOnServer(AbstractExecutorService executor) {
    synchronized (sessionCreatedOnServer) {
        if (!sessionCreatedOnServer.get()) {
            for (ClientTask task : pendingTasks) {
                executor.execute(task);
            }
            pendingTasks = null;
        }
        sessionCreatedOnServer.compareAndSet(false, true);
    }
}
 
开发者ID:igniterealtime,项目名称:Openfire-connectionmanager,代码行数:12,代码来源:ClientSession.java

示例8: ExecutorServiceThreadPool

import java.util.concurrent.AbstractExecutorService; //导入依赖的package包/类
public ExecutorServiceThreadPool(final AbstractExecutorService pool) {
    this.pool = pool;
}
 
开发者ID:iterate-ch,项目名称:cyberduck,代码行数:4,代码来源:ExecutorServiceThreadPool.java

示例9: executor

import java.util.concurrent.AbstractExecutorService; //导入依赖的package包/类
@Override
public AbstractExecutorService executor() {
    return pool;
}
 
开发者ID:iterate-ch,项目名称:cyberduck,代码行数:5,代码来源:ExecutorServiceThreadPool.java

示例10: wrapExecutor

import java.util.concurrent.AbstractExecutorService; //导入依赖的package包/类
private static ExecutorService wrapExecutor(final Executor executor)
{
    return new AbstractExecutorService()
    {
        private volatile boolean isShutdown = false;
        private volatile boolean isTerminated = false;

        @Override
        public void shutdown()
        {
            isShutdown = true;
        }

        @Override
        public List<Runnable> shutdownNow()
        {
            return Lists.newArrayList();
        }

        @Override
        public boolean isShutdown()
        {
            return isShutdown;
        }

        @Override
        public boolean isTerminated()
        {
            return isTerminated;
        }

        @Override
        public boolean awaitTermination(long timeout, TimeUnit unit) throws InterruptedException
        {
            throw new UnsupportedOperationException();
        }

        @Override
        public void execute(Runnable command)
        {
            try
            {
                executor.execute(command);
            }
            finally
            {
                isShutdown = true;
                isTerminated = true;
            }
        }
    };
}
 
开发者ID:apache,项目名称:curator,代码行数:53,代码来源:LeaderSelector.java

示例11: beforeSuite

import java.util.concurrent.AbstractExecutorService; //导入依赖的package包/类
@BeforeClass
public static void beforeSuite() {
  executorContext = Mockito.mock(ExecutorContext.class);
  executor = Executors.newSingleThreadScheduledExecutor();
  Mockito.when(executorContext.getApiExecutor()).thenReturn(new AbstractExecutorService() {

    @Override
    public void execute(Runnable command) {
      command.run();
    }

    @Override
    public List<Runnable> shutdownNow() {
      // TODO Auto-generated method stub
      return null;
    }

    @Override
    public void shutdown() {
      // TODO Auto-generated method stub

    }

    @Override
    public boolean isTerminated() {
      // TODO Auto-generated method stub
      return false;
    }

    @Override
    public boolean isShutdown() {
      // TODO Auto-generated method stub
      return false;
    }

    @Override
    public boolean awaitTermination(long timeout, TimeUnit unit) throws InterruptedException {
      // TODO Auto-generated method stub
      return false;
    }
  });
  Mockito.when(executorContext.getCallbackExecutor()).thenReturn(executor);
  Mockito.when(executorContext.getScheduledExecutor()).thenReturn(executor);
}
 
开发者ID:kaaproject,项目名称:kaa,代码行数:45,代码来源:DefaultLogCollectorTest.java

示例12: TestSession

import java.util.concurrent.AbstractExecutorService; //导入依赖的package包/类
protected TestSession(
    final UUID theIdentifier,
    final AbstractExecutorService theDelegationExecutorService,
    final int bufferSize) {
  super(theIdentifier, theDelegationExecutorService, bufferSize);
}
 
开发者ID:ianj-als,项目名称:omtc,代码行数:7,代码来源:SessionTests.java

示例13: executor

import java.util.concurrent.AbstractExecutorService; //导入依赖的package包/类
AbstractExecutorService executor(); 
开发者ID:iterate-ch,项目名称:cyberduck,代码行数:2,代码来源:ThreadPool.java


注:本文中的java.util.concurrent.AbstractExecutorService类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。