Author: fhanik
Date: Thu Mar 2 15:16:56 2006
New Revision: 382555
URL: http://svn.apache.org/viewcvs?rev=382555&view=rev
Log:
more optimizations, no need to transmit the alive time with a package, the
member is obviously alive. if we care how long, then we can get the data from
the membership service
Modified:
tomcat/container/tc5.5.x/modules/groupcom/src/share/org/apache/catalina/tribes/group/GroupChannel.java
tomcat/container/tc5.5.x/modules/groupcom/src/share/org/apache/catalina/tribes/io/ClusterData.java
tomcat/container/tc5.5.x/modules/groupcom/src/share/org/apache/catalina/tribes/mcast/McastMember.java
Modified:
tomcat/container/tc5.5.x/modules/groupcom/src/share/org/apache/catalina/tribes/group/GroupChannel.java
URL:
http://svn.apache.org/viewcvs/tomcat/container/tc5.5.x/modules/groupcom/src/share/org/apache/catalina/tribes/group/GroupChannel.java?rev=382555&r1=382554&r2=382555&view=diff
==============================================================================
---
tomcat/container/tc5.5.x/modules/groupcom/src/share/org/apache/catalina/tribes/group/GroupChannel.java
(original)
+++
tomcat/container/tc5.5.x/modules/groupcom/src/share/org/apache/catalina/tribes/group/GroupChannel.java
Thu Mar 2 15:16:56 2006
@@ -124,8 +124,10 @@
} else {
fwd = XByteBuffer.deserialize(msg.getMessage().getBytes());
}
- if ( channelListener != null &&
channelListener.accept(fwd,msg.getAddress()))
- channelListener.messageReceived(fwd,msg.getAddress());
+ //get the actual member with the correct alive time
+ Member source = msg.getAddress();
+ if ( channelListener != null &&
channelListener.accept(fwd,source))
+ channelListener.messageReceived(fwd,source);
}catch ( Exception x ) {
log.error("Unable to deserialize channel message.",x);
}
Modified:
tomcat/container/tc5.5.x/modules/groupcom/src/share/org/apache/catalina/tribes/io/ClusterData.java
URL:
http://svn.apache.org/viewcvs/tomcat/container/tc5.5.x/modules/groupcom/src/share/org/apache/catalina/tribes/io/ClusterData.java?rev=382555&r1=382554&r2=382555&view=diff
==============================================================================
---
tomcat/container/tc5.5.x/modules/groupcom/src/share/org/apache/catalina/tribes/io/ClusterData.java
(original)
+++
tomcat/container/tc5.5.x/modules/groupcom/src/share/org/apache/catalina/tribes/io/ClusterData.java
Thu Mar 2 15:16:56 2006
@@ -154,7 +154,7 @@
* @return byte[]
*/
public byte[] getDataPackage() {
- byte[] addr = ((McastMember)address).getData();
+ byte[] addr = ((McastMember)address).getData(false);
int length =
4 + //options
8 + //timestamp off=4
Modified:
tomcat/container/tc5.5.x/modules/groupcom/src/share/org/apache/catalina/tribes/mcast/McastMember.java
URL:
http://svn.apache.org/viewcvs/tomcat/container/tc5.5.x/modules/groupcom/src/share/org/apache/catalina/tribes/mcast/McastMember.java?rev=382555&r1=382554&r2=382555&view=diff
==============================================================================
---
tomcat/container/tc5.5.x/modules/groupcom/src/share/org/apache/catalina/tribes/mcast/McastMember.java
(original)
+++
tomcat/container/tc5.5.x/modules/groupcom/src/share/org/apache/catalina/tribes/mcast/McastMember.java
Thu Mar 2 15:16:56 2006
@@ -138,11 +138,17 @@
* @throws Exception
*/
public byte[] getData() {
- long alive=System.currentTimeMillis()-getServiceStartTime();
-
+ return getData(true);
+ }
+ public byte[] getData(boolean getalive) {
//look in cache first
if ( dataPkg!=null ) {
- XByteBuffer.toBytes((long)alive,dataPkg,0);
+ if ( getalive ) {
+ //you'd be surprised, but System.currentTimeMillis
+ //shows up on the profiler
+ long alive=System.currentTimeMillis()-getServiceStartTime();
+ XByteBuffer.toBytes( (long) alive, dataPkg, 0);
+ }
return dataPkg;
}
@@ -152,9 +158,11 @@
//host - 4 bytes
//dlen - 4 bytes
//domain - dlen bytes
+
byte[] domaind = this.domain;
byte[] addr = host;
byte[] data = new byte[8+4+addr.length+4+domaind.length];
+ long alive=System.currentTimeMillis()-getServiceStartTime();
//reduce byte copying
@@ -173,6 +181,7 @@
System.arraycopy(domaind,0,data,20,domaind.length);
dataPkg = data;
+ System.out.println("McastMember.getData all the way");
return data;
}
/**
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]