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


Java ExecutorServices类代码示例

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


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

示例1: create_build_trigger_returns_custom_async_polled_build_trigger

import jetbrains.buildServer.serverSide.executors.ExecutorServices; //导入依赖的package包/类
public void create_build_trigger_returns_custom_async_polled_build_trigger() throws IOException {
    ExecutorServices executorServices = new SimpleExecutorServices();
    JobStatusStorageHolder jobStatusStorageHolder = new JobStatusStorageHolderImpl();
    ServiceLocator serviceLocator = new FakeServiceLocator();
    CustomAsyncBuildTriggerFactoryImpl factory = new CustomAsyncBuildTriggerFactoryImpl(executorServices, jobStatusStorageHolder, serviceLocator);
    Class<DeploymentCompleteSpec> clazz = DeploymentCompleteSpec.class;

    AnalyticsTracker analyticsTracker = new FakeAnalyticsTracker();
    String displayName = "display-name";
    CustomAsyncBuildTrigger<DeploymentCompleteSpec> trigger = new DeploymentCompleteAsyncBuildTrigger(displayName, analyticsTracker, new FakeCacheManager(), new FakeMetricRegistry(), new FakeBuildTriggerProperties());
    Logger logger = Logger.getInstance(DeploymentCompleteAsyncBuildTrigger.class.getName());
    Integer invocationInterval = 60 * 1000;

    CustomAsyncPolledBuildTrigger<DeploymentCompleteSpec> result = factory.createBuildTrigger(clazz, trigger, logger, invocationInterval);
    Assert.assertNotNull(result);

    CustomAsyncPolledBuildTrigger<DeploymentCompleteSpec> resultAsCustomTrigger = result;
    Assert.assertEquals(resultAsCustomTrigger.log, logger);
    Assert.assertEquals(resultAsCustomTrigger.asyncBuildTrigger, trigger);
    Assert.assertEquals(resultAsCustomTrigger.serviceLocator, serviceLocator);
}
 
开发者ID:matt-richardson,项目名称:teamcity-octopus-build-trigger-plugin,代码行数:22,代码来源:CustomAsyncBuildTriggerFactoryImplTest.java

示例2: setUp

import jetbrains.buildServer.serverSide.executors.ExecutorServices; //导入依赖的package包/类
@BeforeMethod
public void setUp() throws Exception {

  Mockery m = new Mockery();
  final XmlRpcHandlerManager rpcHandlerManager = m.mock(XmlRpcHandlerManager.class);
  final ExecutorServices executorServices = m.mock(ExecutorServices.class);
  myExecutorService = Executors.newScheduledThreadPool(4);
  final RootUrlHolder rootUrlHolder = m.mock(RootUrlHolder.class);
  m.checking(new Expectations() {{
    allowing(rpcHandlerManager).addHandler(with(any(String.class)), with(any(Object.class)));
    allowing(executorServices).getNormalExecutorService(); will(returnValue(myExecutorService));
    allowing(rootUrlHolder).getRootUrl(); will(returnValue("http://localhost:8111"));
  }});
  myTorrentTrackerManager = new TorrentTrackerManager(
          new TorrentConfigurator(new ServerPaths("/tmp"), rootUrlHolder, rpcHandlerManager),
          executorServices,
          new EventDispatcher<BuildServerListener>(BuildServerListener.class) {
          },
          m.mock(AddressChecker.class)
  );

}
 
开发者ID:JetBrains,项目名称:teamcity-torrent-plugin,代码行数:23,代码来源:TorrentTrackerManagerTest.java

示例3: CustomAsyncBuildTriggerFactoryImpl

import jetbrains.buildServer.serverSide.executors.ExecutorServices; //导入依赖的package包/类
public CustomAsyncBuildTriggerFactoryImpl(@NotNull ExecutorServices executorServices,
                                          @NotNull JobStatusStorageHolder jobStatusStorageHolder,
                                          @NotNull ServiceLocator serviceLocator) {
    super(executorServices, jobStatusStorageHolder);
    this.executorServices = executorServices;
    this.jobStatusStorageHolder = jobStatusStorageHolder;
    this.serviceLocator = serviceLocator;
}
 
开发者ID:matt-richardson,项目名称:teamcity-octopus-build-trigger-plugin,代码行数:9,代码来源:CustomAsyncBuildTriggerFactoryImpl.java

示例4: TorrentTrackerManager

import jetbrains.buildServer.serverSide.executors.ExecutorServices; //导入依赖的package包/类
public TorrentTrackerManager(@NotNull final TorrentConfigurator configurator,
                             @NotNull final ExecutorServices executorServices,
                             @NotNull final EventDispatcher<BuildServerListener> dispatcher,
                             @NotNull final AddressChecker addressChecker) {
  myConfigurator = configurator;
  myExecutorService = executorServices.getNormalExecutorService();

  myTrackerService = new TrackerRequestProcessor(addressChecker);
  myTrackerService.setAcceptForeignTorrents(true);
  myTorrents = new ConcurrentHashMap<String, TrackedTorrent>();
  dispatcher.addListener(new BuildServerAdapter(){
    @Override
    public void serverShutdown() {
      stopTracker();
    }

    @Override
    public void serverStartup() {
      if (configurator.isTrackerEnabled()) {
        startTracker();
      }
    }
  });
  myConfigurator.addPropertyChangeListener(new PropertyChangeListener() {
    public void propertyChange(PropertyChangeEvent evt) {
      if (evt.getNewValue() instanceof Integer){
        integerPropertyChanged(evt.getPropertyName(), (Integer) evt.getNewValue());
      } else if (evt.getNewValue() instanceof Boolean){
        booleanPropertyChanged(evt.getPropertyName(), (Boolean) evt.getNewValue());
      }
    }
  });
}
 
开发者ID:JetBrains,项目名称:teamcity-torrent-plugin,代码行数:34,代码来源:TorrentTrackerManager.java

示例5: setUp

import jetbrains.buildServer.serverSide.executors.ExecutorServices; //导入依赖的package包/类
@BeforeMethod
@Override
protected void setUp() throws Exception {
  super.setUp();
  final Mockery m = new Mockery();

  final ServerPaths serverPaths = new ServerPaths(createTempDir().getAbsolutePath());
  final RootUrlHolder rootUrlHolder = m.mock(RootUrlHolder.class);
  final ExecutorServices executorServices = m.mock(ExecutorServices.class);
  myExecutorService = Executors.newScheduledThreadPool(1);
  m.checking(new Expectations(){{
    allowing(rootUrlHolder).getRootUrl(); will(returnValue("http://localhost:8111/"));
    allowing(executorServices).getNormalExecutorService(); will(returnValue(myExecutorService));
  }});

  final ServerSettings serverSettings = m.mock(ServerSettings.class);
  m.checking(new Expectations() {{
    allowing(serverSettings).getArtifactDirectories(); will(returnValue(Collections.singletonList(serverPaths.getArtifactsDirectory())));
  }});

  myConfigurator = new TorrentConfigurator(serverPaths, rootUrlHolder, new XmlRpcHandlerManager() {
    public void addHandler(String handlerName, Object handler) {}
    public void addSessionHandler(String handlerName, Object handler) {}
  });
  myConfigurator.setDownloadEnabled(true);
  myConfigurator.setSeedingEnabled(true);

  myDispatcher = new BuildServerListenerEventDispatcher(new SecurityContextImpl());

  myTorrentsSeeder = new ServerTorrentsDirectorySeeder(serverPaths, serverSettings, myConfigurator, myDispatcher, executorServices);
}
 
开发者ID:JetBrains,项目名称:teamcity-torrent-plugin,代码行数:32,代码来源:ServerTorrentsSeederTestCase.java

示例6: setUp

import jetbrains.buildServer.serverSide.executors.ExecutorServices; //导入依赖的package包/类
@BeforeMethod
@Override
protected void setUp() throws Exception {
  super.setUp();
  Mockery m = new Mockery();
  final AddressChecker addressChecker = m.mock(AddressChecker.class);
  m.checking(new Expectations() {{
    allowing(addressChecker).isBadAddress(with(any(String.class))); will(returnValue(false));
  }});
  myTrackerManager = new TorrentTrackerManager(myConfigurator, new ExecutorServices() {
    @NotNull
    public ScheduledExecutorService getNormalExecutorService() {
      return ExecutorsFactory.newFixedScheduledExecutor("aaa", 1);
    }

    @NotNull
    public ExecutorService getLowPriorityExecutorService() {
      return null;
    }
  }, myDispatcher, addressChecker);

  myDispatcher.getMulticaster().serverStartup();

  new WaitFor(5 * 1000) {
    @Override
    protected boolean condition() {
      return !myTorrentsSeeder.getTorrentsSeeder().isStopped();
    }
  };
  assertFalse(myTorrentsSeeder.getTorrentsSeeder().isStopped());
}
 
开发者ID:JetBrains,项目名称:teamcity-torrent-plugin,代码行数:32,代码来源:TorrentTrackerConfiguratorTest.java

示例7: KubeBackgroundUpdaterImpl

import jetbrains.buildServer.serverSide.executors.ExecutorServices; //导入依赖的package包/类
public KubeBackgroundUpdaterImpl(@NotNull ExecutorServices executorServices) {
    long delay = TeamCityProperties.getLong(KUBE_POD_MONITORING_PERIOD, 60);
    executorServices.getNormalExecutorService().scheduleWithFixedDelay(this::populateInstances, delay, delay, TimeUnit.SECONDS);
}
 
开发者ID:JetBrains,项目名称:teamcity-kubernetes-plugin,代码行数:5,代码来源:KubeBackgroundUpdaterImpl.java


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