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
public class InstrumentedSet<E> extends ForwardingSet<E> { | |
private int addCount = 0; | |
public InstrumentedSet(Set<E> s) { | |
super(s); | |
} | |
@Override | |
public boolean add(E e) { | |
addCount++; |
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
// Broken - Inappropriate use of inheritance! | |
public class InstrumentedHashSet<E> extends HashSet<E> { | |
// The number of attempted element insertions | |
private int addCount = 0; | |
public InstrumentedHashSet() { | |
} | |
public InstrumentedHashSet(int initCap, float loadFactor) { | |
super(initCap, loadFactor); | |
} | |
@Override public boolean add(E e) { |
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
public class ForwardingSet<E> implements Set<E> { | |
private final Set<E> s; | |
public ForwardingSet(Set<E> s) { | |
this.s = s; | |
} | |
public void clear() { | |
s.clear(); | |
} |
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
# Load balancer configuration | |
upstream exampleApp { | |
# Directs to the process with least number of connections. | |
least_conn; | |
# One failed response will take a server out of circulation for 20 seconds. | |
server 127.0.0.1:10080 fail_timeout=20s; | |
#server 127.0.0.1:10081 fail_timeout=20s; | |
#server 127.0.0.1:10082 fail_timeout=20s; | |
#server 127.0.0.1:10083 fail_timeout=20s; |