forked from I2P_Developers/i2p.i2p
revert change causing ConcurrentModificationExceptions
This commit is contained in:
@ -18,7 +18,7 @@ public class RouterVersion {
|
|||||||
/** deprecated */
|
/** deprecated */
|
||||||
public final static String ID = "Monotone";
|
public final static String ID = "Monotone";
|
||||||
public final static String VERSION = CoreVersion.VERSION;
|
public final static String VERSION = CoreVersion.VERSION;
|
||||||
public final static long BUILD = 2;
|
public final static long BUILD = 3;
|
||||||
|
|
||||||
/** for example "-test" */
|
/** for example "-test" */
|
||||||
public final static String EXTRA = "";
|
public final static String EXTRA = "";
|
||||||
|
@ -93,10 +93,11 @@ public class OutboundMessageRegistry {
|
|||||||
List<MessageSelector> removedSelectors = null;
|
List<MessageSelector> removedSelectors = null;
|
||||||
|
|
||||||
synchronized (_selectors) {
|
synchronized (_selectors) {
|
||||||
for (Iterator<MessageSelector> iter = _selectors.iterator(); iter.hasNext(); ) {
|
// ConcurrentModificationException - why?
|
||||||
MessageSelector sel = iter.next();
|
//for (Iterator<MessageSelector> iter = _selectors.iterator(); iter.hasNext(); ) {
|
||||||
if (sel == null)
|
// MessageSelector sel = iter.next();
|
||||||
continue;
|
for (int i = 0; i < _selectors.size(); i++) {
|
||||||
|
MessageSelector sel = (MessageSelector)_selectors.get(i);
|
||||||
boolean isMatch = sel.isMatch(message);
|
boolean isMatch = sel.isMatch(message);
|
||||||
if (isMatch) {
|
if (isMatch) {
|
||||||
if (matchedSelectors == null) matchedSelectors = new ArrayList(1);
|
if (matchedSelectors == null) matchedSelectors = new ArrayList(1);
|
||||||
@ -104,7 +105,9 @@ public class OutboundMessageRegistry {
|
|||||||
if (!sel.continueMatching()) {
|
if (!sel.continueMatching()) {
|
||||||
if (removedSelectors == null) removedSelectors = new ArrayList(1);
|
if (removedSelectors == null) removedSelectors = new ArrayList(1);
|
||||||
removedSelectors.add(sel);
|
removedSelectors.add(sel);
|
||||||
iter.remove();
|
//iter.remove();
|
||||||
|
_selectors.remove(i);
|
||||||
|
i--;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -258,14 +261,19 @@ public class OutboundMessageRegistry {
|
|||||||
|
|
||||||
public void timeReached() {
|
public void timeReached() {
|
||||||
long now = _context.clock().now();
|
long now = _context.clock().now();
|
||||||
List<MessageSelector> removing = new ArrayList(1);
|
List<MessageSelector> removing = new ArrayList(8);
|
||||||
synchronized (_selectors) {
|
synchronized (_selectors) {
|
||||||
for (Iterator<MessageSelector> iter = _selectors.iterator(); iter.hasNext(); ) {
|
// CME?
|
||||||
MessageSelector sel = iter.next();
|
//for (Iterator<MessageSelector> iter = _selectors.iterator(); iter.hasNext(); ) {
|
||||||
|
// MessageSelector sel = iter.next();
|
||||||
|
for (int i = 0; i < _selectors.size(); i++) {
|
||||||
|
MessageSelector sel = (MessageSelector)_selectors.get(i);
|
||||||
long expiration = sel.getExpiration();
|
long expiration = sel.getExpiration();
|
||||||
if (expiration <= now) {
|
if (expiration <= now) {
|
||||||
removing.add(sel);
|
removing.add(sel);
|
||||||
iter.remove();
|
//iter.remove();
|
||||||
|
_selectors.remove(i);
|
||||||
|
i--;
|
||||||
} else if (expiration < _nextExpire || _nextExpire < now) {
|
} else if (expiration < _nextExpire || _nextExpire < now) {
|
||||||
_nextExpire = expiration;
|
_nextExpire = expiration;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user