removed obsolete class
This commit is contained in:
@ -1,48 +0,0 @@
|
|||||||
package de.muehlencord.shared.jeeutil;
|
|
||||||
|
|
||||||
import javax.annotation.Priority;
|
|
||||||
import javax.inject.Inject;
|
|
||||||
import javax.interceptor.AroundInvoke;
|
|
||||||
import javax.interceptor.Interceptor;
|
|
||||||
import javax.interceptor.InvocationContext;
|
|
||||||
import javax.persistence.EntityManager;
|
|
||||||
import javax.transaction.Transactional;
|
|
||||||
import static javax.transaction.Transactional.TxType.REQUIRED;
|
|
||||||
import javax.validation.constraints.NotNull;
|
|
||||||
import org.slf4j.Logger;
|
|
||||||
import org.slf4j.LoggerFactory;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @author Joern Muehlencord <joern at muehlencord.de>
|
|
||||||
*/
|
|
||||||
@Transactional(value = REQUIRED)
|
|
||||||
@Interceptor
|
|
||||||
@Priority(value=TransactionJoinInterceptor.PRIORITY)
|
|
||||||
public class TransactionJoinInterceptor {
|
|
||||||
|
|
||||||
private static final Logger LOGGER = LoggerFactory.getLogger(TransactionJoinInterceptor.class);
|
|
||||||
|
|
||||||
// attach behind the interceptor of the container
|
|
||||||
public static final int PRIORITY = Interceptor.Priority.PLATFORM_BEFORE+250;
|
|
||||||
|
|
||||||
private final EntityManager em;
|
|
||||||
|
|
||||||
@Inject
|
|
||||||
public TransactionJoinInterceptor(@NotNull EntityManager em) {
|
|
||||||
this.em = em;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
@AroundInvoke
|
|
||||||
public Object joinTransaction(InvocationContext context) throws Exception {
|
|
||||||
if (em.isJoinedToTransaction()) {
|
|
||||||
LOGGER.trace("transaction already joined");
|
|
||||||
} else {
|
|
||||||
LOGGER.trace("joining transaction");
|
|
||||||
em.joinTransaction();
|
|
||||||
}
|
|
||||||
return context.proceed();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Reference in New Issue
Block a user