Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
belaban committed Mar 5, 2013
1 parent fcffcdd commit 0603ac9
Showing 1 changed file with 5 additions and 19 deletions.
24 changes: 5 additions & 19 deletions src/org/jgroups/protocols/pbcast/STABLE.java
Expand Up @@ -8,7 +8,6 @@

import java.io.DataInput;
import java.io.DataOutput;
import java.lang.management.ManagementFactory;
import java.util.*;
import java.util.concurrent.Future;
import java.util.concurrent.TimeUnit;
Expand Down Expand Up @@ -65,10 +64,9 @@ public class STABLE extends Protocol {
"If ergonomics is enabled, this value is computed as max(MAX_HEAP * cap, N * max_bytes) where N = number of members")
protected long max_bytes=2000000;

protected long original_max_bytes=max_bytes;

@Property(description="Max percentage of the max heap (-Xmx) to be used for max_bytes. " +
"Only used if ergonomics is enabled. 0 disables setting max_bytes dynamically.")
"Only used if ergonomics is enabled. 0 disables setting max_bytes dynamically.",deprecatedMessage="will be ignored")
@Deprecated
protected double cap=0.10; // 10% of the max heap by default


Expand Down Expand Up @@ -148,7 +146,6 @@ public long getMaxBytes() {

public void setMaxBytes(long max_bytes) {
this.max_bytes=max_bytes;
this.original_max_bytes=max_bytes;
}

@ManagedAttribute(name="bytes_received")
Expand Down Expand Up @@ -211,7 +208,6 @@ protected void resume() {

public void init() throws Exception {
super.init();
original_max_bytes=max_bytes;
}

public void start() throws Exception {
Expand Down Expand Up @@ -392,14 +388,6 @@ protected void handleViewChange(View v) {
resetDigest();
if(!initialized)
initialized=true;

if(ergonomics && cap > 0) {
long max_heap=(long)(ManagementFactory.getMemoryMXBean().getHeapMemoryUsage().getMax() * cap);
long new_size=tmp.size() * original_max_bytes;
max_bytes=Math.min(max_heap, new_size);
if(log.isDebugEnabled())
log.debug("[ergonomics] setting max_bytes to " + Util.printBytes(max_bytes) + " (" + tmp.size() + " members)");
}
}
finally {
lock.unlock();
Expand Down Expand Up @@ -703,7 +691,6 @@ public void run() {

// Run in a separate thread so we don't potentially block (http://jira.jboss.com/jira/browse/JGRP-532)
timer.execute(r);
// down_prot.down(new Event(Event.MSG, msg));
}
}

Expand All @@ -728,9 +715,8 @@ protected void sendStabilityMessage(Digest tmp) {
return;
}

// give other members a chance to mcast STABILITY message. if we receive STABILITY by the end of
// our random sleep, we will not send the STABILITY msg. this prevents that all mbrs mcast a
// STABILITY msg at the same time
// give other members a chance to mcast STABILITY message. if we receive STABILITY by the end of our random
// sleep, we will not send the STABILITY msg. this prevents that all mbrs mcast a STABILITY msg at the same time
delay=Util.random(stability_delay);
if(log.isTraceEnabled()) log.trace(local_addr + ": sending stability msg (in " + delay + " ms) " + tmp.printHighestDeliveredSeqnos());
startStabilityTask(tmp, delay);
Expand Down Expand Up @@ -844,7 +830,7 @@ public void run() {
public String toString() {return STABLE.class.getSimpleName() + ": StableTask";}

long computeSleepTime() {
return getRandom((mbrs.size() * desired_avg_gossip * 2));
return getRandom((desired_avg_gossip * 2));
}

long getRandom(long range) {
Expand Down

0 comments on commit 0603ac9

Please sign in to comment.