This question is related to one I just asked here.
Givenservers is a private static ConcurrentHashMap, are the following two methods and the third approach all equivalent in that the servers map will reflect the change made by all three?
1.
public static synchronized int releaseConnection(Server s) {
return servers.get(s.getId()).decrementConns();
}
2.
public static synchronized int releaseConnection(Server s) {
return s.decrementConns();
}
3. just call decrementConns() where its needed (in other classes)?