Package org.jboss.cache.marshall

Examples of org.jboss.cache.marshall.MethodCall


      {
         // Broadcast rollback() to all other members (excluding myself)
         try
         {
            broadcastTxs.remove(gtx);
            MethodCall rollback_method = MethodCallFactory.create(MethodDeclarations.rollbackMethod_id, gtx);

            if (log.isDebugEnabled())
               log.debug("running remote rollback for " + gtx + " and coord=" + cache.getLocalAddress());
            replicateCall(ctx, rollback_method, remoteCallSync, ctx.getOptionOverrides());
         }
View Full Code Here


            Object[] newArgs = new Object[origArgs.length + 1];
            System.arraycopy(origArgs, 0, newArgs, 0, origArgs.length);
            newArgs[origArgs.length] = versionToBroadcast;

            // now create a new method call which contains this data version
            MethodCall newCall = MethodCallFactory.create(MethodDeclarations.getVersionedMethodId(origCall.getMethodId()), newArgs);

            // and add it to the new list.
            newList.add(newCall);
         }
      }
View Full Code Here

      this.remoteDelegate = remoteDelegate;
   }

   public Object invoke(InvocationContext ctx) throws Throwable
   {
      MethodCall m = ctx.getMethodCall();
      Object retval = null;

      if (!MethodDeclarations.isTransactionLifecycleMethod(m.getMethodId()))
      {
         if (trace) log.trace("Passing up method " + m + " so it gets invoked on cache.");
         try
         {
            retval = m.invoke(m.getMethodId() == MethodDeclarations.dataGravitationCleanupMethod_id ? remoteDelegate : cacheImpl);
         }
         catch (Throwable t)
         {
            retval = t;
         }
      }
      else
      {
         if (trace) log.trace("Suppressing invocation of method " + m + " on cache.");
      }

      Transaction tx = ctx.getTransaction();
      if (tx != null && isValid(tx))
      {
         // test for exceptions.
         if (retval instanceof Throwable)
         {
            tx.setRollbackOnly(); // no exception, regular return
         }
         else
         {
            // only add the modification to the modification list if we are using pessimistic locking.
            // Optimistic locking calls *should* not make it this far down the interceptor chain, but just
            // in case a method has been invoked that the OptimisticNodeInterceptor knows nothing about, it will
            // filter down here.

            if (!configuration.isNodeLockingOptimistic() && MethodDeclarations.isCrudMethod(m.getMethodId()))
            {
               // if method is a CRUD (Create/Remove/Update/Delete) method: add it to the modification
               // list, otherwise skip (e.g. get() is not added)
               // add the modification to the TX's modification list. this is used to later
               // (on TX commit) send all modifications done in this TX to all members
View Full Code Here

   private Object handleNonTxMethod(InvocationContext ctx) throws Throwable
   {
      Object result;
      try
      {
         MethodCall m = ctx.getMethodCall();
         Transaction tx = ctx.getTransaction();
         // if there is no current tx and we're using opt locking, we need to use an implicit tx.
         boolean implicitTransaction = configuration.isNodeLockingOptimistic() && tx == null;
         if (implicitTransaction)
         {
View Full Code Here

   }

   private Object replayModifications(List<MethodCall> modifications, InvocationContext ctx, boolean injectDataVersions)
   {
      Object retval = null;
      MethodCall originalMethodCall = ctx.getMethodCall();
      Option originalOption = ctx.getOptionOverrides();

      if (modifications != null)
      {
         for (MethodCall modification : modifications)
View Full Code Here

    */
   private Object handleRemoteCommitRollback(InvocationContext ctx) throws Throwable
   {
      Transaction ltx;
      GlobalTransaction gtx = ctx.getGlobalTransaction();
      MethodCall m = ctx.getMethodCall();

      try
      {
         ltx = getLocalTxForGlobalTx(gtx);
      }
      catch (IllegalStateException e)
      {
         if (m.getMethodId() == MethodDeclarations.rollbackMethod_id)
         {
            log.warn("No local transaction for this remotely originating rollback.  Possibly rolling back before a prepare call was broadcast?");
            return null;
         }
         else
         {
            throw e;
         }
      }

      // disconnect if we have a current tx associated
      Transaction currentTx = txManager.getTransaction();
      boolean resumeCurrentTxOnCompletion = false;
      try
      {
         if (!ltx.equals(currentTx))
         {
            currentTx = txManager.suspend();
            resumeCurrentTxOnCompletion = true;
            txManager.resume(ltx);
            // make sure we set this in the ctx
            ctx.setTransaction(ltx);
         }
         if (log.isDebugEnabled()) log.debug(" executing " + m + "() with local TX " + ltx + " under global tx " + gtx);

         // pass commit up the chain
         // nextInterceptor(ctx);
         // commit or rollback the tx.
         if (m.getMethodId() == MethodDeclarations.commitMethod_id)
         {
            txManager.commit();
            if (configuration.getExposeManagementStatistics() && getStatisticsEnabled())
            {
               m_commits++;
View Full Code Here

      //        Transaction currentTx = txManager.getTransaction();

      //if (!ltx.equals(currentTx)) throw new IllegalStateException(" local transaction " + ltx + " transaction does not match running tx " + currentTx);

      MethodCall originalCall = ctx.getMethodCall();
      ctx.setMethodCall(call);
      try
      {
         result = nextInterceptor(ctx);
      }
View Full Code Here

      // set the hasMods flag in the invocation ctx.  This should not be replicated, just used locally by the interceptors.
      ctx.setTxHasMods(modifications != null && modifications.size() > 0);
      ctx.setCacheLoaderHasMods(clModifications != null && clModifications.size() > 0);
      try
      {
         MethodCall commitMethod;
         if (onePhaseCommit)
         {
            // running a 1-phase commit.
            if (configuration.isNodeLockingOptimistic())
            {
View Full Code Here

      try
      {
         ctx.setTxHasMods(modifications != null && modifications.size() > 0);
         // JBCACHE-457
         //            MethodCall rollbackMethod = MethodCall(CacheImpl.rollbackMethod, new Object[]{gtx, hasMods ? true : false});
         MethodCall rollbackMethod = MethodCallFactory.create(MethodDeclarations.rollbackMethod_id, gtx);
         if (trace)
         {
            log.trace(" running rollback for " + gtx);
         }
View Full Code Here

    * @throws Throwable
    */
   protected Object runPreparePhase(InvocationContext ctx, GlobalTransaction gtx, List modifications) throws Throwable
   {
      // build the method call
      MethodCall prepareMethod;
      //        if (cache.getCacheModeInternal() != CacheImpl.REPL_ASYNC)
      //        {
      // running a 2-phase commit.
      if (configuration.isNodeLockingOptimistic())
      {
         prepareMethod = MethodCallFactory.create(MethodDeclarations.optimisticPrepareMethod_id, gtx, modifications, null, cache.getLocalAddress(), false);
      }
      else if (configuration.getCacheMode() != Configuration.CacheMode.REPL_ASYNC)
      {
         prepareMethod = MethodCallFactory.create(MethodDeclarations.prepareMethod_id,
               gtx, modifications, cache.getLocalAddress(),
               false);// don't commit or rollback - wait for call
      }
      //}
      else
      {
         // this is a REPL_ASYNC call - do 1-phase commit.  break!
         if (trace) log.trace("This is a REPL_ASYNC call (1 phase commit) - do nothing for beforeCompletion()");
         return null;
      }

      // passes a prepare call up the local interceptor chain.  The replication interceptor
      // will do the broadcasting if needed.  This is so all requests (local/remote) are
      // treated the same
      Object result;

      // Is there a local transaction associated with GTX ?
      Transaction ltx = ctx.getTransaction();

      //if ltx is not null and it is already running
      if (txManager.getTransaction() != null && ltx != null && txManager.getTransaction().equals(ltx))
      {
         MethodCall originalCall = ctx.getMethodCall();
         ctx.setMethodCall(prepareMethod);
         try
         {
            result = nextInterceptor(ctx);
         }
View Full Code Here

TOP

Related Classes of org.jboss.cache.marshall.MethodCall

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.