[CVS nanning] Added a clear method

Lecando Shared <[email protected]> Tue, 30 Sep 2003 07:33:44 -0500
Newsgroups gmane.comp.java.nanning.devel
Message-ID <[email protected]>
<html>
<head>
<style><!--
  body {background-color:#ffffff;}
  .file {border:1px solid #eeeeee;margin-top:1em;margin-bottom:1em;}
  .pathname {font-family:monospace; float:right;}
  .fileheader {margin-bottom:.5em;}
  .diff {margin:0;}
  .tasklist {padding:4px;border:1px dashed #000000;margin-top:1em;}
  .tasklist ul {margin-top:0;margin-bottom:0;}
  tr.alt {background-color:#eeeeee}
  #added {background-color:#ddffdd;}
  #addedchars {background-color:#99ff99;font-weight:bolder;}
  tr.alt #added {background-color:#ccf7cc;}
  #removed {background-color:#ffdddd;}
  #removedchars {background-color:#ff9999;font-weight:bolder;}
  tr.alt #removed {background-color:#f7cccc;}
  #info {color:#888888;}
  #context {background-color:#eeeeee;}
  td {padding-left:.3em;padding-right:.3em;}
  tr.head {border-bottom-width:1px;border-bottom-style:solid;}
  tr.head td {padding:0;padding-top:.2em;}
  .task {background-color:#ffff00;}
  .comment {padding:4px;border:1px dashed #000000;background-color:#ffffdd}
  .error {color:red;}
  hr {border-width:0px;height:2px;background:black;}
--></style>
</head>
<body>
<table cellspacing="0" cellpadding="0" border="0" rules="cols">
<tr class="head"><td colspan="4">Commit in <b><tt>nanning/src/frameworks/prevayler/src</tt></b> on <span id="info">MAIN</span></td></tr>
<tr><td><tt>main/org/codehaus/nanning/prevayler/<a href="#file1">BasicIdentifyingSystem.java</a></tt></td><td align="right" id="added">+12</td><td></td><td nowrap="nowrap" align="center">1.6 -&gt; 1.7</td></tr>
<tr class="alt"><td><tt>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;/<a href="#file2">Identifiable.java</a></tt></td><td align="right" id="added">+5</td><td></td><td nowrap="nowrap" align="center">1.2 -&gt; 1.3</td></tr>
<tr><td><tt>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;/<a href="#file3">IdentifiableImpl.java</a></tt></td><td align="right" id="added">+4</td><td></td><td nowrap="nowrap" align="center">1.2 -&gt; 1.3</td></tr>
<tr class="alt"><td><tt>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;/<a href="#file4">RegisterObjectInterceptor.java</a></tt></td><td></td><td align="right" id="removed">-1</td><td nowrap="nowrap" align="center">1.4 -&gt; 1.5</td></tr>
<tr><td><tt>test/org/codehaus/nanning/prevayler/<a href="#file5">BasicIdentifyingSystemGCTest.java</a></tt></td><td align="right" id="added">+4</td><td></td><td nowrap="nowrap" align="center">1.4 -&gt; 1.5</td></tr>
<tr><td></td><td align="right" id="added">+25</td><td align="right" id="removed">-1</td><td></td></tr>
</table>
<small id="info">5 modified files</small><br />
<pre class="comment">
Added a clear method
</pre>
<hr /><a name="file1" /><div class="file">
<span class="pathname">nanning/src/frameworks/prevayler/src/main/org/codehaus/nanning/prevayler<br /></span>
<div class="fileheader"><big><b>BasicIdentifyingSystem.java</b></big> <small id="info">1.6 -&gt; 1.7</small></div>
<pre class="diff"><small id="info">diff -u -r1.6 -r1.7
--- BasicIdentifyingSystem.java	11 Sep 2003 11:25:37 -0000	1.6
+++ BasicIdentifyingSystem.java	30 Sep 2003 12:33:43 -0000	1.7
@@ -162,4 +162,16 @@
</small></pre><pre class="diff" id="context">     private synchronized long getNextId() {
         return nextObjectId++;
     }
</pre><pre class="diff" id="added">+
+    public synchronized void clear() {
+        for (Iterator i = idToObject.values().iterator(); i.hasNext();) {
+            IdentifiableSoftReference reference = (IdentifiableSoftReference) i.next();
+            Identifiable identifiable = (Identifiable) reference.get();
+            if (identifiable != null) {
+                identifiable.clearObjectID();
+            }
+            i.remove();
+        }
+        nextObjectId = 0;
+    }
</pre><pre class="diff" id="context"> }
</pre></div>
<hr /><a name="file2" /><div class="file">
<span class="pathname">nanning/src/frameworks/prevayler/src/main/org/codehaus/nanning/prevayler<br /></span>
<div class="fileheader"><big><b>Identifiable.java</b></big> <small id="info">1.2 -&gt; 1.3</small></div>
<pre class="diff"><small id="info">diff -u -r1.2 -r1.3
--- Identifiable.java	11 Sep 2003 11:25:37 -0000	1.2
+++ Identifiable.java	30 Sep 2003 12:33:43 -0000	1.3
@@ -13,4 +13,9 @@
</small></pre><pre class="diff" id="context">      * @transaction-required
      */
     void setObjectID(long objectID);
</pre><pre class="diff" id="added">+
+    /**
+     * @transaction-required
+     */
+    void clearObjectID();
</pre><pre class="diff" id="context"> }
</pre></div>
<hr /><a name="file3" /><div class="file">
<span class="pathname">nanning/src/frameworks/prevayler/src/main/org/codehaus/nanning/prevayler<br /></span>
<div class="fileheader"><big><b>IdentifiableImpl.java</b></big> <small id="info">1.2 -&gt; 1.3</small></div>
<pre class="diff"><small id="info">diff -u -r1.2 -r1.3
--- IdentifiableImpl.java	11 Sep 2003 11:25:37 -0000	1.2
+++ IdentifiableImpl.java	30 Sep 2003 12:33:43 -0000	1.3
@@ -31,4 +31,8 @@
</small></pre><pre class="diff" id="context">         logger.debug("Assigned id " + objectID + " to object " + Aspects.getThis());
         this.objectID = objectID;
     }
</pre><pre class="diff" id="added">+
+    public void clearObjectID() {
+        objectID = -1;
+    }
</pre><pre class="diff" id="context"> }
</pre></div>
<hr /><a name="file4" /><div class="file">
<span class="pathname">nanning/src/frameworks/prevayler/src/main/org/codehaus/nanning/prevayler<br /></span>
<div class="fileheader"><big><b>RegisterObjectInterceptor.java</b></big> <small id="info">1.4 -&gt; 1.5</small></div>
<pre class="diff"><small id="info">diff -u -r1.4 -r1.5
--- RegisterObjectInterceptor.java	11 Sep 2003 11:25:37 -0000	1.4
+++ RegisterObjectInterceptor.java	30 Sep 2003 12:33:43 -0000	1.5
@@ -2,7 +2,6 @@
</small></pre><pre class="diff" id="context"> 
 import org.codehaus.nanning.ConstructionInterceptor;
 import org.codehaus.nanning.ConstructionInvocation;
</pre><pre class="diff" id="removed">-import org.codehaus.nanning.attribute.Attributes;
</pre><pre class="diff" id="context"> import org.codehaus.nanning.prevayler.CurrentPrevayler;
 import org.codehaus.nanning.prevayler.IdentifyingSystem;
 
</pre></div>
<hr /><a name="file5" /><div class="file">
<span class="pathname">nanning/src/frameworks/prevayler/src/test/org/codehaus/nanning/prevayler<br /></span>
<div class="fileheader"><big><b>BasicIdentifyingSystemGCTest.java</b></big> <small id="info">1.4 -&gt; 1.5</small></div>
<pre class="diff"><small id="info">diff -u -r1.4 -r1.5
--- BasicIdentifyingSystemGCTest.java	10 Sep 2003 12:24:26 -0000	1.4
+++ BasicIdentifyingSystemGCTest.java	30 Sep 2003 12:33:44 -0000	1.5
@@ -119,6 +119,10 @@
</small></pre><pre class="diff" id="context">             id = objectID;
         }
 
</pre><pre class="diff" id="added">+        public void clearObjectID() {
+            id = -1;
+        }
+
</pre><pre class="diff" id="context">         public boolean equals(Object o) {
             if (this == o) return true;
             if (!(o instanceof IdString)) return false;
</pre></div>
</body></html>