Dude it worked! Thanks!

I am reading the NodeRevisionContent like so:

InputStream in = null;
try {
 in = new ByteArrayInputStream(content.getContentBytes());
}
finally {
 in.close();
}

Perhaps something goes wrong during NodeRevisionContent.getContentBytes() ? But it looks like that method correctly closes the InputStream though.

--
Unico

Oliver Zeigermann wrote:

If you are not using compressed there will be an input stream in
content that is the one from the JDBC driver and *must* be closed to
close the connection. Try enabling compression if not already done and
see if this changes anything.

Oliver


On Fri, 19 Nov 2004 16:25:12 +0100, Unico Hommes <[EMAIL PROTECTED]> wrote:


Hi guys,

I am struggling with a dead lock due to JDBC connections that don't
seems to get released. I did a very simple test where I iterate over all
nodes in the database and read their contents:

Iterator uris = new StructureIterator();
while(uris.hasNext()) {
 String uri = (String) uris.next();
 try {
   final NodeRevisionDescriptors descriptors =
m_content.retrieve(m_token, uri);
   final NodeRevisionDescriptor descriptor =
m_content.retrieve(m_token, descriptors);
   final NodeRevisionContent content = m_content.retrieve(m_token,
descriptors, descriptor);

   [snip stuff]

 }
 catch (SlideException e) {
    System.err.println(e);
 }
}

/**
* Iterates over all nodes within a Namespace
*/
class StructureIterator implements Iterator {

   private final ArrayStack m_stack = new ArrayStack();

   StructureIterator() {
       m_stack.push(m_structure.retrieve(m_token, "/"));
   }
   public boolean hasNext() {
       return !m_stack.empty();
   }

   public Object next() {
       if (!hasNext()) {
           throw new NoSuchElementException();
       }
       final ObjectNode node = (ObjectNode) m_stack.pop();
       traverse(node);
       return node.getUri();
   }

   private void traverse(ObjectNode node) {
       try {

m_stack.addAll(Collections.list(m_structure.getChildren(m_token, node)));
       }
       catch (SlideException e) {
           m_logger.error("Error iterating through repository", e);
       }
   }

}

It looks like each iteration "eats" a database connection. Probably it
is something I am doing wrong using the Slide API but this used to work.

Thoughts?

--
Unico

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]





--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]





---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to