String property = JTA;
if (!DUMMY_TM.equalsIgnoreCase(property)) {
System.out.println("Transaction manager used: JBossTM");
final String lookup = JBossStandaloneJTAManagerLookup.class.getName();
final JBossStandaloneJTAManagerLookup instance = new JBossStandaloneJTAManagerLookup();
operations = new Operations() {
@Override
public UserTransaction getUserTransaction() {
try {
return instance.getUserTransaction();
}
catch (Exception e) {
throw new RuntimeException(e);
}
}
@Override
public void cleanup() {
}
@Override
public String getLookup() {
return lookup;
}
@Override
public TransactionManagerLookup lookup() {
return instance;
}
@Override
public TransactionManager getManager() {
try {
return instance.getTransactionManager();
}
catch (Exception e) {
throw new RuntimeException(e);
}
}
};
} else {
System.out.println("Transaction manager used: Dummy");
final String lookup = DummyTransactionManagerLookup.class.getName();
final DummyTransactionManagerLookup instance = new DummyTransactionManagerLookup();
operations = new Operations() {
@Override
public UserTransaction getUserTransaction() {
return instance.getUserTransaction();
}
@Override
public void cleanup() {
instance.cleanup();
}
@Override
public String getLookup() {
return lookup;
}
@Override
public TransactionManagerLookup lookup() {
return instance;
}
@Override
public TransactionManager getManager() {
try {
return instance.getTransactionManager();
}
catch (Exception e) {
throw new RuntimeException(e);
}