use of org.glassfish.api.invocation.ComponentInvocation in project Payara by payara.
the class ComponentEnvManagerImpl method getCurrentJndiNameEnvironment.
public JndiNameEnvironment getCurrentJndiNameEnvironment() {
JndiNameEnvironment desc = null;
ComponentInvocation inv = invMgr.getCurrentInvocation();
if (inv != null) {
if (inv.componentId != null) {
desc = getJndiNameEnvironment(inv.componentId);
if (_logger.isLoggable(Level.FINEST)) {
_logger.finest("ComponentEnvManagerImpl: " + "getCurrentJndiNameEnvironment " + inv.componentId + " is " + desc.getClass());
}
}
}
return desc;
}
use of org.glassfish.api.invocation.ComponentInvocation in project Payara by payara.
the class InjectionManagerImpl method injectInstance.
public void injectInstance(Object instance, boolean invokePostConstruct) throws InjectionException {
ComponentInvocation invocation = invocationMgr.getCurrentInvocation();
if (invocation == null) {
throw new InjectionException(localStrings.getLocalString("injection-manager.null-invocation-context", "Null invocation context"));
}
JndiNameEnvironment componentEnvironment = compEnvManager.getJndiNameEnvironment(invocation.getComponentId());
if (componentEnvironment == null) {
throw new InjectionException(localStrings.getLocalString("injection-manager.no-descriptor-registered-for-invocation", "No descriptor registered for current invocation: {0}", invocation));
}
inject(instance.getClass(), instance, componentEnvironment, null, invokePostConstruct);
}
use of org.glassfish.api.invocation.ComponentInvocation in project Payara by payara.
the class EntityContextImpl method inFinder.
private boolean inFinder() {
boolean inFinder = false;
ComponentInvocation ci = _container.getCurrentInvocation();
if (ci instanceof EjbInvocation) {
EjbInvocation inv = (EjbInvocation) ci;
Method currentMethod = inv.method;
inFinder = ((currentMethod != null) && inv.isHome && currentMethod.getName().startsWith("find"));
}
return inFinder;
}
use of org.glassfish.api.invocation.ComponentInvocation in project Payara by payara.
the class ResourceManagerImpl method getTransaction.
/**
* Returns the transaction component is participating.
*
* @return Handle to the <code>Transaction</code> object.
* @exception <code>PoolingException<code>
*/
public Transaction getTransaction() throws PoolingException {
InvocationManager invmgr = ConnectorRuntime.getRuntime().getInvocationManager();
ComponentInvocation inv = invmgr.getCurrentInvocation();
if (inv == null) {
try {
return ConnectorRuntime.getRuntime().getTransaction();
} catch (Exception ex) {
return null;
}
}
return (Transaction) inv.getTransaction();
}
use of org.glassfish.api.invocation.ComponentInvocation in project Payara by payara.
the class ResourceManagerImpl method unregisterResource.
/**
* Unregister the <code>ResourceHandle</code> from the transaction
*
* @param resource <code>ResourceHandle</code> object
* @param xaresFlag flag indicating transaction success. This can
* be XAResource.TMSUCCESS or XAResource.TMFAIL
* @exception <code>PoolingException</code>
*/
public void unregisterResource(ResourceHandle resource, int xaresFlag) {
JavaEETransactionManager tm = ConnectorRuntime.getRuntime().getTransactionManager();
Transaction tran = null;
try {
// delist with TMSUCCESS if necessary
if (resource.isTransactional()) {
InvocationManager invmgr = ConnectorRuntime.getRuntime().getInvocationManager();
ComponentInvocation inv = invmgr.getCurrentInvocation();
if (inv == null) {
// in that, you return the transaction from the TxManager
try {
tran = tm.getTransaction();
} catch (Exception e) {
tran = null;
_logger.log(Level.INFO, e.getMessage());
}
} else {
tran = (Transaction) inv.getTransaction();
tm.unregisterComponentResource(resource);
}
if (tran != null && resource.isEnlisted()) {
tm.delistResource(tran, resource, xaresFlag);
}
}
} catch (SystemException ex) {
_logger.log(Level.WARNING, "poolmgr.system_exception", ex);
} catch (IllegalStateException ex) {
// transaction aborted. Do nothing
} catch (InvocationException ex) {
// unregisterResource is called outside of component context
// likely to be container-forced destroy. Do nothing
}
}
Aggregations