package de.ivu.elect.jee.cdi;

import javax.naming.InitialContext;
import javax.naming.NamingException;
import javax.transaction.TransactionSynchronizationRegistry;

public class TransactionSynchronizationRegistryUtil {

  public static TransactionSynchronizationRegistry getTransactionSynchronizationRegistry() {
    try {
      InitialContext initialContext = new InitialContext();
      return (TransactionSynchronizationRegistry) initialContext.lookup("java:comp/TransactionSynchronizationRegistry");
    } catch (NamingException e) {
      throw new RuntimeException(e.getMessage(), e);
    }
  }
}

