@Override public <T> T get(Contextual<T> contextual, CreationalContext<T> creationalContext) { if (!isActive()) { throw new ContextNotActiveException(); } if (contextual == null) { throw new RuntimeException(jtaLogger.i18NLogger.get_contextual_is_null()); } PassivationCapable bean = (PassivationCapable) contextual; TransactionSynchronizationRegistry tsr = this.transactionSynchronizationRegistrySupplier.get(); Object resource = tsr.getResource(bean.getId()); if (resource != null) { return (T) resource; } else if (creationalContext != null) { Transaction currentTransaction = getCurrentTransaction(); T t = contextual.create(creationalContext); tsr.putResource(bean.getId(), t); synchronized (transactions) { TransactionScopeCleanup synch = transactions.get(currentTransaction); if (synch == null) { synch = new TransactionScopeCleanup(this, currentTransaction); transactions.put(currentTransaction, synch); } synch.registerBean(contextual, creationalContext, t); } return t; } else { return null; } }
@Override public <T> T get(Contextual<T> contextual, CreationalContext<T> creationalContext) { if (!isActive()) { throw new ContextNotActiveException(); } if (contextual == null) { throw new RuntimeException(jtaLogger.i18NLogger.get_contextual_is_null()); } PassivationCapable bean = (PassivationCapable) contextual; TransactionSynchronizationRegistry tsr = this.transactionSynchronizationRegistrySupplier.get(); Object resource = tsr.getResource(bean.getId()); if (resource != null) { return (T) resource; } else if (creationalContext != null) { Transaction currentTransaction = getCurrentTransaction(); T t = contextual.create(creationalContext); tsr.putResource(bean.getId(), t); synchronized (transactions) { TransactionScopeCleanup synch = transactions.get(currentTransaction); if (synch == null) { synch = new TransactionScopeCleanup(this, currentTransaction); transactions.put(currentTransaction, synch); } synch.registerBean(contextual, creationalContext, t); } return t; } else { return null; } }
@Override public <T> T get(Contextual<T> contextual, CreationalContext<T> creationalContext) { if (!isActive()) { throw new ContextNotActiveException(); } if (contextual == null) { throw new RuntimeException(jtaLogger.i18NLogger.get_contextual_is_null()); } PassivationCapable bean = (PassivationCapable) contextual; TransactionSynchronizationRegistry tsr = this.transactionSynchronizationRegistrySupplier.get(); Object resource = tsr.getResource(bean.getId()); if (resource != null) { return (T) resource; } else if (creationalContext != null) { Transaction currentTransaction = getCurrentTransaction(); T t = contextual.create(creationalContext); tsr.putResource(bean.getId(), t); synchronized (transactions) { TransactionScopeCleanup synch = transactions.get(currentTransaction); if (synch == null) { synch = new TransactionScopeCleanup(this, currentTransaction); transactions.put(currentTransaction, synch); } synch.registerBean(contextual, creationalContext, t); } return t; } else { return null; } }
@Override public <T> T get(Contextual<T> contextual, CreationalContext<T> creationalContext) { if (!isActive()) { throw new ContextNotActiveException(); } if (contextual == null) { throw new RuntimeException(jtaLogger.i18NLogger.get_contextual_is_null()); } PassivationCapable bean = (PassivationCapable) contextual; TransactionSynchronizationRegistry tsr = this.transactionSynchronizationRegistrySupplier.get(); Object resource = tsr.getResource(bean.getId()); if (resource != null) { return (T) resource; } else if (creationalContext != null) { Transaction currentTransaction = getCurrentTransaction(); T t = contextual.create(creationalContext); tsr.putResource(bean.getId(), t); synchronized (transactions) { TransactionScopeCleanup synch = transactions.get(currentTransaction); if (synch == null) { synch = new TransactionScopeCleanup(this, currentTransaction); transactions.put(currentTransaction, synch); } synch.registerBean(contextual, creationalContext, t); } return t; } else { return null; } }