
package de.ivu.elect.business.internet.control;

import java.util.concurrent.atomic.AtomicBoolean;
import java.util.concurrent.atomic.AtomicLong;

import javax.ejb.DependsOn;
import javax.ejb.Singleton;
import javax.ejb.Startup;
import javax.ejb.TransactionManagement;
import javax.ejb.TransactionManagementType;
import javax.inject.Inject;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import de.ivu.elect.background.scheduler.AbstractSchedulerBackgroundService;
import de.ivu.elect.business.ergebnis.entity.ErgebnisPK;

@Startup
@Singleton
@DependsOn("DbInit")
// https://issues.jboss.org/browse/EJBTHREE-2070 (keine Transaktion)
@TransactionManagement(TransactionManagementType.BEAN)
public class PresentationGenerierenInternetBackgroundService extends AbstractSchedulerBackgroundService<ErgebnisPK> {

  private static final Logger LOG = LoggerFactory.getLogger(PresentationGenerierenInternetBackgroundService.class);

  public static final AtomicLong RUNNING = createRunning();

  public static final AtomicBoolean DISABLED = createDisabled();

  @Inject
  private transient PresentationGenerierenAsync async;

  @Inject
  private transient PresentationGenerieren transaction;

  @Override
  protected PresentationGenerierenAsync getServiceAsync() {
    return async;
  }

  @Override
  protected PresentationGenerieren getServiceTransaction() {
    return transaction;
  }

  @Override
  protected Logger getLogInternal() {
    return LOG;
  }

  @Override
  protected AtomicBoolean getDisabledInternal() {
    return DISABLED;
  }

  @Override
  protected AtomicLong getRunning() {
    return RUNNING;
  }
}