notifySession = (ctx.getInstance() instanceof javax.ejb.SessionSynchronization);
protected Object getKey(EnterpriseContext ctx) { return ctx.getId(); }
public void clear() { super.clear(); hasTxSynchronization = false; valid = false; readOnly = false; key = null; persistenceCtx = null; ejbObject = null; ejbLocalObject = null; txAssociation = GlobalTxEntityMap.NONE; passivateAfterCommit = false; }
protected boolean canPassivate(EnterpriseContext ctx) { if (ctx.isLocked()) { // The context is in the interceptor chain return false; } else if (m_container.getLockManager().canPassivate(ctx.getId()) == false) { return false; } else { if (ctx.getTransaction() != null) { try { return (ctx.getTransaction().getStatus() == Status.STATUS_NO_TRANSACTION); } catch (SystemException e) { // SA FIXME: not sure what to do here return false; } } } return true; }
protected boolean canPassivate(EnterpriseContext ctx) { if (ctx.isLocked()) { // The context is in the interceptor chain return false; } if (ctx.getTransaction() != null) { return false; } Object key = ((EntityEnterpriseContext)ctx).getCacheKey(); return m_container.getLockManager().canPassivate(key); }
public void discard(EnterpriseContext ctx) { if( log.isTraceEnabled() ) { String msg = "Discard instance:"+this+"#"+ctx +"#"+ctx.getTransaction() +"#"+reclaim +"#"+getContainer().getBeanClass(); log.trace(msg); } // If we block when maxSize instances are in use, invoke release on strictMaxSize if( strictMaxSize != null ) strictMaxSize.release(); // Throw away, unsetContext() try { ctx.discard(); } catch (RemoteException e) { if( log.isTraceEnabled() ) log.trace("Ctx.discard error", e); } }
EnterpriseBeanPolicyContextHandler.setEnterpriseBean(ctx.getInstance()); if (ctx.getTransaction() != null && !ctx.getTransaction().equals(mi.getTransaction())) msg.append(", contextTx: " + ctx.getTransaction()); msg.append(", methodTx: " + mi.getTransaction()); throw new EJBException(msg.toString()); if (ctx.getTransaction() == null && mi.getTransaction() != null) if (!ctx.isLocked()) ctx.lock(); ctx.lock(); ctx.unlock(); if (ctx.getId() == null)
if (ctx.getTransaction() == null) ctx.setTransaction(mi.getTransaction()); Object bean = ctx.getInstance(); return mi.performCall(bean, m, mi.getArguments());
ctx.setTransaction(null); ctx.unlock(); if (status == Status.STATUS_COMMITTED) afterCompletion.invoke(ctx.getInstance(), new Object[]{Boolean.TRUE}); afterCompletion.invoke(ctx.getInstance(), new Object[]{Boolean.FALSE});
if ( (ctx != null) && (ctx.getId () != null) ) Boolean modified = (Boolean) isModified.invoke (ctx.getInstance (), new Object[0]); if (modified.booleanValue ()) synchronizeState (ctx);
public void beforeCompletion() { if( log.isTraceEnabled() ) log.trace("beforeCompletion called"); // lock the context the transaction is being commited (no need for sync) ctx.lock(); beforeCompletionInvoked = true; if (notifySession) { try { AllowedOperationsAssociation.pushInMethodFlag(IN_BEFORE_COMPLETION); container.pushENC(); beforeCompletion.invoke(ctx.getInstance(), new Object[0]); } catch (Exception e) { log.error("failed to invoke beforeCompletion", e); } finally { container.popENC(); AllowedOperationsAssociation.popInMethodFlag(); } } }
+"#"+ctx.getId() +"#"+ctx.getTransaction() +"#"+reclaim +"#"+getContainer().getBeanClass(); ctx.clear();
public Object invoke(Invocation mi) throws Exception { // Apply any custom security checks if( securityProxy != null ) { EnterpriseContext ectx = (EnterpriseContext)mi.getEnterpriseContext(); Object bean = ectx.getInstance(); EJBContext ctx = ectx.getEJBContext(); Object[] args = mi.getArguments(); securityProxy.setEJBContext(ctx); try { securityProxy.invoke(mi.getMethod(), args, bean); } catch(SecurityException e) { Principal principal = mi.getPrincipal(); String msg = "SecurityProxy.invoke exception, principal="+principal; log.error(msg, e); throw e; } } return getNext().invoke(mi); } }
ctx.setPrincipal(mi.getPrincipal()); EnterpriseBeanPolicyContextHandler.setEnterpriseBean(ctx.getInstance());
userTransaction.set(ctx.getEJBContext().getUserTransaction()); Transaction beanTx = ctx.getTransaction();
public Principal getCallerPrincipal() { EJBContextImpl ctxImpl = (EJBContextImpl) getEJBContext(); return ctxImpl.getCallerPrincipalInternal(); }
public TimerService getTimerService() throws IllegalStateException { return getContainer().getTimerService(null); }
public synchronized void discard(EnterpriseContext ctx) { // Throw away try { ctx.discard(); } catch (RemoteException e) { // DEBUG Logger.exception(e); } // Notify waiters inUse = false; this.notifyAll(); }
public void setPrincipal(Principal principal) { this.principal = principal; /* Clear the bean principal used for getCallerPrincipal and synch with the new call principal */ this.beanPrincipal = null; if( con.getSecurityManager() != null ) this.beanPrincipal = getCallerPrincipal(); }