Package jdbm.helper

Examples of jdbm.helper.Tuple


    public void loadPreparedTransactions(TransactionManager transactionManager) throws XAException {
        log.info("Recovering prepared transactions");

        try {
            Tuple tuple = new Tuple();
            TupleBrowser iter = database.browse();
            while (iter.getNext(tuple)) {
                ActiveMQXid xid = (ActiveMQXid) tuple.getKey();
                Transaction transaction = (Transaction) tuple.getValue();
                transactionManager.loadTransaction(xid, transaction);
            }
        }
        catch (IOException e) {
            log.error("Failed to recover prepared transactions: " + e, e);
View Full Code Here


         }
      }

      // Browse the expiry and remove accordingly
      TupleBrowser browse = expiryTree.browse();
      Tuple tuple = new Tuple();
      List<Long> times = new ArrayList<Long>();
      List<Object> keys = new ArrayList<Object>();
      while (browse.getNext(tuple)) {
         Long time = (Long) tuple.getKey();
         if (time > System.currentTimeMillis())
            break;
         times.add(time);
         Object key = tuple.getValue();
         if (key instanceof List)
            keys.addAll((List) key);
         else
            keys.add(key);
      }
View Full Code Here

         }
      }

      // Browse the expiry and remove accordingly
      TupleBrowser browse = expiryTree.browse();
      Tuple tuple = new Tuple();
      List<Long> times = new ArrayList<Long>();
      List<Object> keys = new ArrayList<Object>();
      while (browse.getNext(tuple)) {
         Long time = (Long) tuple.getKey();
         if (time > timeService.wallClockTime())
            break;
         times.add(time);
         Object key = tuple.getValue();
         if (key instanceof List)
            keys.addAll((List<?>) key);
         else
            keys.add(key);
      }
View Full Code Here

   }

   private Set<Object> getChildrenNames0(Fqn name) throws IOException
   {
      TupleBrowser browser = tree.browse(name);
      Tuple t = new Tuple();

      if (browser.getNext(t))
      {
         if (!t.getValue().equals(NODE))
         {
            log.trace(" not a node");
            return null;
         }
      }
      else
      {
         log.trace(" no nodes");
         return null;
      }

      Set<Object> set = new HashSet<Object>();

      // Want only /a/b/c/X nodes
      int depth = name.size() + 1;
      while (browser.getNext(t))
      {
         Fqn fqn = (Fqn) t.getKey();
         int size = fqn.size();
         if (size < depth)
         {
            break;
         }
         if (size == depth && t.getValue().equals(NODE))
         {
            set.add(fqn.getLastElement());
         }
      }
View Full Code Here

         }
         return null;
      }

      Fqn keys = keys(name);
      Tuple t = new Tuple();
      Map map = new HashMap();

      synchronized (tree)
      {
         TupleBrowser browser = tree.browse(keys);
         while (browser.getNext(t))
         {
            Fqn fqn = (Fqn) t.getKey();
            if (!fqn.isChildOf(keys))
            {
               break;
            }
            Object k = fqn.getLastElement();
            Object v = t.getValue();
            map.put(nullUnmask(k), nullUnmask(v));
         }
      }

      if (trace)
View Full Code Here

         log.trace("erase " + name + " self=" + self);
      }
      synchronized (tree)
      {
         TupleBrowser browser = tree.browse(name);
         Tuple t = new Tuple();
         if (browser.getNext(t) && self)
         {
            tree.remove(t.getKey());
         }

         while (browser.getNext(t))
         {
            Fqn fqn = (Fqn) t.getKey();
            if (!fqn.isChildOf(name))
            {
               break;
            }
            tree.remove(fqn);
View Full Code Here

    * Dumps the tree past the key to debug.
    */
   public void dump(Object key) throws IOException
   {
      TupleBrowser browser = tree.browse(key);
      Tuple t = new Tuple();
      log.debug("contents: " + key);
      while (browser.getNext(t))
      {
         log.debug(t.getKey() + "\t" + t.getValue());
      }
      log.debug("");
   }
View Full Code Here

        table.insert(new Long(124), "BAR", true);
        table.insert(new Long(125), "XYZ", true);
        table.insert(new Long(126), "ABC", true);
        table.insert(new Long(127), "DEF", true);

        Tuple tuple = new Tuple();
        TupleBrowser iter = table.browse();
        while (iter.getNext(tuple)) {
            Object key = tuple.getKey();
            System.out.println("Key " + key);
        }
        manager.stop();
    }
View Full Code Here

            Object lastAckedSequenceNumber = lastAcked.getSequenceNumber();

            // lets iterate through all IDs from the

            //Tuple tuple = new Tuple();
            Tuple tuple = getOrderedIndex().findGreaterOrEqual(lastAckedSequenceNumber);

            TupleBrowser iter = getOrderedIndex().browse();
            while (iter.getNext(tuple)) {
                Long sequenceNumber = (Long) tuple.getKey();
                if (sequenceNumber.compareTo(lastAckedSequenceNumber) > 0) {
                    ActiveMQMessage message = null;

                    // TODO we could probably tune this some more since we have tuple.getValue() already
                    message = getMessageBySequenceNumber(sequenceNumber);
View Full Code Here

        }
    }

    public synchronized void recover(RecoveryListener listener) throws JMSException {
        try {
            Tuple tuple = new Tuple();
            TupleBrowser iter = getOrderedIndex().browse();
            while (iter.getNext(tuple)) {
                Long key = (Long) tuple.getKey();
                MessageIdentity messageIdentity = null;
                if (key != null) {
                    String messageID = (String) tuple.getValue();
                    if (messageID != null) {
                        messageIdentity = new MessageIdentity(messageID, key);
                    }
                }
                if (messageIdentity != null) {
View Full Code Here

TOP

Related Classes of jdbm.helper.Tuple

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.