Skip to content

Commit

Permalink
Fix for #709
Browse files Browse the repository at this point in the history
  • Loading branch information
jfarcand committed Oct 26, 2012
1 parent 85110ce commit 7ba7684
Showing 1 changed file with 7 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,10 @@

import java.io.Serializable;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Iterator;
import java.util.LinkedHashSet;
import java.util.LinkedList;
import java.util.List;
import java.util.concurrent.CopyOnWriteArrayList;
import java.util.concurrent.Executors;
Expand All @@ -76,7 +79,7 @@ public abstract class AbstractBroadcasterCache implements BroadcasterCache {

private static final Logger logger = LoggerFactory.getLogger(AbstractBroadcasterCache.class);

protected final List<CachedMessage> queue = new CopyOnWriteArrayList<CachedMessage>();
protected final List<CachedMessage> queue = Collections.synchronizedList(new LinkedList<CachedMessage>());

protected ScheduledExecutorService reaper = Executors.newSingleThreadScheduledExecutor();

Expand All @@ -100,7 +103,9 @@ public void run() {

if (System.currentTimeMillis() - message.currentTime() > maxCachedinMs) {
logger.trace("Pruning: {}", message.message());
queue.remove(message);
synchronized (AbstractBroadcasterCache.this) {
queue.remove(message);
}
} else {
break;
}
Expand Down

1 comment on commit 7ba7684

@buildhive
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Atmosphere Framework » atmosphere #370 UNSTABLE
Looks like this commit caused a build failure
(what's this?)

Please sign in to comment.