All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.hubspot.singularity.ServerProvider Maven / Gradle / Ivy

package com.hubspot.singularity;

import java.util.concurrent.atomic.AtomicReference;

import javax.inject.Inject;

import org.eclipse.jetty.server.Server;

import com.google.common.base.Optional;
import com.google.inject.Provider;

import io.dropwizard.lifecycle.ServerLifecycleListener;

public class ServerProvider implements Provider>, ServerLifecycleListener
{
  private final AtomicReference serverHolder = new AtomicReference<>();

  @Inject
  public ServerProvider() {
  }

  @Override
  public Optional get() {
    return Optional.fromNullable(serverHolder.get());
  }

  @Override
  public void serverStarted(Server server) {
    serverHolder.set(server);
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy