jetbrains.buildServer.serverSide.BuildServerAdapter Java Examples

The following examples show how to use jetbrains.buildServer.serverSide.BuildServerAdapter. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: KubePodNameGeneratorImpl.java    From teamcity-kubernetes-plugin with Apache License 2.0 6 votes vote down vote up
public KubePodNameGeneratorImpl(@NotNull ServerPaths serverPaths,
                            @NotNull ExecutorServices executorServices,
                            @NotNull EventDispatcher<BuildServerListener> eventDispatcher
                            ){
  myIdxStorage = new File(serverPaths.getPluginDataDirectory(), "kubeIdx");
  if (!myIdxStorage.exists()){
    myIdxStorage.mkdirs();
  }
  if (!myIdxStorage.isDirectory()){
    throw new CloudException("Unable to create a directory for kube plugin VM indexes");
  }
  myIsAvailable = new AtomicBoolean(true);

  loadIdxes(myIdxStorage);

  eventDispatcher.addListener(new BuildServerAdapter(){
    @Override
    public void serverShutdown() {
      myIsAvailable.set(false);
      storeIdxes();
    }
  });
  executorServices.getNormalExecutorService().scheduleWithFixedDelay(this::storeIdxes, 60, 60, TimeUnit.SECONDS);
}
 
Example #2
Source File: ReportsFeature.java    From appengine-tck with Apache License 2.0 6 votes vote down vote up
public ReportsFeature(EventDispatcher<BuildServerListener> dispatcher, @NotNull ReportsDescriptor descriptor, @NotNull ReportsConstants constants) {
    this.editParametersUrl = descriptor.getFeaturePath();
    this.constants = constants;
    this.jsonFactory = JacksonFactory.getDefaultInstance();

    try {
        this.httpTransport = GoogleNetHttpTransport.newTrustedTransport();
    } catch (GeneralSecurityException | IOException e) {
        throw new RuntimeException(e);
    }

    if (dispatcher != null) {
        dispatcher.addListener(new BuildServerAdapter() {
            @Override
            public void buildFinished(SRunningBuild build) {
                handleBuildFinished(build);
            }
        });
    }
}