public void handle(final IEvent arg0) { EZBClusteredBeanEvent clusterEvent = (EZBClusteredBeanEvent) arg0; if (EZBClusteredBeanEvent.STARTING.equals(clusterEvent.getState()) || EZBClusteredBeanEvent.STOPPING.equals(clusterEvent.getState())) { for (EZBRef reference : clusterEvent.getReferences()) { if (reference instanceof RemoteCallRef) { Factory<?, ?> factory = reference.getFactory(); if (factory instanceof SessionFactory) { SessionFactory<?> fact = ((SessionFactory<?>) factory); Object cluster = fact.getBeanInfo().getCluster(); Class<?> beanClass = fact.getBeanClass(); Class<?> itfClass = null; if (cluster != null || beanClass.isAnnotationPresent(Cluster.class)) { if (EZBClusteredBeanEvent.STARTING.equals(clusterEvent.getState())) { String itfClassname = reference.getItfClassName(); logger.info( "The bean with the name {0} and the interface name {1} is clustered.", reference.getFactory().getBeanInfo().getName(), itfClassname); for (Class<?> klass : beanClass.getInterfaces()) { if (klass.getName().equals(itfClassname)) { itfClass = klass; } } if (itfClass == null) { logger.error("Cannot find the interface for name {0}", itfClassname); // throw new // LifeCycleCallbackException("Cannot find the interface for name " // + itfClassname); } Set<String> applicationExceptionNames = factory.getBeanInfo().getApplicationExceptions().keySet(); // Extract the informations on clustering ClusteredObjectInfo infos = null; try { if (cluster != null) { infos = CMIInfoExtractor.extractClusteringInfoFromClusteredObject( cluster, itfClass, beanClass, factory instanceof StatefulSessionFactory, false, applicationExceptionNames); } else { infos = CMIInfoExtractor.extractClusteringInfoFromAnnotatedPOJO( reference.getJNDINamingInfos().get(0).jndiName(), itfClass, beanClass, factory instanceof StatefulSessionFactory, applicationExceptionNames); } CMIInfoRepository.addClusteredObjectInfo( reference.getJNDINamingInfos().get(0).jndiName(), infos); } catch (CMIInfoExtractorException e) { logger.error( "Cannot extract infos for the class with name {0}", beanClass.getName(), e); /* * throw newLifeCycleCallbackException( * "Cannot extract infos for the class with name " * + beanClass.getName(), e); */ } } else { // Unbind reference. CMIInfoRepository.removeClusteredObjectInfo( reference.getJNDINamingInfos().get(0).jndiName()); } } } } } } }