FileDocCategorySizeDatePackage
ClusteredIsLocalInterceptor.javaAPI DocJBoss 4.2.13794Fri Jul 13 20:53:46 BST 2007org.jboss.ejb3.remoting

ClusteredIsLocalInterceptor

public class ClusteredIsLocalInterceptor extends IsLocalInterceptor
Routes the call to the local container, bypassing further client-side interceptors and any remoting layer, if a container with the same OID and partition name is available.
author
Brian Stansberry
version
$Revision: 60233 $

Fields Summary
private static final long
serialVersionUID
private static final Logger
log
public static final String
PARTITION_NAME
Constructors Summary
Methods Summary
private org.jboss.ejb3.ContainerfindLocalContainer(org.jboss.aop.joinpoint.Invocation invocation)

      Object oid = invocation.getMetaData(Dispatcher.DISPATCHER, Dispatcher.OID);
      Container container = null;
      try
      {
         container = Ejb3Registry.getContainer(oid.toString());
      }
      catch (IllegalStateException ignored)
      {
         if (log.isTraceEnabled())
            log.trace("Cannot find local container for " + oid);
      }
      
      if (container != null)
      {
         String partitionName = (String) invocation.getMetaData(PARTITION_NAME, PARTITION_NAME);
         if (partitionName != null)
         {
            if (!partitionName.equals(((EJBContainer) container).getPartitionName()))
            {
               if (log.isTraceEnabled())
               {
                  log.trace("Partition (" + ((EJBContainer) container).getPartitionName() + 
                            ") for local container " + oid + " does not match invocation (" +
                            partitionName + ")");
               }
               container = null;
            }
            else if (log.isTraceEnabled())
            {
               log.trace("Partition (" + ((EJBContainer) container).getPartitionName() + 
                     ") for local container " + oid + " matches invocation (" +
                     partitionName + ")");
            }
         }
         else
         {
            log.warn("No PARTITION_NAME metadata associated with invocation");
            container = null;
         }
      }
      
      return container;
   
public java.lang.Objectinvoke(org.jboss.aop.joinpoint.Invocation invocation)

   
        
   
      Container localContainer = findLocalContainer(invocation);
      if (localContainer != null)
      {
         return invokeLocal(invocation, localContainer);
      }
      return invocation.invokeNext();