Package org.jboss.invocation

Examples of org.jboss.invocation.MarshalledInvocation$DeclaredMethodsAction


/* 76 */       InvocationRequest remoteInv = (InvocationRequest)obj;
/* 77 */       Object param = remoteInv.getParameter();
/*    */
/* 79 */       if ((param instanceof MarshalledInvocation))
/*    */       {
/* 81 */         MarshalledInvocation mi = (MarshalledInvocation)param;
/* 82 */         Object txCxt = mi.getTransactionPropagationContext();
/* 83 */         if (txCxt != null)
/*    */         {
/* 85 */           TransactionPropagationContextImporter tpcImporter = TransactionPropagationContextUtil.getTPCImporter();
/* 86 */           mi.setTransaction(tpcImporter.importTransactionPropagationContext(txCxt));
/*    */         }
/*    */       }
/*    */     }
/* 90 */     return obj;
/*    */   }
View Full Code Here


/*     */
/*  83 */       if ((remoteInv.getParameter() instanceof Invocation))
/*     */       {
/*  85 */         Invocation inv = (Invocation)remoteInv.getParameter();
/*     */
/*  87 */         MarshalledInvocation marshInv = new MarshalledInvocation(inv);
/*     */
/*  89 */         if (inv != null)
/*     */         {
/*     */           try
/*     */           {
/*  97 */             marshInv.setTransactionPropagationContext(getTransactionPropagationContext());
/*     */           }
/*     */           catch (SystemException e)
/*     */           {
/* 101 */             log.error("Error setting transaction propagation context.", e);
/* 102 */             throw new IOException("Error setting transaction context.  Message: " + e.getMessage());
View Full Code Here

/*     */   public Object invoke(Invocation invocation)
/*     */     throws Exception
/*     */   {
/* 184 */     if ((invocation instanceof MarshalledInvocation))
/*     */     {
/* 186 */       MarshalledInvocation mi = (MarshalledInvocation)invocation;
/* 187 */       mi.setMethodMap(this.marshalledInvocationMapping);
/*     */     }
/*     */
/* 190 */     Method method = invocation.getMethod();
/* 191 */     Class methodClass = method.getDeclaringClass();
/* 192 */     Object[] args = invocation.getArguments();
View Full Code Here

/*     */   {
/* 114 */     Object result = null;
/*     */
/* 116 */     if ((invocation instanceof MarshalledInvocation))
/*     */     {
/* 118 */       MarshalledInvocation mi = (MarshalledInvocation)invocation;
/* 119 */       mi.setMethodMap(this.marshalledInvocationMapping);
/*     */     }
/*     */
/* 122 */     Method targetMethod = invocation.getMethod();
/* 123 */     Class targetClass = targetMethod.getDeclaringClass();
/* 124 */     Object[] targetArguments = invocation.getArguments();
View Full Code Here

/*     */   {
/* 354 */     Naming theServer = this.namingMain.getNamingInstance();
/*     */
/* 356 */     if ((invocation instanceof MarshalledInvocation))
/*     */     {
/* 358 */       MarshalledInvocation mi = (MarshalledInvocation)invocation;
/* 359 */       mi.setMethodMap(this.marshalledInvocationMapping);
/*     */     }
/*     */
/* 362 */     Method method = invocation.getMethod();
/* 363 */     Object[] args = invocation.getArguments();
/* 364 */     Object value = null;
View Full Code Here

      // first invocation to a node or if it is a failovered call
      //
      int failoverCounter = 0;

      // We are going to go through a Remote invocation, switch to a Marshalled Invocation
      MarshalledInvocation mi = new MarshalledInvocation(invocation);        
      mi.setValue("CLUSTER_VIEW_ID", new Long(familyClusterInfo.getCurrentViewId()));
      String target = (String) getRemoteTarget(invocation);
      URL externalURL = Util.resolveURL(target);
      Exception lastException = null;
      while( externalURL != null )
      {
View Full Code Here

   public Object invoke(Invocation invocation) throws Exception
   {
      // Set the method hash to Method mapping
      if (invocation instanceof MarshalledInvocation)
      {
         MarshalledInvocation mi = (MarshalledInvocation) invocation;
         mi.setMethodMap(this.marshalledInvocationMapping);
      }
      // Invoke the Naming method via reflection
      Method method = invocation.getMethod();
      Object[] args = invocation.getArguments();
      Object value = null;
View Full Code Here

      {        
         try
         {
            if( trace )
               log.trace("Invoking on target="+target);
            MarshalledInvocation mi = new MarshalledInvocation(null, method, args, null, null, null);
            mi.setObjectName (""); //FIXME: Fake value! Bill's optimisations regarding MI make the hypothesis
                                   // that ObjectName is always here otherwise the writeExternal code of MI
                                   // "out.writeInt(payload.size() - 3);" is wrong
            HARMIResponse rsp = target.invoke(this.familyClusterInfo.getCurrentViewId (), mi);
            if (rsp.newReplicants != null)
            {
View Full Code Here

         return InvokerInterceptor.getLocal().invoke(invocation);
      }
      else
      {
         // We are going to go through a Remote invocation, switch to a Marshalled Invocation
         MarshalledInvocation mi = new MarshalledInvocation(invocation);

         // Set the transaction propagation context
         mi.setTransactionPropagationContext(getTransactionPropagationContext());
         mi.setValue("CLUSTER_VIEW_ID", new Long(this.familyClusterInfo.getCurrentViewId ()));
         Invoker target = (Invoker)getRemoteTarget(invocation);
        
         boolean failoverAuthorized = true;
         Exception lastException = null;
         while (target != null && failoverAuthorized)
         {                       
            boolean definitivlyRemoveNodeOnFailure = true;
            try
            {
               if( trace )
                  log.trace("Invoking on target="+target);
               Object rtnObj = target.invoke(mi);
               HARMIResponse rsp = null;
               if (rtnObj instanceof MarshalledObject)
               {
                  rsp = (HARMIResponse)((MarshalledObject)rtnObj).get();
               }
               else
               {
                  rsp = (HARMIResponse)rtnObj;
               }
               if (rsp.newReplicants != null)
               {
                  if( trace )
                  {
                     log.trace("newReplicants: "+rsp.newReplicants);
                  }
                  updateClusterInfo (rsp.newReplicants, rsp.currentViewId);
               }
               //else System.out.println("Static set of replicants: " + this.familyClusterInfo.getCurrentViewId () + " (me = " + this + ")");
              
               invocationHasReachedAServer (invocation);

               return rsp.response;
            }
            catch (java.net.ConnectException e)
            {
               lastException = e;
            }
            catch (java.net.UnknownHostException e)
            {
               lastException = e;
            }
            catch (java.rmi.ConnectException e)
            {
               lastException = e;
               if(e.getCause() != null && e.getCause() instanceof java.io.EOFException)
               {
                  // don't failover as we may of reached the target
                  invocationHasReachedAServer (invocation);
                  throw e;
               }
            }
            catch (java.rmi.ConnectIOException e)
            {
               lastException = e;
            }
            catch (java.rmi.NoSuchObjectException e)
            {
               lastException = e;
            }
            catch (java.rmi.UnknownHostException e)
            {
               lastException = e;
            }
            catch (GenericClusteringException e)
            {
               lastException = e;
               // this is a generic clustering exception that contain the
               // completion status: usefull to determine if we are authorized
               // to re-issue a query to another node
               //
               if (e.getCompletionStatus () == GenericClusteringException.COMPLETED_NO)
               {
                  // we don't want to remove the node from the list of failed
                  // node UNLESS there is a risk to indefinitively loop
                  //
                  if (totalNumberOfTargets() >= failoverCounter)
                  {
                     if (!e.isDefinitive ())
                        definitivlyRemoveNodeOnFailure = false;
                  }
               }
               else
               {
                  invocationHasReachedAServer (invocation);
                  throw new ServerException("Clustering error", e);
               }
            }
            catch (ServerException e)
            {
               //Why do NoSuchObjectExceptions get ignored for a retry here
               //unlike in the non-HA case?
               invocationHasReachedAServer (invocation);
               if (e.detail instanceof TransactionRolledbackException)
               {                 
                  throw (TransactionRolledbackException) e.detail;
               }
               if (e.detail instanceof RemoteException)
               {
                  throw (RemoteException) e.detail;
               }
               throw e;
            }
            catch (Exception e)
            {
               lastException = e;
               invocationHasReachedAServer (invocation);
               throw e;
            }

            if( trace )
               log.trace("Invoke failed, target="+target, lastException);

            // If we reach here, this means that we must fail-over
            remoteTargetHasFailed(target);
            if (!definitivlyRemoveNodeOnFailure)
            {
               resetView ();
            }

            failoverAuthorized = txContextAllowsFailover (invocation);           
            target = (Invoker)getRemoteTarget(invocation);

            failoverCounter++;
            mi.setValue ("FAILOVER_COUNTER", new Integer(failoverCounter), PayloadKey.AS_IS);
         }
         // if we get here this means list was exhausted
         String msg = "Service unavailable.";
         if (failoverAuthorized == false)
         {
View Full Code Here

TOP

Related Classes of org.jboss.invocation.MarshalledInvocation$DeclaredMethodsAction

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.