package de.ivu.elect.business.exchange.entity;

public class ExchangeQueueToken implements AutoCloseable {

  private final ExchangeQueue exchangeQueue;

  private final ExchangeQueueJob entry;

  ExchangeQueueToken(ExchangeQueue exchangeQueue, ExchangeQueueJob entry) {
    this.exchangeQueue = exchangeQueue;
    this.entry = entry;
  }

  @Override
  public void close() throws Exception {
    exchangeQueue.finish(entry);
  }

  public ExchangeQueueStatus getStatus() {
    return exchangeQueue.getStatus(entry);
  }
}
