Author: dreedy
Date: Sat Feb 9 21:19:23 2013
New Revision: 1444437
URL: http://svn.apache.org/r1444437
Log:
RIVER-417: Fix FastList to compile with latest Java 7
Modified:
river/jtsk/branches/2.2/src/com/sun/jini/outrigger/FastList.java
Modified: river/jtsk/branches/2.2/src/com/sun/jini/outrigger/FastList.java
URL:
http://svn.apache.org/viewvc/river/jtsk/branches/2.2/src/com/sun/jini/outrigger/FastList.java?rev=1444437&r1=1444436&r2=1444437&view=diff
==============================================================================
--- river/jtsk/branches/2.2/src/com/sun/jini/outrigger/FastList.java (original)
+++ river/jtsk/branches/2.2/src/com/sun/jini/outrigger/FastList.java Sat Feb 9
21:19:23 2013
@@ -96,7 +96,7 @@ class FastList<T extends FastList.Node>
* @return true if this node has never previously been removed, false
if
* it has already been removed.
*/
- private synchronized boolean remove() {
+ synchronized boolean remove() {
if (removed) {
return false;
}
@@ -105,7 +105,7 @@ class FastList<T extends FastList.Node>
}
synchronized void markOnList(FastList<?> list) {
- this.list = list;
+ setList(list);
}
/**
@@ -117,6 +117,34 @@ class FastList<T extends FastList.Node>
public boolean removed() {
return removed;
}
+
+ /**
+ * @return the index
+ */
+ long getIndex() {
+ return index;
+ }
+
+ /**
+ * @param index the index to set
+ */
+ void setIndex(long index) {
+ this.index = index;
+ }
+
+ /**
+ * @return the list
+ */
+ FastList<?> getList() {
+ return list;
+ }
+
+ /**
+ * @param list the list to set
+ */
+ void setList(FastList<?> list) {
+ this.list = list;
+ }
}
private class FastListIteratorImpl implements Iterator<T> {
@@ -171,7 +199,7 @@ class FastList<T extends FastList.Node>
T result = null;
while (baseIterator.hasNext()) {
T node = baseIterator.next();
- if (node.index >= index) {
+ if (node.getIndex() >= index) {
/* Finished, no appropriate nodes.*/
break;
}
@@ -213,14 +241,14 @@ class FastList<T extends FastList.Node>
*/
public void add(T node) {
synchronized (node) {
- if (node.list == null) {
- node.list = this;
+ if (node.getList() == null) {
+ node.setList(this);
} else {
throw new IllegalArgumentException("Attempt to reuse node "
+ node);
}
}
- node.index = nextIndex.getAndIncrement();
+ node.setIndex(nextIndex.getAndIncrement());
baseQueue.add(node);
}
@@ -235,7 +263,7 @@ class FastList<T extends FastList.Node>
*/
public boolean remove(T node) {
synchronized (node) {
- if (node.list != this) {
+ if (node.getList() != this) {
throw new IllegalArgumentException(
"Cannot remove a node from a list it is not on");
}
@@ -252,7 +280,7 @@ class FastList<T extends FastList.Node>
Iterator<T> it = baseQueue.iterator();
while (it.hasNext()) {
T node = it.next();
- if (node.index >= stopIndex) {
+ if (node.getIndex() >= stopIndex) {
// Done enough
return;
}