-
Notifications
You must be signed in to change notification settings - Fork 476
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
- Forward-table now stores messages instead of marshalled messages, which reduces memory as we store the same ref here and in UNICAST{2,3} - Replaced ConcurrentSkipList in delivery_table with LinkedHashMap: canDelivery() now takes ca. 175 ms compared to 22 seconds with MPerf and 300000 messages - Coordinator now forwards messages to itself rather than directly sending them, this prevents starvation of messages from other members - Not using nulls as values for BoundedHashMap; otherwise we cannot find out (on put()) if the null return value means the value didn't exist before, or it was null
- Loading branch information
Showing
6 changed files
with
123 additions
and
74 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
package org.jgroups.util; | ||
|
||
import java.util.LinkedHashMap; | ||
import java.util.Map; | ||
|
||
/** | ||
* Bounded linked hashmap; used by SEQUENCER (and probably soon) FORWARD_TO_COORD | ||
* @author Bela Ban | ||
* @since 3.3 | ||
*/ | ||
public class BoundedHashMap<K,V> extends LinkedHashMap<K,V> { | ||
private static final long serialVersionUID=-5368387761328082187L; | ||
protected final int max_size; | ||
|
||
public BoundedHashMap(int max_size) { | ||
this.max_size=max_size; | ||
} | ||
|
||
protected boolean removeEldestEntry(Map.Entry<K,V> eldest) { | ||
return size() > max_size; | ||
} | ||
|
||
public boolean add(K key, V val) { | ||
return super.put(key, val) == null; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters