Package org.jboss.seam

Examples of org.jboss.seam.CyclicDependencyException


         {
            if (!injected)
            {             
               if (injecting)
               {
                  throw new CyclicDependencyException();
               }

               injecting = true;
               try
               {
                  component.inject(invocation.getTarget(), enforceRequired);
               }
               finally
               {
                  injecting = false;
               }
               injected = true;
            }
           
            counter++;
         }
         finally
         {
            lock.unlock();
         }
                          
         Object result = invocation.proceed();
           
         lock.lock();
         try
         {
            counter--;
           
            if (counter == 0)
            {
               try
               {                    
                  component.outject( invocation.getTarget(), enforceRequired );
               }
               finally
               {
                  // Avoid an extra lock by disinjecting here instead of the finally block
                  if (injected)
                  {
                     injected = false;
                     component.disinject( invocation.getTarget() );
                  }
               }  
            }
         }
         finally
         {
            lock.unlock();
         }
        
         return result;
      }
      catch (Exception e)
      {
         Exception root = e;
         while (Exceptions.getCause(root) != null)
         {
            root = Exceptions.getCause(root);
         }
         if (root instanceof CyclicDependencyException)
         {
            CyclicDependencyException cyclicDependencyException = (CyclicDependencyException) root;
            cyclicDependencyException.addInvocation(getComponent().getName(), invocation.getMethod());
         }
         throw e;
      }
      finally
      {           
View Full Code Here


         {
            if (!injected)
            {             
               if (injecting)
               {
                  throw new CyclicDependencyException();
               }

               injecting = true;
               try
               {
                  component.inject(invocation.getTarget(), enforceRequired);
               }
               finally
               {
                  injecting = false;
               }
               injected = true;
            }
           
            clients++;
         }
         finally
         {
            lock.unlock();
         }
                          
         Object result = invocation.proceed();
           
         lock.lock();
         try
         {
            if (clients == 1)
            {
               try
               {                    
                  component.outject( invocation.getTarget(), enforceRequired );
               }
               finally
               {
                  // Avoid an extra lock by disinjecting here instead of the finally block
                  if (injected)
                  {
                     injected = false;
                     clients--;
                     component.disinject( invocation.getTarget() );
                  }
               }  
            }
         }
         finally
         {
            lock.unlock();
         }
        
         return result;
      }
      catch (Exception e)
      {
         Exception root = e;
         while (Exceptions.getCause(root) != null)
         {
            root = Exceptions.getCause(root);
         }
         if (root instanceof CyclicDependencyException)
         {
            CyclicDependencyException cyclicDependencyException = (CyclicDependencyException) root;
            cyclicDependencyException.addInvocation(getComponent().getName(), invocation.getMethod());
         }
         throw e;
      }
      finally
      {           
View Full Code Here

TOP

Related Classes of org.jboss.seam.CyclicDependencyException

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.