@Override public final IllegalLoopbackException failToUpgradeToWriteLock() { final IllegalLoopbackException result = new IllegalLoopbackException(String.format(getLoggingLocale(), failToUpgradeToWriteLock$str())); final StackTraceElement[] st = result.getStackTrace(); result.setStackTrace(Arrays.copyOfRange(st, 1, st.length)); return result; } private static final String componentIsNull = "WFLYEJB0239: %s cannot be null";
public static void lockWrite(ReentrantReadWriteLock lock) { if (lock.getReadHoldCount() > 0 && lock.getWriteHoldCount() == 0) { throw new IllegalLoopbackException(L.l("Cannot attempt a nested write lock without an existing write lock.")); } lock.writeLock().lock(); }
public static void lockWrite(ReentrantReadWriteLock lock, long timeout) { if (lock.getReadHoldCount() > 0 && lock.getWriteHoldCount() == 0) { throw new IllegalLoopbackException(L.l("Cannot attempt a nested write lock without an existing write lock.")); } try { if (! lock.writeLock().tryLock(timeout, TimeUnit.MILLISECONDS)) throw new ConcurrentAccessTimeoutException(L.l("Timed out acquiring write lock {0}ms.", timeout)); } catch (InterruptedException e) { throw new ConcurrentAccessTimeoutException(L.l("Thread interruption acquiring write lock: " + e.getMessage())); } } }
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); } } }
(!rwLock.isWriteLockedByCurrentThread()) ) { if( lockInfo.isWriteLockedMethod() ) { throw new IllegalLoopbackException("Illegal Reentrant Access : Attempt to make " + "a loopback call on a Write Lock method '" + invInfo.targetMethod1 + "' while a Read lock is already held");
(!rwLock.isWriteLockedByCurrentThread()) ) { if( lockInfo.isWriteLockedMethod() ) { throw new IllegalLoopbackException("Illegal Reentrant Access : Attempt to make " + "a loopback call on a Write Lock method '" + invInfo.targetMethod1 + "' while a Read lock is already held");