Author: fhanik
Date: Mon Aug 13 06:54:30 2007
New Revision: 565352
URL: http://svn.apache.org/viewvc?view=rev&rev=565352
Log:
Fix NPE in the map, add accessors to stats information
Modified:
tomcat/trunk/java/org/apache/catalina/tribes/group/interceptors/ThroughputInterceptor.java
tomcat/trunk/java/org/apache/catalina/tribes/tipis/AbstractReplicatedMap.java
Modified:
tomcat/trunk/java/org/apache/catalina/tribes/group/interceptors/ThroughputInterceptor.java
URL:
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/tribes/group/interceptors/ThroughputInterceptor.java?view=diff&rev=565352&r1=565351&r2=565352
==============================================================================
---
tomcat/trunk/java/org/apache/catalina/tribes/group/interceptors/ThroughputInterceptor.java
(original)
+++
tomcat/trunk/java/org/apache/catalina/tribes/group/interceptors/ThroughputInterceptor.java
Mon Aug 13 06:54:30 2007
@@ -16,6 +16,10 @@
package org.apache.catalina.tribes.group.interceptors;
+import java.text.DecimalFormat;
+import java.util.concurrent.atomic.AtomicInteger;
+import java.util.concurrent.atomic.AtomicLong;
+
import org.apache.catalina.tribes.ChannelException;
import org.apache.catalina.tribes.ChannelMessage;
import org.apache.catalina.tribes.Member;
@@ -23,10 +27,6 @@
import org.apache.catalina.tribes.group.InterceptorPayload;
import org.apache.catalina.tribes.io.ChannelData;
import org.apache.catalina.tribes.io.XByteBuffer;
-import java.text.DecimalFormat;
-import org.apache.catalina.tribes.membership.MemberImpl;
-import java.util.concurrent.atomic.AtomicInteger;
-import java.util.concurrent.atomic.AtomicLong;
@@ -61,7 +61,7 @@
super.sendMessage(destination, msg, payload);
}catch ( ChannelException x ) {
msgTxErr.addAndGet(1);
- access.addAndGet(-1);
+ if ( access.get() == 1 ) access.addAndGet(-1);
throw x;
}
mbTx += ((double)(bytes*destination.length))/(1024d*1024d);
@@ -115,6 +115,46 @@
public int getInterval() {
return interval;
+ }
+
+ public double getLastCnt() {
+ return lastCnt;
+ }
+
+ public double getMbAppTx() {
+ return mbAppTx;
+ }
+
+ public double getMbRx() {
+ return mbRx;
+ }
+
+ public double getMbTx() {
+ return mbTx;
+ }
+
+ public AtomicLong getMsgRxCnt() {
+ return msgRxCnt;
+ }
+
+ public AtomicLong getMsgTxCnt() {
+ return msgTxCnt;
+ }
+
+ public AtomicLong getMsgTxErr() {
+ return msgTxErr;
+ }
+
+ public long getRxStart() {
+ return rxStart;
+ }
+
+ public double getTimeTx() {
+ return timeTx;
+ }
+
+ public long getTxStart() {
+ return txStart;
}
}
Modified:
tomcat/trunk/java/org/apache/catalina/tribes/tipis/AbstractReplicatedMap.java
URL:
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/tribes/tipis/AbstractReplicatedMap.java?view=diff&rev=565352&r1=565351&r2=565352
==============================================================================
---
tomcat/trunk/java/org/apache/catalina/tribes/tipis/AbstractReplicatedMap.java
(original)
+++
tomcat/trunk/java/org/apache/catalina/tribes/tipis/AbstractReplicatedMap.java
Mon Aug 13 06:54:30 2007
@@ -511,7 +511,7 @@
while (i.hasNext()) {
Map.Entry e = (Map.Entry) i.next();
MapEntry entry = (MapEntry) super.get(e.getKey());
- if ( entry.isSerializable() ) {
+ if ( entry != null && entry.isSerializable() ) {
boolean copy = (mapmsg.getMsgType() ==
mapmsg.MSG_STATE_COPY);
MapMessage me = new MapMessage(mapContextName,
copy?MapMessage.MSG_COPY:MapMessage.MSG_PROXY,
@@ -719,6 +719,7 @@
while (i.hasNext()) {
Map.Entry e = (Map.Entry) i.next();
MapEntry entry = (MapEntry) super.get(e.getKey());
+ if (entry==null) continue;
if (entry.isPrimary() && inSet(member,entry.getBackupNodes())) {
if (log.isDebugEnabled()) log.debug("[1] Primary choosing a
new backup");
try {
@@ -977,7 +978,7 @@
while (i.hasNext()) {
Map.Entry e = (Map.Entry) i.next();
MapEntry entry = (MapEntry) super.get(e.getKey());
- if (entry.isPrimary() && value.equals(entry.getValue()))
return true;
+ if (entry!=null && entry.isPrimary() &&
value.equals(entry.getValue())) return true;
}//while
return false;
}//end if
@@ -1062,7 +1063,7 @@
while ( i.hasNext() ) {
Map.Entry e = (Map.Entry)i.next();
MapEntry entry = (MapEntry)super.get(e.getKey());
- if ( entry.isPrimary() && entry.getValue()!=null)
values.add(entry.getValue());
+ if (entry!=null && entry.isPrimary() &&
entry.getValue()!=null) values.add(entry.getValue());
}
return Collections.unmodifiableCollection(values);
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]