Package net.timewalker.ffmq3.utils.concurrent

Examples of net.timewalker.ffmq3.utils.concurrent.CopyOnWriteList$ReferenceAwareVector


          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

          {
            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

        return null;
    }
   
    private String processCreateTopic( Message msg ) throws JMSException
    {
        Settings topicSettings = createSettings(msg);
        TopicDefinition topicDef = new TopicDefinition(topicSettings);

        log.debug("Creating topic : "+topicDef);
        engine.createTopic(topicDef);
       
View Full Code Here

        assertEquals(4, child3.size());
    }
   
    public void testConcurrency() throws Exception
    {
        final CopyOnWriteList cowList = new CopyOnWriteList();
        cowList.add("v1");
        cowList.add("v2");
        cowList.add("v3");
        assertEquals(0, cowList.getShareLevel());
        assertEquals(3, cowList.size());

        Thread[] threads = new Thread[10];
        for(int n=0;n<threads.length;n++)
            threads[n] = new Thread() {
            /*
             * (non-Javadoc)
             * @see java.lang.Thread#run()
             */
            public void run() {
                try
                {
                    for (int i = 0 ; i < 100000 ; i++)
                    {
                        CopyOnWriteList copy = cowList.fastCopy();
                        int size = copy.size();
                        for (int j = 0 ; j < size ; j++)
                            copy.get(j);
                    }
                }
                catch (Exception e)
                {
                    e.printStackTrace();
View Full Code Here

{
    protected boolean failed;
   
    public void testFirstGen()
    {
        CopyOnWriteList cowList = new CopyOnWriteList();
       
        assertEquals(0, cowList.getShareLevel());
        cowList.add("v1");
        cowList.add("v2");
        cowList.add("v3");
        assertEquals(0, cowList.getShareLevel());
        assertEquals(3, cowList.size());
       
        CopyOnWriteList child1 = cowList.fastCopy();
        CopyOnWriteList child2 = cowList.fastCopy();
        CopyOnWriteList child3 = cowList.fastCopy();
        assertEquals(3, cowList.getShareLevel());
       
        child1.add("v4");
        assertEquals(2, cowList.getShareLevel());
        assertEquals(3, cowList.size());
        assertEquals(0, child1.getShareLevel());
        assertEquals(2, child2.getShareLevel());
        assertEquals(2, child3.getShareLevel());
        assertEquals(4, child1.size());
        assertEquals(3, child2.size());
        assertEquals(3, child3.size());
    }
View Full Code Here

        assertEquals(3, child3.size());
    }
   
    public void testMultipleGen()
    {
        CopyOnWriteList cowList = new CopyOnWriteList();
       
        assertEquals(0, cowList.getShareLevel());
        cowList.add("v1");
        cowList.add("v2");
        cowList.add("v3");
        assertEquals(0, cowList.getShareLevel());
        assertEquals(3, cowList.size());
       
        CopyOnWriteList child1 = cowList.fastCopy();
        CopyOnWriteList child2 = child1.fastCopy();
        CopyOnWriteList child3 = child2.fastCopy();
        assertEquals(3, cowList.getShareLevel());
       
        child3.add("v4");
        assertEquals(2, cowList.getShareLevel());
        assertEquals(3, cowList.size());
        assertEquals(2, child1.getShareLevel());
        assertEquals(2, child2.getShareLevel());
        assertEquals(0, child3.getShareLevel());
        assertEquals(3, child1.size());
        assertEquals(3, child2.size());
        assertEquals(4, child3.size());
    }
View Full Code Here

                    "DeliveryMode.NON_PERSISTENT" : "DeliveryMode.PERSISTENT"),
                    "INVALID_DELIVERY_MODE");
     
        String connectionID = session.getConnection().getId();
       
        CopyOnWriteList subscriptionsSnapshot;
        synchronized (subscriptionMap)
        {
          sentToTopicCount++;
          if (subscriptions.isEmpty())
            return;
         
          subscriptionsSnapshot = subscriptions.fastCopy();
        }
       
        for (int i = 0; i < subscriptionsSnapshot.size(); i++)
    {
        LocalTopicSubscription subscription = (LocalTopicSubscription)subscriptionsSnapshot.get(i);
           
            // No-local filtering
            if (subscription.getNoLocal() && subscription.getConnectionID().equals(connectionID))
                continue;
View Full Code Here

TOP

Related Classes of net.timewalker.ffmq3.utils.concurrent.CopyOnWriteList$ReferenceAwareVector

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.