/** * Indicates if the bean is a EJB 3.1 Singleton * * @return True if the bean is a singleton, false otherwise */ public boolean isSingleton() { return (ejbDesc.getType().equals(EjbSessionDescriptor.TYPE) && ((EjbSessionDescriptor) ejbDesc).isSingleton()); }
/** * Check if the given EjbDescriptor matches the given Annotation. * @param ejbDesc * @param annotation * @return boolean check for validity of EjbDescriptor */ protected boolean isValidEjbDescriptor(EjbDescriptor ejbDesc, Annotation annotation) { boolean isValid = EjbSessionDescriptor.TYPE.equals(ejbDesc.getType()); if( isValid ) { EjbSessionDescriptor sessionDesc = (EjbSessionDescriptor) ejbDesc; // Only check specific session-bean type if it's set in the descriptor. // Otherwise it was probably populated with a sparse ejb-jar.xml and // we'll set the type later. if( sessionDesc.isSessionTypeSet() && !sessionDesc.isSingleton() ) { isValid = false; } } return isValid; }
void doStartup(EjbApplication ejbApp) { Collection<EjbDescriptor> ejbs = ejbApp.getEjbBundleDescriptor().getEjbs(); int descSz = ejbs.size(); for (EjbDescriptor desc : ejbs) { if (desc instanceof EjbSessionDescriptor) { EjbSessionDescriptor sdesc = (EjbSessionDescriptor) desc; if ((sdesc.isSingleton())) { if (sdesc.getInitOnStartup()) { String normalizedSingletonName = normalizeSingletonName(sdesc.getName(), sdesc); initializeSingleton(name2Container.get(normalizedSingletonName)); } } } } }
EjbSessionDescriptor sessionDesc = (EjbSessionDescriptor) ejb; if( sessionDesc.hasDependsOn()) { if( !sessionDesc.isSingleton() ) { throw new RuntimeException("Illegal usage of DependsOn for EJB " + ejb.getName() + ". DependsOn is only supported for Singleton beans");
if (sd.isSingleton()) { isSingleton = true; } else {
LockType lockType = lockAnn.value(); if( !singletonDesc.isSingleton() ) { throw new AnnotationProcessorException("@Lock is only permitted for " + "singleton session beans");
if( ejbDesc.isSingleton() ) { appendTextChild(ejbNode, EjbTagNames.INIT_ON_STARTUP, Boolean.toString(ejbDesc.getInitOnStartup()));