![]() |
![]() |
|
| Index | Recent Threads | Unanswered Threads | Who's Online | Help |
|
|
| No member browsing this thread |
|
Thread Status: Active Total posts in this thread: 1
|
|
| Author |
|
|
Expert Germany Joined: Mar 15, 2004 Post Count: 766 Status: Offline |
Hello Andy and Erik, I fixed a memory leak (see NUCJDOJCA-5) and have a few questions about the code in ManagedConnectionImpl: 1) What's the difference between cleanup() and destroy()? IMHO both methods do [nearly] the same. Should we maybe put all code in cleanup() and simply call this method from destroy()? According to the JavaDoc of the cleanup() method, it should be able to be called multiple times without causing an exception (and the current implementation complies to this requirement) - so this change should be ok IMHO. If I understand it correctly, the only difference is that cleanup() is always called when a ManagedConnection goes back to the JavaEE server's connection-pool (and thus the ManagedConnection can be reused later after this method was called), while destroy() is final and no other usage of the ManagedConnection will happen afterwards. However, in both cases, the internal JDOPersistenceManager is closed now [which was IMHO missing before] - and I think that's fine since recreating a JDOPersistenceManager is a fast operation, right? So there's no need to behave differently in cleanup() and destroy(). What do you think? 2) There's a package-protected method called clearHandles() which is, however, only called from the outside - not e.g. by cleanup() or destroy(). In contrast to cleanup(), it does not do this: for (Iterator i = handles.iterator(); i.hasNext();)And in contrast to destroy(), it does not do this: List handlesToClose = new ArrayList(handles);Isn't this wrong? When the handles are cleared, shouldn't the setManagedConnection(null) and the om.close() be done on every handle that is removed from the handles? Or is it ensured that this is done by the other code which calls the clearHandles() method? I thought about moving the handle-cleanup code from cleanup() and destroy() to the clearHandles() method, and then call clearHandles() from cleanup() [and cleanup() from destroy() - as described in (1)]. Do you think that makes sense? ---------------------------------------- Best regards, Marco ![]() jfire: free erp, crm, scm and more |
||
|
|
|
|
|
Current timezone is GMT May 17, 2012 11:58:56 AM |