Package javax.ejb

Examples of javax.ejb.Lock


      // if no bean level lock type specified, then just return null
      if (lockType == null)
      {
         return null;
      }
      Lock lock = new LockImpl(lockType);
      return annotationClass.cast(lock);

   }
View Full Code Here


      // method "*"
      if (lockType == null)
      {
         return null;
      }
      Lock lock = new LockImpl(lockType);
      return annotationClass.cast(lock);
   }
View Full Code Here

      // if no bean level lock type specified, then just return null
      if (lockType == null)
      {
         return null;
      }
      Lock lock = new LockImpl(lockType);
      return annotationClass.cast(lock);

   }
View Full Code Here

            LockType lockType = sessionBean.getLockType(declaringClass);
            if (lockType == null)
            {
               lockType = LockType.WRITE;
            }
            Lock lock = new LockImpl(lockType);
            return annotationClass.cast(lock);
         }
         // the method was invoked on the bean class (and not on super class of bean).
         // So return null. Later resolveClassAnnotation will pick up the correct bean level
         // lock semantics (either via the annotation or via metadata)
         return null;
      }
      // get the concurrency method metadata for this named method
      ConcurrentMethodMetaData concurrentMethodMetaData = concurrentMethods.find(namedMethod);
      LockType lockType = null;
      // if this named method did not have concurrency metadata or lock metadata, then
      // check for the method named "*" and see if that has the lock type set
      if (concurrentMethodMetaData == null || concurrentMethodMetaData.getLockType() == null)
      {
         // get lock type for method "*"
         lockType = getLockTypeApplicableForAllMethods(sessionBean);
      }
      else
      {
         lockType = concurrentMethodMetaData.getLockType();
      }
      // lock type was not specified for this method nor for the
      // method "*"
      if (lockType == null)
      {
         // EJB3.1 spec, section 4.8.5.5 specifies special meaning for @Lock annotation
         // on superclass(es) of bean.
         // If the method invoked belongs to the superclass of the bean, then pick up
         // the @Lock annotation from the superclass. If it's absent on the superclass
         // then by default it's LockType.WRITE
         String declaringClass = method.getDeclaringClass();
         // the check here for @Singleton bean is for optimization, so as to avoid
         // doing additional checks for non @Singleton beans since only @Singleton beans have explicit @Lock
         if (sessionBean.isSingleton() && declaringClass != null && !sessionBean.getEjbClass().equals(declaringClass))
         {
            lockType = sessionBean.getLockType(declaringClass);
            if (lockType == null)
            {
               lockType = LockType.WRITE;
            }
            Lock lock = new LockImpl(lockType);
            return annotationClass.cast(lock);
         }
         // the method was invoked on the bean class (and not on super class of bean).
         // So return null. Later resolveClassAnnotation will pick up the correct bean level
         // lock semantics (either via the annotation or via metadata)
         return null;
      }
      Lock lock = new LockImpl(lockType);
      return annotationClass.cast(lock);
   }
View Full Code Here

        }

        classes.add(this.beanClass);

        for (final Class c : classes) {
            Lock lock = null;
            try {

                lock = (Lock) c.getAnnotation(Lock.class);
                this.getSingleton().lockType = lock.value();

                if (logger.isDebugEnabled()) {
                    logger.debug("Declared Lock for " + c.getName() + " is " + this.getSingleton().lockType);
                }
View Full Code Here

        }

        classes.add(this.beanClass);

        for (final Class c : classes) {
            Lock lock = null;
            try {

                lock = (Lock) c.getAnnotation(Lock.class);
                this.getSingleton().lockType = lock.value();

                if (logger.isDebugEnabled()) {
                    logger.debug("Declared Lock for " + c.getName() + " is " + this.getSingleton().lockType);
                }
View Full Code Here

        }

        classes.add(this.beanClass);

        for (final Class c : classes) {
            Lock lock = null;
            try {

                lock = (Lock) c.getAnnotation(Lock.class);
                this.getSingleton().lockType = lock.value();

                if (logger.isDebugEnabled()) {
                    logger.debug("Declared Lock for " + c.getName() + " is " + this.getSingleton().lockType);
                }
View Full Code Here

        }

        classes.add(this.beanClass);

        for (final Class c : classes) {
            Lock lock = null;
            try {

                lock = (Lock) c.getAnnotation(Lock.class);
                this.getSingleton().lockType = lock.value();

                if (logger.isDebugEnabled()) {
                    logger.debug("Declared Lock for " + c.getName() + " is " + this.getSingleton().lockType);
                }
View Full Code Here

        }

        classes.add(this.beanClass);

        for (final Class c : classes) {
            Lock lock = null;
            try {

                lock = (Lock) c.getAnnotation(Lock.class);
                this.getSingleton().lockType = lock.value();

                if (logger.isDebugEnabled()) {
                    logger.debug("Declared Lock for " + c.getName() + " is " + this.getSingleton().lockType);
                }
View Full Code Here

    }

    protected HandlerProcessingResult processAnnotation(AnnotationInfo ainfo,
            EjbContext[] ejbContexts) throws AnnotationProcessorException {

        Lock lockAnn = (Lock) ainfo.getAnnotation();

        for (EjbContext ejbContext : ejbContexts) {
            if (ejbContext.getDescriptor() instanceof EjbSessionDescriptor) {
                EjbSessionDescriptor singletonDesc =
                        (EjbSessionDescriptor) ejbContext.getDescriptor();

                if( !singletonDesc.isSingleton() ) {
                    throw new AnnotationProcessorException("@Lock is only permitted for " +
                            "singleton session beans");
                }

                if (ElementType.TYPE.equals(ainfo.getElementType())) {
                    // Delay processing Class-level default until after methods are processed
                    ejbContext.addPostProcessInfo(ainfo, this);
                } else {
                    Method annMethod = (Method) ainfo.getAnnotatedElement();

                    // Only assign lock type if the method hasn't already been processed.
                    // This correctly ignores overridden superclass methods and
                    // applies the correct .xml overriding semantics.
                    if(!matchesExistingReadOrWriteLockMethod(annMethod, singletonDesc)) {
                        MethodDescriptor newMethodDesc = new MethodDescriptor(annMethod);
                        if( lockAnn.value() == LockType.WRITE) {
                            singletonDesc.addWriteLockMethod(newMethodDesc);
                        } else {
                            singletonDesc.addReadLockMethod(newMethodDesc);
                        }
                    }
View Full Code Here

TOP

Related Classes of javax.ejb.Lock

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.