private void handleConcurrentInvocation(boolean allowSerializedAccess, EjbInvocation inv, SessionContextImpl sc, Object sessionKey) { if (_logger.isLoggable(TRACE_LEVEL)) { logTraceInfo(inv, sessionKey, "Another invocation in progress"); } if( allowSerializedAccess ) { // Check for loopback call to avoid deadlock. if( sc.getStatefulWriteLock().getHoldCount() > 1 ) { throw new IllegalLoopbackException("Illegal Reentrant Access : Attempt to make " + "a loopback call on method '" + inv.beanMethod + " for stateful session bean " + ejbDescriptor.getName()); } } else { String errMsg = "Concurrent Access attempt on method " + inv.beanMethod + " of SessionBean " + ejbDescriptor.getName() + " is prohibited. SFSB instance is executing another request. " + "[session-key: " + sessionKey + "]"; ConcurrentAccessException conEx = new ConcurrentAccessException(errMsg); if (inv.isBusinessInterface) { throw conEx; } else { // there is an invocation in progress for this instance // throw an exception (EJB2.0 section 7.5.6). throw new EJBException(conEx); } } }
private void handleConcurrentInvocation(boolean allowSerializedAccess, EjbInvocation inv, SessionContextImpl sc, Object sessionKey) { if (_logger.isLoggable(TRACE_LEVEL)) { logTraceInfo(inv, sessionKey, "Another invocation in progress"); } if( allowSerializedAccess ) { // Check for loopback call to avoid deadlock. if( sc.getStatefulWriteLock().getHoldCount() > 1 ) { throw new IllegalLoopbackException("Illegal Reentrant Access : Attempt to make " + "a loopback call on method '" + inv.beanMethod + " for stateful session bean " + ejbDescriptor.getName()); } } else { String errMsg = "Concurrent Access attempt on method " + inv.beanMethod + " of SessionBean " + ejbDescriptor.getName() + " is prohibited. SFSB instance is executing another request. " + "[session-key: " + sessionKey + "]"; ConcurrentAccessException conEx = new ConcurrentAccessException(errMsg); if (inv.isBusinessInterface) { throw conEx; } else { // there is an invocation in progress for this instance // throw an exception (EJB2.0 section 7.5.6). throw new EJBException(conEx); } } }
@Override public int getHoldCount() { return writeLock.getHoldCount(); }