Package net.timewalker.ffmq3.local

Examples of net.timewalker.ffmq3.local.TransactionItem


          hasCreatedASession = true;
          ActivityWatchdog.getInstance().unregister(this);
        }
       
        // Use an internal hook to bridge the local session to the remote peer
        localSession.setNotificationProxy(new RemoteNotificationProxy(localSession.getId(),transport));
       
        return new CreateSessionResponse();
    }
View Full Code Here


          catch (JMSException e)
          {
              // Ignore
          }
         
          engine = new FFMQEngine(TestUtils.LOCAL_ENGINE_NAME,settings,null);
          engine.deploy();
         
//          engine.deleteQueue("TEST1");
//          engine.deleteQueue("TEST2");
//          engine.deleteTopic("TEST1");
View Full Code Here

     
        synchronized (storeLock)
        {
        for (int n = 0 ; n < items.length ; n++)
            {
          TransactionItem transactionItem = items[n];
              if (transactionItem.getDestination() != this)
                continue;
             
              if (traceEnabled)
                  log.trace(localSession+" COMMIT "+transactionItem.getMessageId());
             
              // Delete message from store
              if (transactionItem.getDeliveryMode() == DeliveryMode.PERSISTENT)
              {
                persistentStore.delete(transactionItem.getHandle());
                persistentCommitted++;
              }
              else
              {
                volatileStore.delete(transactionItem.getHandle());
                volatileCommitted++;
              }
            }
           
          acknowledgedGetCount += volatileCommitted + persistentCommitted;
View Full Code Here

      List newEntries = null;
        synchronized (storeLock)
        {
            for (int n = 0 ; n < items.length ; n++)
            {
              TransactionItem transactionItem = items[n];
              if (transactionItem.getDestination() != this)
                continue; // Not for us
             
              MessageStore store = transactionItem.getDeliveryMode() == DeliveryMode.PERSISTENT ? persistentStore : volatileStore;
              int handle = transactionItem.getHandle();
             
              // Retrieve message content
               AbstractMessage msg = store.retrieve(handle);
              
               // Update redelivered flag both in memory and message store
               msg.setJMSRedelivered(true);
               handle = store.replace(handle, msg);
              
              if (redeliveryDelay > 0)
              {
                  // Keep the message locked so it cannot be re-consumed immediately                 
                // and schedule the message unlock afetr redeliveryDelay milliseconds
                redeliveryTimer.schedule(new RedeliveryTask(msg,store,handle),
                                     redeliveryDelay);
              }
              else
              {
                // Unlock message in store
                   store.unlock(handle);
                   if (traceEnabled)
                      log.trace(localSession+" UNLOCKED "+transactionItem.getMessageId());
                  
                   // Add to dispatch list               
                    if (newEntries == null)
                      newEntries = new ArrayList();
                    newEntries.add(msg);
              }

                if (transactionItem.getDeliveryMode() == DeliveryMode.PERSISTENT)
                  persistentRollbacked++;
                else
                  volatileRollbacked++;
            }
           
View Full Code Here

   
    protected final void initDestination() throws JMSException
    {
        // Security : a consumer destination may only be set at creation time
        //            so we check permissions here once and for all.
        LocalConnection conn = (LocalConnection)session.getConnection();
        if (conn.isSecurityEnabled())
        {
            if (destination instanceof Queue)
            {
                String queueName = ((Queue)destination).getQueueName();
                if (conn.isRegisteredTemporaryQueue(queueName))
                {
                    // OK, temporary destination
                }
                else
                if (queueName.equals(FFMQConstants.ADM_REQUEST_QUEUE))
                {
                    // Only the internal admin thread can consume on this queue
                    if (conn.getSecurityContext() != null)
                        throw new FFMQException("Access denied to administration queue "+queueName,"ACCESS_DENIED");
                }
                else
                if (queueName.equals(FFMQConstants.ADM_REPLY_QUEUE))
                {
                    conn.checkPermission(Resource.SERVER, Action.REMOTE_ADMIN);
                }
                else
                {
                    // Standard queue
                    conn.checkPermission(destination,Action.CONSUME);
                }
            }
            else
            if (destination instanceof Topic)
            {
                String topicName = ((Topic)destination).getTopicName();
                if (conn.isRegisteredTemporaryTopic(topicName))
                {
                    // OK, temporary destination
                }
                else
                {
                    // Standard topic
                    conn.checkPermission(destination,Action.CONSUME);
                }
            }
        }
       
        // Lookup a local destination object from the given reference
View Full Code Here

        return new CloseConsumerResponse();
    }
   
    private RollbackMessageResponse processRollbackMessage( RollbackMessageQuery query ) throws JMSException
    {
      LocalConnection localConnection = getLocalConnection();
     
        LocalSession localSession = (LocalSession)localConnection.lookupRegisteredSession(query.getSessionId());
        if (localSession != null)
        {
            // Rollback undelivered prefetched messages
            List undeliveredMessageIDs = new ArrayList();
            undeliveredMessageIDs.add(query.getMessageId());
View Full Code Here

            System.out.println("Received : "+totalReceived);
            fail("Some messages were not received !");
          }
 
          // Check for remaining messages
          LocalQueue localQueue = engine.getLocalQueue(params.destinationName);
          assertEquals(0,localQueue.getSize());
      }
      catch (Exception e)
      {
        if (connection != null)
          connection.close();
View Full Code Here

                  break;
              Thread.sleep(100);
          }
         
          // When in non-transacted mode, the ack is sent _after_ message processing so we need to wait a bit
          LocalQueue localQueue = engine.getLocalQueue(params.destinationName);
          if (!params.receiverTransacted)
          {
            while (localQueue.getSize() > 0)
              Thread.sleep(10);
          }
         
          long endTime = System.currentTimeMillis();
          double rate = (double)totalExpected*1000/(endTime-startTime);
          System.out.println((endTime-startTime)+" ms ("+rateFormat.format(rate)+" msg/s)");

          int totalReceived = 0;
          for (int n = 0 ; n < receivers.length ; n++)
              totalReceived += receivers[n].getReceivedCount();
 
          // Close receivers
          for (int n = 0 ; n < receivers.length ; n++)
              receivers[n].close();
          for (int n = 0 ; n < receivers.length ; n++)
              terminateThread(receivers[n]);

          // Close connection
          listenerConnection.close();
          producerConnection.close();
         
          // Check for errors
          for (int n = 0 ; n < receivers.length ; n++)
              assertFalse(receivers[n].isInError());
          for (int n = 0 ; n < senders.length ; n++)
              assertFalse(senders[n].isInError());
         
          // Check received message count
          if (totalExpected != totalReceived)
          {
            System.out.println("Expected : "+totalExpected);
            System.out.println("Received : "+totalReceived);
            fail("Some messages were not received !");
          }
         
          // Check for remaining messages
            assertEquals(0,localQueue.getSize());
      }
      catch (Exception e)
      {
        if (listenerConnection != null)
          listenerConnection.close();
View Full Code Here

            System.out.println("Received : "+totalReceived);
            fail("Some messages were not received !");
          }
         
          // Check for remaining messages
            LocalQueue localQueue = engine.getLocalQueue(params.destinationName);
            assertEquals(0,localQueue.getSize());
      }
      catch (Exception e)
      {
        if (receiverConnections != null)
        {
View Full Code Here

                  break;
              Thread.sleep(100);
          }
         
          // When in non-transacted mode, the ack is sent _after_ message processing so we need to wait a bit
          LocalQueue localQueue = engine.getLocalQueue(params.destinationName);
          if (!params.receiverTransacted)
          {
            while (localQueue.getSize() > 0)
              Thread.sleep(10);
          }
         
          long endTime = System.currentTimeMillis();
          double rate = (double)totalExpected*1000/(endTime-startTime);
          System.out.println((endTime-startTime)+" ms ("+rateFormat.format(rate)+" msg/s)");

          int totalReceived = 0;
          for (int n = 0 ; n < receivers.length ; n++)
              totalReceived += receivers[n].getReceivedCount();

          // Close receivers
          for (int n = 0 ; n < receivers.length ; n++)
              receivers[n].close();
          for (int n = 0 ; n < receivers.length ; n++)
              receivers[n].join(5*1000);

          // Close connection
          for (int n = 0 ; n < receiverConnections.length ; n++)
              receiverConnections[n].close();
          for (int n = 0 ; n < sendersConnections.length ; n++)
              sendersConnections[n].close();
         
          // Check for errors
          for (int n = 0 ; n < receivers.length ; n++)
              assertFalse(receivers[n].isInError());
          for (int n = 0 ; n < senders.length ; n++)
              assertFalse(senders[n].isInError());
         
          // Check received message count
          if (totalExpected != totalReceived)
          {
            System.out.println("Expected : "+totalExpected);
            System.out.println("Received : "+totalReceived);
            fail("Some messages were not received !");
          }
         
          // Check for remaining messages
            assertEquals(0,localQueue.getSize());
      }
      catch (Exception e)
      {
        if (receiverConnections != null)
        {
View Full Code Here

TOP

Related Classes of net.timewalker.ffmq3.local.TransactionItem

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.