Author: pferraro
Date: 2008-09-11 13:34:32 -0400 (Thu, 11 Sep 2008)
New Revision: 1809
Modified:
trunk/mod_cluster/src/main/java/org/jboss/modcluster/advertise/impl/AdvertiseListenerImpl.java
Log:
Code cleanup.
Fixed bug in removeServer(...). Though this method is never used.
Modified:
trunk/mod_cluster/src/main/java/org/jboss/modcluster/advertise/impl/AdvertiseListenerImpl.java
===================================================================
---
trunk/mod_cluster/src/main/java/org/jboss/modcluster/advertise/impl/AdvertiseListenerImpl.java 2008-09-11
17:17:38 UTC (rev 1808)
+++
trunk/mod_cluster/src/main/java/org/jboss/modcluster/advertise/impl/AdvertiseListenerImpl.java 2008-09-11
17:34:32 UTC (rev 1809)
@@ -58,9 +58,9 @@
public class AdvertiseListenerImpl implements AdvertiseListener
{
/** Default port for listening Advertise messages. */
- public static int DEFAULT_PORT = 23364;
+ public static final int DEFAULT_PORT = 23364;
/** Default Multicast group address for listening Advertise messages. */
- public static String DEFAULT_GROUP = "224.0.1.105";
+ public static final String DEFAULT_GROUP = "224.0.1.105";
private static final Logger log = Logger.getLogger(AdvertiseListenerImpl.class);
private static final String RFC_822_FMT = "EEE, d MMM yyyy HH:mm:ss Z";
@@ -85,9 +85,7 @@
private Thread workerThread;
- /**
- * The string manager for this package.
- */
+ /** The string manager for this package. */
private StringManager sm = StringManager.getManager(Constants.Package);
private static void digestString(MessageDigest md, String s)
@@ -150,7 +148,8 @@
return this.daemon;
}
- /** Set Advertise security key
+ /**
+ * Set Advertise security key
* @param key The key to use.<br/>
* Security key must match the AdvertiseKey
* on the advertised server.
@@ -164,7 +163,8 @@
}
}
- /** Set Advertise port
+ /**
+ * Set Advertise port
* @param port The UDP port to use.
*/
public void setAdvertisePort(int port)
@@ -177,7 +177,8 @@
return this.advertisePort;
}
- /** Set Advertise Multicaset group address
+ /**
+ * Set Advertise Multicaset group address
* @param address The IP or host address to use.
* @throws UnknownHostException
*/
@@ -186,21 +187,24 @@
this.groupAddress = InetAddress.getByName((address != null) ? address :
DEFAULT_GROUP);
}
- /** Get Advertise Multicaset group address
+ /**
+ * Get Advertise Multicaset group address
*/
public String getGroupAddress()
{
return this.groupAddress.getHostAddress();
}
- /** Get Collection of all AdvertisedServer instances.
+ /**
+ * Get Collection of all AdvertisedServer instances.
*/
public Collection<AdvertisedServer> getServers()
{
return this.servers.values();
}
- /** Get AdvertiseServer server.
+ /**
+ * Get AdvertiseServer server.
* @param name Server name to get.
*/
public AdvertisedServer getServer(String name)
@@ -208,12 +212,15 @@
return this.servers.get(name);
}
- /** Remove the AdvertisedServer from the collection.
+ /**
+ * Remove the AdvertisedServer from the collection.
+ *
* @param server Server to remove.
*/
+ // TODO why is this here? it is never used.
public void removeServer(AdvertisedServer server)
{
- this.servers.remove(server);
+ this.servers.values().remove(server);
}
private synchronized void init() throws IOException
@@ -343,7 +350,7 @@
digestString(this.md, this.securityKey);
digestString(this.md, date);
digestString(this.md, server);
- byte[] our = this.md.digest();
+// byte[] our = this.md.digest();
byte[] dst = new byte[digest.length() * 2];
for (int i = 0, j = 0; i < digest.length(); i++)
{