class Jta {

    public static void configure(TransactionManager transactionManager, UserTransaction userTransaction) {
        synchronized (initLock) {
            if (Jta.frozen) {
                if (transactionManager != Jta.transactionManager || userTransaction != Jta.userTransaction) {
                    throw new IllegalStateException("JTA configured is frozen and attempt was made to reconfigure it.");
                }
            }
            if (userTransaction == null && transactionManager != null) {
                throw new IllegalArgumentException("TransactionManager has a value but UserTransaction is null, please provide a complete JTA configuration.");
            }
            if (userTransaction != null && transactionManager == null) {
                throw new IllegalArgumentException("UserTransaction has a value but TransactionManager is null, please provide a complete JTA configuration.");
            }
            Jta.transactionManager = transactionManager;
            Jta.userTransaction = userTransaction;
            Jta.frozen = true;
        }
    }

    private  Jta();

}