Package org.jboss.aop.joinpoint

Examples of org.jboss.aop.joinpoint.MethodInvocation


          {
             log.trace("invoking non-method invocation: " + invocation + " on " + target);
          }
          else
          {
             MethodInvocation mi = (MethodInvocation)invocation;
             method = mi.getMethod();
             methodName = method.getName();

             StringBuffer sb = new StringBuffer();
             sb.append("invoking ").append(target).append('.').append(methodName).append('(');
             Object[] args = mi.getArguments();
             if (args != null)
             {
                for(int i = 0; i < args.length; i++)
                {
                   // take special precautions to hide passwords
View Full Code Here


      createCache = new HashSet();
   }
  
   public Object handleCreateConsumerDelegate(Invocation invocation) throws Throwable
   {
      MethodInvocation mi = (MethodInvocation)invocation;
     
      // read permission required on the destination
      Destination dest = (Destination)mi.getArguments()[0];
     
      SessionAdvised del = (SessionAdvised)invocation.getTargetObject();
      ServerSessionEndpoint sess = (ServerSessionEndpoint)del.getEndpoint();
     
      check(dest, CheckType.READ, sess.getConnectionEndpoint());
     
      // if creating a durable subscription then need create permission
     
      String subscriptionName = (String)mi.getArguments()[3];
      if (subscriptionName != null)
      {
         // durable
         check(dest, CheckType.CREATE, sess.getConnectionEndpoint());
      }
View Full Code Here

  
   public Object handleCreateBrowserDelegate(Invocation invocation) throws Throwable
   {
      // read permission required on the destination
     
      MethodInvocation mi = (MethodInvocation)invocation;
     
      Destination dest = (Destination)mi.getArguments()[0];
     
      SessionAdvised del = (SessionAdvised)invocation.getTargetObject();
      ServerSessionEndpoint sess = (ServerSessionEndpoint)del.getEndpoint();
                 
      check(dest, CheckType.READ, sess.getConnectionEndpoint());
View Full Code Here

  
   public Object handleSend(Invocation invocation) throws Throwable
   {
      // anonymous producer - if destination is not null then write permissions required
     
      MethodInvocation mi = (MethodInvocation)invocation;
     
      Message m = (Message)mi.getArguments()[0];
      Destination dest = m.getJMSDestination();

      SessionAdvised del = (SessionAdvised)invocation.getTargetObject();
      ServerSessionEndpoint se = (ServerSessionEndpoint)del.getEndpoint();
      ServerConnectionEndpoint ce = se.getConnectionEndpoint();
View Full Code Here

  
   // Public --------------------------------------------------------
  
   public Object handleClosing(Invocation invocation) throws Throwable
   {
      MethodInvocation mi = (MethodInvocation)invocation;
      SessionState state = getState(invocation);
      SessionDelegate del = (SessionDelegate)mi.getTargetObject();
           
      if (trace) { log.trace("handleClosing()"); }

      //Sanity check
      if (state.isXA())
View Full Code Here

      return res;
   }
  
   public Object handlePreDeliver(Invocation invocation) throws Throwable
   {
      MethodInvocation mi = (MethodInvocation)invocation;
      SessionState state = getState(invocation);
     
      int ackMode = state.getAcknowledgeMode();
     
      Object[] args = mi.getArguments();
      DeliveryInfo info = (DeliveryInfo)args[0];
     
      if (ackMode == Session.CLIENT_ACKNOWLEDGE)
      {
         // We collect acknowledgments in the list
View Full Code Here

      return null;
   }
  
   public Object handlePostDeliver(Invocation invocation) throws Throwable
   {
      MethodInvocation mi = (MethodInvocation)invocation;
      SessionState state = getState(invocation);
     
      int ackMode = state.getAcknowledgeMode();
     
      if (ackMode == Session.AUTO_ACKNOWLEDGE)
      {
         // We auto acknowledge.

         SessionDelegate sd = (SessionDelegate)mi.getTargetObject();

         // It is possible that session.recover() is called inside a message listener onMessage
         // method - i.e. between the invocations of preDeliver and postDeliver. In this case we
         // don't want to acknowledge the last delivered messages - since it will be redelivered.
         if (!state.isRecoverCalled())
         {
            DeliveryInfo delivery = state.getAutoAckInfo();
           
            if (delivery == null)
            {
               throw new IllegalStateException("Cannot find delivery to AUTO_ACKNOWLEDGE");
            }
                                
            if (trace) { log.trace(this + " auto acknowledging delivery " + delivery); }
             

            // We clear the state in a finally so then we don't get a knock on
            // exception on the next ack since we haven't cleared the state. See
            // http://jira.jboss.org/jira/browse/JBMESSAGING-852

            //This is ok since the message is acked after delivery, then the client
            //could get duplicates anyway
           
            try
            {
               ackDelivery(sd, delivery);
            }
            finally
            {
               state.setAutoAckInfo(null);              
            }
         }        
         else
         {
            if (trace) { log.trace(this + " recover called, so NOT acknowledging"); }

            state.setRecoverCalled(false);
         }
      }
      else if (ackMode == Session.DUPS_OK_ACKNOWLEDGE)
      {
         List acks = state.getClientAckList();
        
         if (!state.isRecoverCalled())
         {
            if (acks.size() >= state.getDupsOKBatchSize())
            {
               // We clear the state in a finally
               // http://jira.jboss.org/jira/browse/JBMESSAGING-852
  
               SessionDelegate sd = (SessionDelegate)mi.getTargetObject();
                                         
               try
               {
                  sd.acknowledgeDeliveries(acks);
               }
View Full Code Here

   /**
    * Used for client acknowledge.
    */
   public Object handleAcknowledgeAll(Invocation invocation) throws Throwable
   {   
      MethodInvocation mi = (MethodInvocation)invocation;
      SessionState state = getState(invocation);
      SessionDelegate del = (SessionDelegate)mi.getTargetObject();           
   
      if (!state.getClientAckList().isEmpty())
      {                
         //CLIENT_ACKNOWLEDGE can't be used with a MDB so it is safe to always acknowledge all
         //on this session (rather than the connection consumer session)
View Full Code Here

    */
   public Object handleRecover(Invocation invocation) throws Throwable
   {
      if (trace) { log.trace("recover called"); }
     
      MethodInvocation mi = (MethodInvocation)invocation;
           
      SessionState state = getState(invocation);
     
      if (state.isTransacted())
      {
         throw new IllegalStateException("Cannot recover a transacted session");
      }
     
      if (trace) { log.trace("recovering the session"); }
      
      //Call redeliver
      SessionDelegate del = (SessionDelegate)mi.getTargetObject();
     
      int ackMode = state.getAcknowledgeMode();
     
      if (ackMode == Session.CLIENT_ACKNOWLEDGE)
      {
View Full Code Here

    *
    *
    */
   public Object handleRedeliver(Invocation invocation) throws Throwable
   {           
      MethodInvocation mi = (MethodInvocation)invocation;
      SessionState state = getState(invocation);           
           
      // We put the messages back in the front of their appropriate consumer buffers
     
      List toRedeliver = (List)mi.getArguments()[0];
      
      if (trace) { log.trace(this + " handleRedeliver() called: " + toRedeliver); }
     
      SessionDelegate del = (SessionDelegate)mi.getTargetObject();
     
      // Need to be redelivered in reverse order.
      for (int i = toRedeliver.size() - 1; i >= 0; i--)
      {
         DeliveryInfo info = (DeliveryInfo)toRedeliver.get(i);
View Full Code Here

TOP

Related Classes of org.jboss.aop.joinpoint.MethodInvocation

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.