當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。