Author: fhanik
Date: Thu Jul 6 09:38:44 2006
New Revision: 419612
URL: http://svn.apache.org/viewvc?rev=419612&view=rev
Log:
Set the state of the object reader correctly, and do it before the event happens
Modified:
tomcat/container/tc5.5.x/modules/groupcom/src/share/org/apache/catalina/tribes/io/ObjectReader.java
tomcat/container/tc5.5.x/modules/groupcom/src/share/org/apache/catalina/tribes/transport/nio/NioReceiver.java
tomcat/container/tc5.5.x/modules/groupcom/src/share/org/apache/catalina/tribes/transport/nio/NioReplicationThread.java
Modified:
tomcat/container/tc5.5.x/modules/groupcom/src/share/org/apache/catalina/tribes/io/ObjectReader.java
URL:
http://svn.apache.org/viewvc/tomcat/container/tc5.5.x/modules/groupcom/src/share/org/apache/catalina/tribes/io/ObjectReader.java?rev=419612&r1=419611&r2=419612&view=diff
==============================================================================
---
tomcat/container/tc5.5.x/modules/groupcom/src/share/org/apache/catalina/tribes/io/ObjectReader.java
(original)
+++
tomcat/container/tc5.5.x/modules/groupcom/src/share/org/apache/catalina/tribes/io/ObjectReader.java
Thu Jul 6 09:38:44 2006
@@ -43,6 +43,7 @@
protected long lastAccess = System.currentTimeMillis();
protected boolean accessed = false;
+ private boolean cancelled;
/**
* Creates an <code>ObjectReader</code> for a TCP NIO socket channel
@@ -146,8 +147,16 @@
return lastAccess;
}
+ public boolean isCancelled() {
+ return cancelled;
+ }
+
public void setLastAccess(long lastAccess) {
this.lastAccess = lastAccess;
+ }
+
+ public void setCancelled(boolean cancelled) {
+ this.cancelled = cancelled;
}
}
Modified:
tomcat/container/tc5.5.x/modules/groupcom/src/share/org/apache/catalina/tribes/transport/nio/NioReceiver.java
URL:
http://svn.apache.org/viewvc/tomcat/container/tc5.5.x/modules/groupcom/src/share/org/apache/catalina/tribes/transport/nio/NioReceiver.java?rev=419612&r1=419611&r2=419612&view=diff
==============================================================================
---
tomcat/container/tc5.5.x/modules/groupcom/src/share/org/apache/catalina/tribes/transport/nio/NioReceiver.java
(original)
+++
tomcat/container/tc5.5.x/modules/groupcom/src/share/org/apache/catalina/tribes/transport/nio/NioReceiver.java
Thu Jul 6 09:38:44 2006
@@ -161,11 +161,9 @@
public static void cancelledKey(SelectionKey key) {
try {
- ObjectReader ka = (ObjectReader)key.attachment();
key.cancel();
key.channel().close();
key.attach(null);
- if ( ka != null ) ka.finish();
} catch (IOException e) {
if (log.isDebugEnabled()) log.debug("", e);
// Ignore
@@ -194,7 +192,7 @@
if ( ka != null ) {
long delta = now - ka.getLastAccess();
if (delta > (long) getTimeout() && (!ka.isAccessed()))
{
- log.warn("Channel key is registered, but has had
no interest ops for the last "+getTimeout()+" ms.");
+ log.warn("Channel key is registered, but has had
no interest ops for the last "+getTimeout()+" ms.
(cancelled:"+ka.isCancelled()+")");
ka.setLastAccess(now);
//key.interestOps(SelectionKey.OP_READ);
}//end if
Modified:
tomcat/container/tc5.5.x/modules/groupcom/src/share/org/apache/catalina/tribes/transport/nio/NioReplicationThread.java
URL:
http://svn.apache.org/viewvc/tomcat/container/tc5.5.x/modules/groupcom/src/share/org/apache/catalina/tribes/transport/nio/NioReplicationThread.java?rev=419612&r1=419611&r2=419612&view=diff
==============================================================================
---
tomcat/container/tc5.5.x/modules/groupcom/src/share/org/apache/catalina/tribes/transport/nio/NioReplicationThread.java
(original)
+++
tomcat/container/tc5.5.x/modules/groupcom/src/share/org/apache/catalina/tribes/transport/nio/NioReplicationThread.java
Thu Jul 6 09:38:44 2006
@@ -229,6 +229,11 @@
}
private void cancelKey(final SelectionKey key) {
+ ObjectReader reader = (ObjectReader)key.attachment();
+ if ( reader != null ) {
+ reader.setCancelled(true);
+ reader.finish();
+ }
Runnable cx = new Runnable() {
public void run() {
NioReceiver.cancelledKey(key);
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]