Examples of AbstractMessage


Examples of net.timewalker.ffmq3.common.message.AbstractMessage

    int lastPriority = 9;
    int current = msgStore.first();
    boolean failed = false;     
    while (current != -1)
    {
      AbstractMessage msg = msgStore.retrieve(current);
      System.out.println(current+" PRIO "+msg.getJMSPriority());
     
      if (lastPriority < msg.getJMSPriority())
        failed = true;
     
      if (msg.getJMSPriority() < lastPriority)
        lastPriority = msg.getJMSPriority();
      current = msgStore.next(current);
    }
   
    if (failed)
      fail("Not ordered !");
View Full Code Here

Examples of net.timewalker.ffmq3.common.message.AbstractMessage

   
    long start = System.currentTimeMillis();
    int msgCount = 178;
    for (int i = 0; i < msgCount; i++)
    {
      AbstractMessage msg = new TextMessageImpl("msg"+i);
      msg.setJMSMessageID("ID:FOO"+i);
      msg.setJMSPriority(rand.nextInt(10));
      assertTrue(msgStore.store(msg) != -1);
      //msgStore.commitChanges();
    }
    msgStore.commitChanges();
    long end = System.currentTimeMillis();
    System.out.println("testPriorityBasic: "+(end-start));
    assertEquals(msgCount, msgStore.size());
   
    assertOrdered(msgStore);
   
    // Delete half the queue
    int count = 0;
    int current = msgStore.first();
    while (current != -1 && count < (msgCount/2))
    {
      int next = msgStore.next(current);
      msgStore.delete(current);
      count++;
      current = next;
    }
    msgStore.commitChanges();
    assertEquals(msgCount/2, msgStore.size());
   
    assertOrdered(msgStore);
   
    //System.out.println(msgStore.toString());
   
    for (int i = 0; i < msgCount/2; i++)
    {
      AbstractMessage msg = new TextMessageImpl("other_msg"+i);
      msg.setJMSMessageID("ID:BAR"+i);
      msg.setJMSPriority(rand.nextInt(10));
      assertTrue(msgStore.store(msg) != -1);
    }
    msgStore.commitChanges();
    assertEquals(msgCount, msgStore.size());
   
View Full Code Here

Examples of net.timewalker.ffmq3.common.message.AbstractMessage

  {
    MessageStore msgStore = createMessageStore();

    for (int i = 0; i < 10; i++)
    {   
      AbstractMessage msg = new TextMessageImpl("msg"+i);
      msg.setJMSMessageID("ID:FOO"+i);
      msg.setJMSPriority(i);
      msg.setJMSCorrelationID("ID"+i);
      msgStore.store(msg);
      msgStore.commitChanges();
    }
    assertEquals(10, msgStore.size());
   
    assertOrdered(msgStore);
   
    int current = msgStore.first();
    for(int n=0;n<5;n++)
      current = msgStore.next(current);
    Message removedMsg = msgStore.retrieve(current);
    msgStore.delete(current);
    msgStore.commitChanges();
   
    assertOrdered(msgStore);
   
    AbstractMessage msg = new TextMessageImpl("msgNEW");
    msg.setJMSMessageID("ID:XXX");
    msg.setJMSPriority(removedMsg.getJMSPriority()+1);
    msgStore.store(msg);
    msgStore.commitChanges();
   
    msg = new TextMessageImpl("msgNEW2");
    msg.setJMSMessageID("ID:YYY");
    msg.setJMSPriority(removedMsg.getJMSPriority());
    msgStore.store(msg);
    msgStore.commitChanges();
   
    //System.out.println(msgStore);
   
View Full Code Here

Examples of net.timewalker.ffmq3.common.message.AbstractMessage

    {
        super.unserializeFrom(in);
        int msgCount = in.readInt();
        for (int i = 0; i < msgCount; i++)
        {
            AbstractMessage message = MessageSerializer.unserializeFrom(in, true);
            addMessage(message);
        }
    }
View Full Code Here

Examples of net.timewalker.ffmq3.common.message.AbstractMessage

    {
        super.unserializeFrom(in);
        int msgCount = in.readInt();
        for (int i = 0; i < msgCount; i++)
        {
            AbstractMessage message = MessageSerializer.unserializeFrom(in, true);
            addMessage(message);
        }
    }
View Full Code Here

Examples of net.timewalker.ffmq3.common.message.AbstractMessage

      throw new NoSuchElementException();
     
    try
    {
      checkNotClosed();
      AbstractMessage msg = fetchNext();
      if (msg != null)
      {
        nextMessage = null; // Consume fetched message

        // Make sure the message is fully deserialized and marked as read-only
        msg.ensureDeserializationLevel(MessageSerializationLevel.FULL);
        msg.markAsReadOnly();
       
        return msg;
      }
     
      throw new NoSuchElementException();
View Full Code Here

Examples of net.timewalker.ffmq3.common.message.AbstractMessage

      if (!prefetchSemaphore.tryAcquire(timeout))
      return null;
       
      // Get the message from the queue
      boolean shouldPrefetchMore = false;
      AbstractMessage message;
      synchronized (externalAccessLock)
        {
        if (closed)
          return null; // [JMS SPEC]
       
        synchronized (prefetchQueue)
          {
          // Consistency check
            if (prefetchQueue.isEmpty())
              throw new IllegalStateException("Prefetch queue is empty");
           
            message = (AbstractMessage)prefetchQueue.removeFirst();
           
            // If we have consumed all the prefetched messages, ask for more !
            if (prefetchCapacity == 0 && prefetchQueue.isEmpty())
              shouldPrefetchMore = true;
          }
        }
   
      // Ask for more messages if necessary (asynchronous)
      if (shouldPrefetchMore)
      {
        try
        {
          prefetchFromDestination();
        }
        catch (JMSException e)
        {
          log.error("Cannot prefetch more messages from remote server",e);
        }
      }
     
      ((RemoteSession)session).addDeliveredMessageID(message.getJMSMessageID());
     
       if (traceEnabled)
            log.trace("#"+id+" [GET PREFETCHED] in "+destination+" - "+message);

        // Make sure the message is fully deserialized and marked as read-only
       message.ensureDeserializationLevel(MessageSerializationLevel.FULL);
    message.markAsReadOnly();
   
        return message;
    }
View Full Code Here

Examples of net.timewalker.ffmq3.common.message.AbstractMessage

        // Check that the destination was specified
        if (destination == null)
            throw new InvalidDestinationException("Destination not specified")// [JMS SPEC]

        // Create an internal copy if necessary
        AbstractMessage message = MessageTools.makeInternalCopy(srcMessage);
       
      synchronized (externalAccessLock)
    {
        checkNotClosed();
       
View Full Code Here

Examples of net.timewalker.ffmq3.common.message.AbstractMessage

      return false;
   
    try
    {
      checkNotClosed();
      AbstractMessage msg = fetchNext();
      return msg != null;
    }
    catch (JMSException e)
    {
      throw new IllegalStateException(e.toString());
View Full Code Here

Examples of net.timewalker.ffmq3.common.message.AbstractMessage

      if (lockRef.getDeliveryMode() == DeliveryMode.NON_PERSISTENT)
          targetStore = volatileStore;
      else
          targetStore = persistentStore;
     
      AbstractMessage message;
      synchronized (storeLock)
        {
        int handle = lockRef.getHandle();
        message = targetStore.retrieve(handle);
        targetStore.unlock(handle);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.