Package org.xmlBlaster.util.queue

Examples of org.xmlBlaster.util.queue.BlockingQueueWrapper$I_BlockingQueueCb


    // glob.getNodeId().getId() is not yet available:
    QueuePropertyBase queueProps = new CbQueueProperty(glob, RELATED_AJAX, "/node/dummy");
    queueProps.setMaxEntries(100L);
    queueProps.setMaxBytes(200000L);
    this.updateQueue.initialize(storageId, queueProps);
    this.blockingQueueWrapper = new BlockingQueueWrapper(500L);
    this.blockingQueueWrapper.init(this.updateQueue);
    log.info(id + " Created new sessionId=" + this.sessionId);
    this.xmlBlasterAccess.registerConnectionListener(new I_ConnectionStateListener() {
      public void reachedAlive(ConnectionStateEnum oldState, I_XmlBlasterAccess connection) {
        org.xmlBlaster.client.qos.ConnectReturnQos qos = connection.getConnectReturnQos();
View Full Code Here


               new DummyEntry(glob, PriorityEnum.NORM_PRIORITY, queue.getStorageId(), true),
               new DummyEntry(glob, PriorityEnum.NORM_PRIORITY, queue.getStorageId(), true),
               new DummyEntry(glob, PriorityEnum.NORM_PRIORITY, queue.getStorageId(), true)
                              };
         queue.put(queueEntries, false);
         BlockingQueueWrapper wrapper = new BlockingQueueWrapper(200L);
         wrapper.init(queue);
         int numOfEntries = 2;
         List<I_Entry> ret = wrapper.blockingPeek(numOfEntries, 1000L);
         assertEquals("Wrong number of entries found", 2, ret.size());
         queue.removeNum(2);
         numOfEntries = 2;
         ret = wrapper.blockingPeek(numOfEntries, 1000L);
         assertEquals("Wrong number of entries found", 1, ret.size());
         queue.clear();
         ret = wrapper.blockingPeek(numOfEntries, 1000L);
         assertEquals("Wrong number of entries found", 0, ret.size());
        
         // and now making asynchronous putting with events
         numOfEntries = 3;
         long delay = 500L;
         boolean inhibitEvents = false;
         QueuePutter putter = new QueuePutter(this.queue, delay, numOfEntries, inhibitEvents);
         putter.start();
         long t0 = System.currentTimeMillis();
         ret = wrapper.blockingPeek(numOfEntries, 10000L);
         assertEquals("Wrong number of entries when blocking with events", numOfEntries, ret.size());
         long delta = System.currentTimeMillis() - t0;
         log.info("The blocking request with events took '" + delta + "' milliseconds");
         assertTrue("The method was blocking too long (did probably not wake up correctly", delta < 7000L);
         queue.clear();
         // and now making asynchronous putting without events (polling should detect it)
         numOfEntries = 3;
         delay = 500L;
         inhibitEvents = true;
         putter = new QueuePutter(this.queue, delay, numOfEntries, inhibitEvents);
         putter.start();
         t0 = System.currentTimeMillis();
         ret = wrapper.blockingPeek(numOfEntries, 10000L);
         assertEquals("Wrong number of entries when blocking with events", numOfEntries, ret.size());
         delta = System.currentTimeMillis() - t0;
         log.info("The blocking request without events took '" + delta + "' milliseconds");
         assertTrue("The method was blocking too long (did probably not wake up correctly", delta < 7000L);
         queue.clear();
View Full Code Here

TOP

Related Classes of org.xmlBlaster.util.queue.BlockingQueueWrapper$I_BlockingQueueCb

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.