CVS update: JGroups/src/org/jgroups/protocols STOMP.java
"Bela Ban" <[email protected]> Wed, 27 Oct 2010 07:10:32 +0000
| Newsgroups | gmane.comp.java.javagroups.cvs |
|---|---|
| Message-ID | <[email protected]> |
User: belaban
Date: 10/10/27 07:10:32
Modified: src/org/jgroups/protocols STOMP.java
Log:
ns
Revision Changes Path
1.19 +34 -15 JGroups/src/org/jgroups/protocols/STOMP.java
Index: STOMP.java
===================================================================
RCS file: /cvsroot/javagroups/JGroups/src/org/jgroups/protocols/STOMP.java,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -r1.18 -r1.19
--- STOMP.java 26 Oct 2010 16:08:43 -0000 1.18
+++ STOMP.java 27 Oct 2010 07:10:32 -0000 1.19
@@ -29,7 +29,7 @@
* todo: add PING to test health of client connections
* <p/>
* @author Bela Ban
- * @version $Id: STOMP.java,v 1.18 2010/10/26 16:08:43 belaban Exp $
+ * @version $Id: STOMP.java,v 1.19 2010/10/27 07:10:32 belaban Exp $
* @since 2.11
*/
@MBean
@@ -63,6 +63,7 @@
public String getEndpoints() {return endpoints.toString();}
/* --------------------------------------------- Fields ------------------------------------------------------ */
+ protected Address local_addr;
protected ServerSocket srv_sock;
@ManagedAttribute(writable=false)
protected String endpoint;
@@ -155,6 +156,9 @@
case Event.VIEW_CHANGE:
handleView((View)evt.getArg());
break;
+ case Event.SET_LOCAL_ADDRESS:
+ local_addr=(Address)evt.getArg();
+ break;
}
return down_prot.down(evt);
}
@@ -184,7 +188,7 @@
if(update_clients && this.send_info) {
synchronized(connections) {
for(Connection conn: connections) {
- conn.writeResponse(ServerVerb.INFO, "endpoints", getAllEndpoints());
+ conn.writeResponse(ServerVerb.INFO, "endpoints", getAllEndpoints());
}
}
}
@@ -278,12 +282,8 @@
}
synchronized(connections) {
- for(Connection conn: connections) {
- if(send_info)
- conn.writeResponse(ServerVerb.INFO, "view", view.toString(), "endpoints", getAllEndpoints());
- else
- conn.writeResponse(ServerVerb.INFO, "view", view.toString());
- }
+ for(Connection conn: connections)
+ conn.sendInfo();
}
}
@@ -305,6 +305,26 @@
}
}
+// protected String getAllClients() {
+// StringBuilder sb=new StringBuilder();
+// boolean first=true;
+//
+// synchronized(connections) {
+// for(Connection conn: connections) {
+// UUID session_id=conn.session_id;
+// if(session_id != null) {
+// if(first)
+// first=false;
+// else
+// sb.append(",");
+// sb.append(session_id);
+// }
+// }
+// }
+//
+// return sb.toString();
+// }
+
protected void broadcastEndpoint() {
if(endpoint != null) {
Message msg=new Message();
@@ -482,13 +502,12 @@
}
public void sendInfo() {
- synchronized(connections) {
- for(Connection conn: connections) {
- if(send_info)
- conn.writeResponse(ServerVerb.INFO, "view", view.toString(), "endpoints", getAllEndpoints());
- else
- conn.writeResponse(ServerVerb.INFO, "view", view.toString());
- }
+ if(send_info) {
+ writeResponse(ServerVerb.INFO,
+ "local_addr", local_addr != null? local_addr.toString() : "n/a",
+ "view", view.toString(),
+ "endpoints", getAllEndpoints());
+ // "clients", getAllClients());
}
}
------------------------------------------------------------------------------
Nokia and AT&T present the 2010 Calling All Innovators-North America contest
Create new apps & games for the Nokia N8 for consumers in U.S. and Canada
$10 million total in prizes - $4M cash, 500 devices, nearly $6M in marketing
Develop with Nokia Qt SDK, Web Runtime, or Java and Publish to Ovi Store
http://p.sf.net/sfu/nokia-dev2dev