public void invokeTimeoutMethod(final Timer timer) { final EJBComponent component = (EJBComponent) getComponent(); final Method method = component.getTimeoutMethod(); if (method == null) { throw MESSAGES.componentTimeoutMethodNotSet(component.getComponentName()); } invokeTimeoutMethod(method, timer); }
@Override public void callTimeout(final TimerImpl timer, final Method timeoutMethod) throws Exception { final EjbComponentInstance instance = acquireInstance(); boolean discarded = false; try { instance.invokeTimeoutMethod(timeoutMethod, timer); } catch (Exception ex) { // Detect app exception if (ejbComponent.getApplicationException(ex.getClass(), timeoutMethod) != null) { // it's an application exception, just throw it back. throw ex; } if (ex instanceof ConcurrentAccessTimeoutException || ex instanceof ConcurrentAccessException) { throw ex; } if (ex instanceof RuntimeException || ex instanceof RemoteException) { discarded = true; if (pool != null) { pool.discard(instance); } } throw ex; } catch (final Error e) { discarded = true; if (pool != null) { pool.discard(instance); } throw e; } catch (final Throwable t) { discarded = true; if (pool != null) { pool.discard(instance); } throw new RuntimeException(t); } finally { if (!discarded) { releaseInstance(instance); } } }