Package org.jboss.jms.client

Examples of org.jboss.jms.client.FailoverValve2


      if (fcc == null)
      {
         return invocation.invokeNext();
      }
     
      FailoverValve2 valve = fcc.getValve();
     
      JMSRemotingConnection remotingConnection = null;
      String methodName = ((MethodInvocation)invocation).getMethod().getName();

      boolean left = false;
     
      try
      {
         valve.enter();

         // it's important to retrieve the remotingConnection while inside the Valve
         remotingConnection = fcc.getRemotingConnection();
         return invocation.invokeNext();
      }
      catch (MessagingNetworkFailureException e)
      {
         valve.leave();
         left = true;
        
         log.debug(this + " detected network failure, putting " + methodName +
         "() on hold until failover completes");
     
         fcc.failureDetected(e, this, remotingConnection);
        
         // Set retry flag as true on send() and sendTransaction()
         // more details at http://jira.jboss.org/jira/browse/JBMESSAGING-809

         if (invocation.getTargetObject() instanceof ClientSessionDelegate &&
            (methodName.equals("send") || methodName.equals("sendTransaction")))
         {
            log.debug(this + " caught " + methodName + "() invocation, enabling check for duplicates");

            Object[] arguments = ((MethodInvocation)invocation).getArguments();
            arguments[1] = Boolean.TRUE;
            ((MethodInvocation)invocation).setArguments(arguments);
         }

         // We don't retry the following invocations:
         // cancelDelivery(), cancelDeliveries(), cancelInflightMessages() - the deliveries will
         // already be cancelled after failover.

         if (methodName.equals("cancelDelivery") ||
            methodName.equals("cancelDeliveries"))
         {
            log.debug(this + " NOT resuming " + methodName + "(), let it wither and die");
           
            return null;
         }
         else
         {           
            log.debug(this + " resuming " + methodName + "()");
           
            return invocation.invokeNext();
         }
      }
      catch (Throwable e)
      {
         // not failover-triggering, rethrow
         if (trace) { log.trace(this + " caught not failover-triggering throwable, rethrowing " + e); }
         throw e;
      }
      finally
      {
         if (!left)
         {
            valve.leave();
         }
      }
   }
View Full Code Here


      if (fcc == null)
      {
         return invocation.invokeNext();
      }
     
      FailoverValve2 valve = fcc.getValve();
     
      JMSRemotingConnection remotingConnection = null;
      String methodName = ((MethodInvocation)invocation).getMethod().getName();
     
      if (methodName.equals("startAfterFailover"))
      {
         //We don't use the valve on this method
         return invocation.invokeNext();
      }

      boolean left = false;
     
      try
      {
         valve.enter();

         // it's important to retrieve the remotingConnection while inside the Valve
         remotingConnection = fcc.getRemotingConnection();
         return invocation.invokeNext();
      }
      catch (MessagingNetworkFailureException e)
      {
         valve.leave();
         left = true;
        
         log.debug(this + " detected network failure, putting " + methodName +
         "() on hold until failover completes");
     
         fcc.failureDetected(e, this, remotingConnection);
        
         // Set retry flag as true on send() and sendTransaction()
         // more details at http://jira.jboss.org/jira/browse/JBMESSAGING-809

         if ((invocation.getTargetObject() instanceof ClientSessionDelegate && methodName.equals("send")) ||
           (invocation.getTargetObject() instanceof ClientConnectionDelegate && methodName.equals("sendTransaction")))
         {
            log.trace(this + " caught " + methodName + "() invocation, enabling check for duplicates");

            Object[] arguments = ((MethodInvocation)invocation).getArguments();
            arguments[1] = Boolean.TRUE;
            ((MethodInvocation)invocation).setArguments(arguments);
         }

         // We don't retry the following invocations:
         // cancelDelivery(), cancelDeliveries(), cancelInflightMessages() - the deliveries will
         // already be cancelled after failover.

         if (methodName.equals("cancelDelivery") ||
            methodName.equals("cancelDeliveries"))
         {
            log.trace(this + " NOT resuming " + methodName + "(), let it wither and die");
           
            return null;
         }
         else
         {           
            log.trace(this + " resuming " + methodName + "()");
           
            return invocation.invokeNext();
         }
      }
      catch (Throwable e)
      {
         // not failover-triggering, rethrow
         if (trace) { log.trace(this + " caught not failover-triggering throwable, rethrowing " + e); }
         throw e;
      }
      finally
      {
         if (!left)
         {
            valve.leave();
         }
      }
   }
View Full Code Here

/*  90 */     if (fcc == null)
/*     */     {
/*  92 */       return invocation.invokeNext();
/*     */     }
/*     */
/*  95 */     FailoverValve2 valve = fcc.getValve();
/*     */
/*  97 */     JMSRemotingConnection remotingConnection = null;
/*  98 */     String methodName = ((MethodInvocation)invocation).getMethod().getName();
/*     */
/* 100 */     if (methodName.equals("startAfterFailover"))
/*     */     {
/* 103 */       return invocation.invokeNext();
/*     */     }
/*     */
/* 106 */     boolean left = false;
/*     */     try
/*     */     {
/* 110 */       valve.enter();
/*     */
/* 113 */       remotingConnection = fcc.getRemotingConnection();
/* 114 */       Object localObject1 = invocation.invokeNext();
/*     */       return localObject1;
/*     */     }
/*     */     catch (MessagingNetworkFailureException e)
/*     */     {
/* 118 */       valve.leave();
/* 119 */       left = true;
/*     */
/* 121 */       log.debug(this + " detected network failure, putting " + methodName + "() on hold until failover completes");
/*     */
/* 124 */       fcc.failureDetected(e, this, remotingConnection);
/*     */
/* 129 */       if ((((invocation.getTargetObject() instanceof ClientSessionDelegate)) && (methodName.equals("send"))) || (((invocation.getTargetObject() instanceof ClientConnectionDelegate)) && (methodName.equals("sendTransaction"))))
/*     */       {
/* 132 */         log.trace(this + " caught " + methodName + "() invocation, enabling check for duplicates");
/*     */
/* 134 */         arguments = ((MethodInvocation)invocation).getArguments();
/* 135 */         arguments[1] = Boolean.TRUE;
/* 136 */         ((MethodInvocation)invocation).setArguments(arguments);
/*     */       }
/*     */
/* 143 */       if ((methodName.equals("cancelDelivery")) || (methodName.equals("cancelDeliveries")))
/*     */       {
/* 146 */         log.trace(this + " NOT resuming " + methodName + "(), let it wither and die");
/*     */
/* 148 */         arguments = null;
/*     */         return arguments;
/*     */       }
/* 152 */       log.trace(this + " resuming " + methodName + "()");
/*     */
/* 154 */       Object[] arguments = invocation.invokeNext();
/*     */       return arguments;
/*     */     }
/*     */     catch (Throwable e)
/*     */     {
/* 160 */       if (trace) log.trace(this + " caught not failover-triggering throwable, rethrowing " + e);
/* 161 */       throw e;
/*     */     }
/*     */     finally
/*     */     {
/* 165 */       if (!left)
/*     */       {
/* 167 */         valve.leave();
/*     */       }
/*     */     }
/* 169 */     throw localObject2;
/*     */   }
View Full Code Here

TOP

Related Classes of org.jboss.jms.client.FailoverValve2

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.