@Override public final EJBException unexpectedError(final Throwable cause) { final EJBException result = new EJBException(String.format(getLoggingLocale(), unexpectedError$str())); result.initCause(cause); final StackTraceElement[] st = result.getStackTrace(); result.setStackTrace(Arrays.copyOfRange(st, 1, st.length)); return result; } private static final String transactionNotComplete1 = "WFLYEJB0443: EJB 3.1 FR 13.3.3: BMT bean %s should complete transaction before returning.";
private static void handleThrowable(Throwable t, StatefulSessionComponentInstance statefulSessionComponentInstance) { ROOT_LOGGER.discardingStatefulComponent(statefulSessionComponentInstance, t); try { // discard the SFSB instance statefulSessionComponentInstance.discard(); } finally { // release the lock associated with the SFSB instance releaseLock(statefulSessionComponentInstance); } // throw back an appropriate exception if (t instanceof RuntimeException) throw (RuntimeException) t; if (t instanceof Error) throw (Error) t; throw (EJBException) new EJBException().initCause(t); } }
/** * Create EJBException using the exception that is passed in */ protected EJBException createEJBException( Exception ex ) { EJBException ejbEx = new EJBException(); ejbEx.initCause(ex); return ejbEx; }
/** * Create EJBException using the exception that is passed in */ private EJBException createEJBException( Exception ex ) { EJBException ejbEx = new EJBException(); ejbEx.initCause(ex); return ejbEx; }
public Object proceed() throws Exception { try { return context.proceed(); } catch (final Exception e) { throw e; } catch (final Error e) { throw e; } catch (final Throwable t) { final EJBException e = new EJBException(); e.initCause(t); throw e; } } }
public void remove() throws RemoveException, EJBException { // authorization is performed within container try { container.removeBean(this, REMOVE_METHOD, true); } catch(java.rmi.RemoteException re) { // This should never be thrown for local invocations, but it's // part of the removeBean signature. If for some strange // reason it happens, convert to EJBException EJBException ejbEx =new EJBException("unexpected RemoteException"); ejbEx.initCause(re); throw ejbEx; } }
public void remove() throws RemoveException, EJBException { // authorization is performed within container try { container.removeBean(this, REMOVE_METHOD, true); } catch(java.rmi.RemoteException re) { // This should never be thrown for local invocations, but it's // part of the removeBean signature. If for some strange // reason it happens, convert to EJBException EJBException ejbEx =new EJBException("unexpected RemoteException"); ejbEx.initCause(re); throw ejbEx; } }
public Collection<Timer> getTimers() throws IllegalStateException, EJBException { checkCallPermission(); Collection timerIds = new HashSet(); if( ejbContext_.isTimedObject() ) { try { timerIds = timerService_.getTimerIds (containerId_, getTimedObjectPrimaryKey()); } catch(Exception fe) { EJBException ejbEx = new EJBException(); ejbEx.initCause(fe); throw ejbEx; } } Collection<Timer> timerWrappers = new HashSet(); for(Iterator iter = timerIds.iterator(); iter.hasNext();) { TimerPrimaryKey next = (TimerPrimaryKey) iter.next(); timerWrappers.add( new TimerWrapper(next, timerService_) ); } return timerWrappers; }
public Collection<Timer> getTimers() throws IllegalStateException, EJBException { checkCallPermission(); Collection timerIds = new HashSet(); if( ejbContext_.isTimedObject() ) { try { timerIds = timerService_.getTimerIds (ejbDescriptor_.getUniqueId(), getTimedObjectPrimaryKey()); } catch(Exception fe) { EJBException ejbEx = new EJBException(); ejbEx.initCause(fe); throw ejbEx; } } Collection<Timer> timerWrappers = new HashSet(); for(Iterator iter = timerIds.iterator(); iter.hasNext();) { TimerPrimaryKey next = (TimerPrimaryKey) iter.next(); timerWrappers.add( new TimerWrapper(next, timerService_) ); } return timerWrappers; }
EJBLocalObjectImpl getEJBLocalBusinessObjectImpl(Object sessionKey) { // Create an EJBLocalObject reference which // is *not* associated with a SessionContext. That way, the // session bean context lookup will be done lazily whenever // the reference is actually accessed. This avoids I/O in the // case that the reference points to a passivated session bean. // It's also consistent with the deserialization approach used // throughout the container. e.g. a timer reference is deserialized // from its handle without checking it against the timer database. EJBLocalObjectImpl localBusinessObjImpl; try { localBusinessObjImpl = instantiateEJBLocalBusinessObjectImpl(); localBusinessObjImpl.setKey(sessionKey); } catch (Exception ex) { EJBException ejbEx = new EJBException(); ejbEx.initCause(ex); throw ejbEx; } return localBusinessObjImpl; }
EJBLocalObjectImpl getOptionalEJBLocalBusinessObjectImpl(Object sessionKey) { // Create an EJBLocalObject reference which // is *not* associated with a SessionContext. That way, the // session bean context lookup will be done lazily whenever // the reference is actually accessed. This avoids I/O in the // case that the reference points to a passivated session bean. // It's also consistent with the deserialization approach used // throughout the container. e.g. a timer reference is deserialized // from its handle without checking it against the timer database. EJBLocalObjectImpl localBusinessObjImpl; try { localBusinessObjImpl = instantiateOptionalEJBLocalBusinessObjectImpl(); localBusinessObjImpl.setKey(sessionKey); } catch (Exception ex) { EJBException ejbEx = new EJBException(); ejbEx.initCause(ex); throw ejbEx; } return localBusinessObjImpl; }
EJBLocalObjectImpl getOptionalEJBLocalBusinessObjectImpl(Object sessionKey) { // Create an EJBLocalObject reference which // is *not* associated with a SessionContext. That way, the // session bean context lookup will be done lazily whenever // the reference is actually accessed. This avoids I/O in the // case that the reference points to a passivated session bean. // It's also consistent with the deserialization approach used // throughout the container. e.g. a timer reference is deserialized // from its handle without checking it against the timer database. EJBLocalObjectImpl localBusinessObjImpl; try { localBusinessObjImpl = instantiateOptionalEJBLocalBusinessObjectImpl(); localBusinessObjImpl.setKey(sessionKey); } catch (Exception ex) { EJBException ejbEx = new EJBException(); ejbEx.initCause(ex); throw ejbEx; } return localBusinessObjImpl; }
protected void addPooledEJB(EntityContextImpl ctx) { try { ReadOnlyContextImpl readOnlyCtx = (ReadOnlyContextImpl)ctx; if( readOnlyCtx.getReadOnlyBeanInfo() != null ) { readOnlyCtx.setReadOnlyBeanInfo(null); robCache.remove(ctx.getPrimaryKey(), true); } } catch (Exception ex) { _logger.log(Level.SEVERE, "ejb.addPooledEJB", ex); EJBException ejbEx = new EJBException(); ejbEx.initCause(ex); throw ejbEx; } finally { super.addPooledEJB(ctx); } }
protected void forceDestroyBean(EJBContextImpl context) { try { ReadOnlyContextImpl readOnlyCtx = (ReadOnlyContextImpl) context; if( readOnlyCtx.getReadOnlyBeanInfo() != null ) { readOnlyCtx.setReadOnlyBeanInfo(null); robCache.remove(readOnlyCtx.getPrimaryKey(), true); } } catch (Exception ex) { _logger.log(Level.SEVERE, "ejb.forceDestroyBean", ex); EJBException ejbEx = new EJBException(); ejbEx.initCause(ex); throw ejbEx; } finally { super.forceDestroyBean(context); } }
private Timer createTimerInternal(ScheduleExpression schedule, TimerConfig tc) throws IllegalArgumentException, IllegalStateException, EJBException { TimerPrimaryKey timerId = null; try { timerId = timerService_.createTimer (containerId_, applicationId_, getTimedObjectPrimaryKey(), new TimerSchedule(schedule), tc); } catch(CreateException ce) { EJBException ejbEx = new EJBException(); ejbEx.initCause(ce); throw ejbEx; } return new TimerWrapper(timerId, timerService_); }
private Timer createTimerInternal(long initialDuration, long intervalDuration, TimerConfig tc) throws IllegalArgumentException, IllegalStateException, EJBException { checkIntervalDuration(intervalDuration); TimerPrimaryKey timerId = null; try { timerId = timerService_.createTimer (containerId_, applicationId_, getTimedObjectPrimaryKey(), initialDuration, intervalDuration, tc); } catch(CreateException ce) { EJBException ejbEx = new EJBException(); ejbEx.initCause(ce); throw ejbEx; } return new TimerWrapper(timerId, timerService_); }
private Timer createTimerInternal(Date initialExpiration, long intervalDuration, TimerConfig tc) throws IllegalArgumentException, IllegalStateException, EJBException { checkIntervalDuration(intervalDuration); TimerPrimaryKey timerId = null; try { timerId = timerService_.createTimer (containerId_, applicationId_, getTimedObjectPrimaryKey(), initialExpiration, intervalDuration, tc); } catch(CreateException ce) { EJBException ejbEx = new EJBException(); ejbEx.initCause(ce); throw ejbEx; } return new TimerWrapper(timerId, timerService_); }
private Timer createTimerInternal(ScheduleExpression schedule, TimerConfig tc) throws IllegalArgumentException, IllegalStateException, EJBException { TimerPrimaryKey timerId = null; try { timerId = timerService_.createTimer(ejbDescriptor_.getUniqueId(), ejbDescriptor_.getApplication().getUniqueId(), getTimedObjectPrimaryKey(), new EJBTimerSchedule(schedule), tc); } catch(CreateException ce) { EJBException ejbEx = new EJBException(); ejbEx.initCause(ce); throw ejbEx; } return new TimerWrapper(timerId, timerService_); }
private Timer createTimerInternal(Date initialExpiration, long intervalDuration, TimerConfig tc) throws IllegalArgumentException, IllegalStateException, EJBException { checkIntervalDuration(intervalDuration); TimerPrimaryKey timerId = null; try { timerId = timerService_.createTimer(ejbDescriptor_.getUniqueId(), ejbDescriptor_.getApplication().getUniqueId(), getTimedObjectPrimaryKey(), initialExpiration, intervalDuration, tc); } catch(CreateException ce) { EJBException ejbEx = new EJBException(); ejbEx.initCause(ce); throw ejbEx; } return new TimerWrapper(timerId, timerService_); }
private Timer createTimerInternal(long initialDuration, long intervalDuration, TimerConfig tc) throws IllegalArgumentException, IllegalStateException, EJBException { checkIntervalDuration(intervalDuration); TimerPrimaryKey timerId = null; try { timerId = timerService_.createTimer(ejbDescriptor_.getUniqueId(), ejbDescriptor_.getApplication().getUniqueId(), getTimedObjectPrimaryKey(), initialDuration, intervalDuration, tc); } catch(CreateException ce) { EJBException ejbEx = new EJBException(); ejbEx.initCause(ce); throw ejbEx; } return new TimerWrapper(timerId, timerService_); }