Author: remy.maucherat(a)jboss.com
Date: 2008-07-15 12:09:39 -0400 (Tue, 15 Jul 2008)
New Revision: 716
Modified:
trunk/java/org/jboss/web/cluster/ClusterListener.java
Log:
- No functional change: remove duplicate nested sync block.
Modified: trunk/java/org/jboss/web/cluster/ClusterListener.java
===================================================================
--- trunk/java/org/jboss/web/cluster/ClusterListener.java 2008-07-15 16:08:30 UTC (rev
715)
+++ trunk/java/org/jboss/web/cluster/ClusterListener.java 2008-07-15 16:09:39 UTC (rev
716)
@@ -1030,35 +1030,33 @@
protected synchronized void status(Engine engine) {
// Check to add or remove proxies, and rebuild a new list if needed
- synchronized (this) {
- if (!addProxies.isEmpty() || !removeProxies.isEmpty()) {
- ArrayList<Proxy> currentProxies = new ArrayList<Proxy>();
- for (int i = 0; i < proxies.length; i++) {
- currentProxies.add(proxies[i]);
+ if (!addProxies.isEmpty() || !removeProxies.isEmpty()) {
+ ArrayList<Proxy> currentProxies = new ArrayList<Proxy>();
+ for (int i = 0; i < proxies.length; i++) {
+ currentProxies.add(proxies[i]);
+ }
+ for (int i = 0; i < addProxies.size(); i++) {
+ if (!currentProxies.contains(addProxies.get(i))) {
+ currentProxies.add(addProxies.get(i));
}
- for (int i = 0; i < addProxies.size(); i++) {
- if (!currentProxies.contains(addProxies.get(i))) {
- currentProxies.add(addProxies.get(i));
- }
+ }
+ for (int i = 0; i < removeProxies.size(); i++) {
+ if (currentProxies.contains(removeProxies.get(i))) {
+ currentProxies.remove(removeProxies.get(i));
}
- for (int i = 0; i < removeProxies.size(); i++) {
- if (currentProxies.contains(removeProxies.get(i))) {
- currentProxies.remove(removeProxies.get(i));
- }
+ }
+ addProxies.clear();
+ removeProxies.clear();
+ proxies = currentProxies.toArray(new Proxy[0]);
+ // Reset all connections
+ if (connections != null) {
+ for (int i = 0; i < connections.length; i++) {
+ closeConnection(i);
}
- addProxies.clear();
- removeProxies.clear();
- proxies = currentProxies.toArray(new Proxy[0]);
- // Reset all connections
- if (connections != null) {
- for (int i = 0; i < connections.length; i++) {
- closeConnection(i);
- }
- }
- connections = new Socket[proxies.length];
- connectionReaders = new BufferedReader[proxies.length];
- connectionWriters = new BufferedWriter[proxies.length];
}
+ connections = new Socket[proxies.length];
+ connectionReaders = new BufferedReader[proxies.length];
+ connectionWriters = new BufferedWriter[proxies.length];
}
Proxy[] local = proxies;
Show replies by date