Package net.timewalker.ffmq3.utils

Examples of net.timewalker.ffmq3.utils.FastBitSet


        // Start senders
        TopicPublisherThread[] senders = new TopicPublisherThread[params.senderCount];
        int totalExpected = params.messageCount*params.receiverCount;
        for (int n = 0 ; n < senders.length ; n++)
        {
            senders[n] = new TopicPublisherThread("Sender"+(n+1),
                                                  msgFactory,
                                                  startSynchro,
                                                  sendersConnections[n],
                                                  params.senderTransacted,
                                                  params.messageCount/params.senderCount,
View Full Code Here


          connection = createTopicConnection();
         
          // Start receivers
          TopicSubscriberThread[] receivers = new TopicSubscriberThread[params.receiverCount];
          for (int n = 0 ; n < receivers.length ; n++)
              receivers[n] = new TopicSubscriberThread("Receiver"+(n+1),
                                                   startSynchro,
                                                       connection,
                                                       params.receiverTransacted,
                                                       params.acknowledgeMode,
                                                       topic,
View Full Code Here

            receiverConnections[n] = createTopicConnection();
       
        // Start receivers
        TopicSubscriberThread[] receivers = new TopicSubscriberThread[params.receiverCount];
        for (int n = 0 ; n < receivers.length ; n++)
            receivers[n] = new TopicSubscriberThread("Receiver"+(n+1),
                                               startSynchro,
                                                   receiverConnections[n],
                                                   params.receiverTransacted,
                                                   params.acknowledgeMode,
                                                   topic,
View Full Code Here

        this.maxSize = maxSize;
        this.nextEntry = new int[initialSize];
        this.previousEntry = new int[initialSize];
        this.firstEntry = -1;
        this.data = new Object[initialSize];
        this.locks = new FastBitSet(initialSize);
    }
View Full Code Here

                 
                  if ((flags[n] & FLAG_START_BLOCK) > 0)
                    msgCount++;
                }
            }
            this.locks = new FastBitSet(blockCount);
            this.size = msgCount;
           
            log.debug(msgCount+" entries found");
        }
        catch (EOFException e)
View Full Code Here

        }
    }
   
    private int guessFirstBlockIndex( int blockCount , int[] allocatedSize , int[] nextBlock )
    {
        FastBitSet referenced = new FastBitSet(blockCount);
       
        // Flag all referenced blocks
        for (int n = 0 ; n < blockCount ; n++)
            if (allocatedSize[n] != -1 && nextBlock[n] != -1)
                referenced.set(nextBlock[n]);
       
        // Find candidate
        for (int n = 0 ; n < blockCount ; n++)
            if (allocatedSize[n] != -1 &&
                nextBlock[n] != -1 &&
                !referenced.get(n))
                return n;
       
        return -1;
    }
View Full Code Here

    }
   
    private boolean fixBlocks( int blockCount , int blockSize , int firstBlock , byte[] flags , int[] allocatedSize , int[] previousBlock , int[] nextBlock )
    {
        boolean changed = false;
        FastBitSet fixedBlocks = new FastBitSet(blockCount);
       
        // Fix reverse links first
        int previous = -1;
        int current = firstBlock;
        while (current != -1)
        {
            if (previousBlock[current] != previous)
            {
                log.debug("Fixing previous reference "+previousBlock[current]+" -> "+previous);
                previousBlock[current] = previous;
                changed = true;
            }
            fixedBlocks.set(current);
            previous = current;
            current = nextBlock[current];
        }
       
        // Look for lost blocks and fix allocated sizes
        for (int n = 0 ; n < blockCount ; n++)
        {
            if (allocatedSize[n] != -1 && !fixedBlocks.get(n))
            {
                log.warn("Lost block found : "+n);
                allocatedSize[n] = -1;
                changed = true;
            }
            if (fixedBlocks.get(n) && (allocatedSize[n] <= 0 || allocatedSize[n]>blockSize))
            {
                log.warn("Block has an invalid size ("+allocatedSize[n]+"), replacing by "+blockSize);
                allocatedSize[n] = blockSize;
                changed = true;
            }
View Full Code Here

          {
            PropertyConfigurator.configure(testSettings);
            log4jConfigured = true;
          }
 
          Settings settings = new Settings(testSettings);
         
          if (listener != null)
          {
              listener.stop();
              listener = null;
          }
      
          try
          {
              FFMQEngine.getDeployedInstance(TestUtils.LOCAL_ENGINE_NAME).undeploy();
          }
          catch (JMSException e)
          {
              // Ignore
          }
         
          engine = new FFMQEngine(TestUtils.LOCAL_ENGINE_NAME,settings,null);
          engine.deploy();
         
//          engine.deleteQueue("TEST1");
//          engine.deleteQueue("TEST2");
//          engine.deleteTopic("TEST1");
//          engine.deleteTopic("TEST2");
         
          queue1 = engine.getLocalQueue("TEST1");
          queue2 = engine.getLocalQueue("TEST2");
          topic1 = engine.getLocalTopic("TEST1");
          topic2 = engine.getLocalTopic("TEST2");
         
          ((LocalQueue)queue1).purge(null);
          ((LocalQueue)queue2).purge(null);
          ((LocalTopic)topic1).resetStats();
          //topic2.resetStats();
         
          if (isRemote())
          {
            boolean useNIO = settings.getBooleanProperty("listener.tcp.useNIO",false);
            if (useNIO)
            {
              listener = new NIOTcpListener(engine,
                                                FFMQConstants.DEFAULT_SERVER_HOST,
                                                TestUtils.TEST_SERVER_PORT,
View Full Code Here

    }
   
    private Settings createSettings( Message msg ) throws JMSException
    {
        // Fill settings from message headers
        Settings queueSettings = new Settings();
        Enumeration headers = msg.getPropertyNames();
        while (headers.hasMoreElements())
        {
            String propName = (String)headers.nextElement();
            if (propName.startsWith(FFMQAdminConstants.ADM_HEADER_PREFIX))
                continue;
           
            String propValue = msg.getStringProperty(propName);
            queueSettings.setStringProperty(propName, propValue);
        }
        return queueSettings;
    }
View Full Code Here

        return queueSettings;
    }
   
    private String processCreateQueue( Message msg ) throws JMSException
    {
        Settings queueSettings = createSettings(msg);
        QueueDefinition queueDef = new QueueDefinition(queueSettings);
       
        log.debug("Creating queue : "+queueDef);
        engine.createQueue(queueDef);
       
View Full Code Here

TOP

Related Classes of net.timewalker.ffmq3.utils.FastBitSet

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.