[jboss-svn-commits] JBL Code SVN: r36864 - labs/jbosstm/trunk/ArjunaCore/arjuna/classes/com/arjuna/ats/internal/arjuna/coordinator.
jboss-svn-commits at lists.jboss.org
jboss-svn-commits at lists.jboss.org
Mon Mar 28 06:33:06 EDT 2011
Author: jhalliday
Date: 2011-03-28 06:33:06 -0400 (Mon, 28 Mar 2011)
New Revision: 36864
Modified:
labs/jbosstm/trunk/ArjunaCore/arjuna/classes/com/arjuna/ats/internal/arjuna/coordinator/ReaperElement.java
Log:
performance tweaks for tx reaper. JBTM-831
Modified: labs/jbosstm/trunk/ArjunaCore/arjuna/classes/com/arjuna/ats/internal/arjuna/coordinator/ReaperElement.java
===================================================================
--- labs/jbosstm/trunk/ArjunaCore/arjuna/classes/com/arjuna/ats/internal/arjuna/coordinator/ReaperElement.java 2011-03-28 09:30:59 UTC (rev 36863)
+++ labs/jbosstm/trunk/ArjunaCore/arjuna/classes/com/arjuna/ats/internal/arjuna/coordinator/ReaperElement.java 2011-03-28 10:33:06 UTC (rev 36864)
@@ -105,16 +105,37 @@
}
}
- public Reapable _control;
+ @Override
+ public boolean equals(Object o)
+ {
+ if (this == o) return true;
+ if (o == null || getClass() != o.getClass()) return false;
+ ReaperElement that = (ReaperElement) o;
+
+ // could be made more efficient, but this is easier to maintain consistently with compareTo.
+ // note that the comparison includes _absoluteTimeoutMills which is mutable, so weird things
+ // may happen if trying to locate the obj in a collection whilst concurrently mutating it.
+ // fortunately such comparisons are generally done with the obj identity shortcut anyhow.
+ return (compareTo(that) == 0);
+ }
+
+ @Override
+ public int hashCode()
+ {
+ return _control.get_uid().hashCode();
+ }
+
+ public final Reapable _control;
+
private long _absoluteTimeoutMills;
- private int _bias;
+ private final int _bias;
// bias is used to distinguish/sort instances with the same _absoluteTimeoutMills
// as using Uid for this purpose is expensive. JBTM-611
- private static int MAX_BIAS = 1000000;
- private static AtomicInteger biasCounter = new AtomicInteger();
+ private static final int MAX_BIAS = 1000000;
+ private static final AtomicInteger biasCounter = new AtomicInteger();
private static int getBiasCounter()
{
More information about the jboss-svn-commits
mailing list