private void processInActorService(SessionEventPluginWebSocketMsg msg) { try { actorService.process(msg); } catch (BeanCreationNotAllowedException e) { log.warn("[{}] Failed to close session due to possible shutdown state", msg.getSessionRef().getSessionId()); } }
@Override @After public void tearDown() throws Exception { // wait for outstanding threads to complete for 1 minute ThreadMonitor.tearDown(60000); try { stopLifecycles(this.perTestLifeCycles); // Avoid failing test for creation of bean in destroy. } catch (BeanCreationNotAllowedException bcnae) { LOG.warn("BeanCreationNotAllowedException during stopLifecycles during tearDown " + bcnae.getMessage()); } testEnd = System.currentTimeMillis(); report("Total time to run test: " + (testEnd - testStart)); logAfterRun(); }
@Override @After public void tearDown() throws Exception { // wait for outstanding threads to complete for 1 minute ThreadMonitor.tearDown(60000); try { stopLifecycles(this.perTestLifeCycles); // Avoid failing test for creation of bean in destroy. } catch (BeanCreationNotAllowedException bcnae) { LOG.warn("BeanCreationNotAllowedException during stopLifecycles during tearDown " + bcnae.getMessage()); } logAfterRun(); }
/** * Return the (raw) singleton object registered under the given name, * creating and registering a new one if none registered yet. * @param beanName the name of the bean * @param singletonFactory the ObjectFactory to lazily create the singleton * with, if necessary * @return the registered singleton object */ public Object getSingleton(String beanName, ObjectFactory<?> singletonFactory) { Assert.notNull(beanName, "'beanName' must not be null"); synchronized (this.singletonObjects) { Object singletonObject = this.singletonObjects.get(beanName); if (singletonObject == null) { if (this.singletonsCurrentlyInDestruction) { throw new BeanCreationNotAllowedException(beanName, "Singleton bean creation not allowed while the singletons of this factory are in destruction " + "(Do not request a bean from a BeanFactory in a destroy method implementation!)"); } if (logger.isDebugEnabled()) { logger.debug("Creating shared instance of singleton bean '" + beanName + "'"); } beforeSingletonCreation(beanName); boolean recordSuppressedExceptions = (this.suppressedExceptions == null); if (recordSuppressedExceptions) { this.suppressedExceptions = new LinkedHashSet<Exception>(); } try { singletonObject = singletonFactory.getObject(); } catch (BeanCreationException ex) { if (recordSuppressedExceptions) { for (Exception suppressedException : this.suppressedExceptions) { ex.addRelatedCause(suppressedException); } } throw ex; } finally { if (recordSuppressedExceptions) { this.suppressedExceptions = null; } afterSingletonCreation(beanName); } addSingleton(beanName, singletonObject); } return (singletonObject != NULL_OBJECT ? singletonObject : null); } }