Author: shawkins
Date: 2010-04-11 21:49:40 -0400 (Sun, 11 Apr 2010)
New Revision: 2049
Modified:
trunk/runtime/src/main/java/org/teiid/transport/ChannelListener.java
trunk/runtime/src/main/java/org/teiid/transport/SSLAwareChannelHandler.java
trunk/runtime/src/main/java/org/teiid/transport/SocketClientInstance.java
Log:
adding an explicit logoff in the event of a disconnected channel
Modified: trunk/runtime/src/main/java/org/teiid/transport/ChannelListener.java
===================================================================
--- trunk/runtime/src/main/java/org/teiid/transport/ChannelListener.java 2010-04-11
01:59:21 UTC (rev 2048)
+++ trunk/runtime/src/main/java/org/teiid/transport/ChannelListener.java 2010-04-12
01:49:40 UTC (rev 2049)
@@ -36,5 +36,7 @@
void exceptionOccurred(Throwable t);
+ void disconnected();
+
void onConnection() throws CommunicationException;
}
\ No newline at end of file
Modified: trunk/runtime/src/main/java/org/teiid/transport/SSLAwareChannelHandler.java
===================================================================
--- trunk/runtime/src/main/java/org/teiid/transport/SSLAwareChannelHandler.java 2010-04-11
01:59:21 UTC (rev 2048)
+++ trunk/runtime/src/main/java/org/teiid/transport/SSLAwareChannelHandler.java 2010-04-12
01:49:40 UTC (rev 2049)
@@ -217,6 +217,7 @@
ChannelListener listener = this.listeners.remove(e.getChannel());
if (listener != null) {
LogManager.logDetail(LogConstants.CTX_TRANSPORT,
NetPlugin.Util.getString("SSLAwareChannelHandler.channel_closed"));
//$NON-NLS-1$
+ listener.disconnected();
}
}
Modified: trunk/runtime/src/main/java/org/teiid/transport/SocketClientInstance.java
===================================================================
--- trunk/runtime/src/main/java/org/teiid/transport/SocketClientInstance.java 2010-04-11
01:59:21 UTC (rev 2048)
+++ trunk/runtime/src/main/java/org/teiid/transport/SocketClientInstance.java 2010-04-12
01:49:40 UTC (rev 2049)
@@ -26,6 +26,7 @@
import java.net.InetSocketAddress;
import java.net.SocketAddress;
+import org.teiid.client.security.ILogon;
import org.teiid.dqp.internal.process.DQPWorkContext;
import org.teiid.net.CommunicationException;
import org.teiid.net.NetPlugin;
@@ -106,6 +107,22 @@
}
this.objectSocket.write(handshake);
}
+
+ @Override
+ public void disconnected() {
+ if (workContext.getSessionId() != -1) {
+ workContext.runInContext(new Runnable() {
+ @Override
+ public void run() {
+ try {
+ csr.getClientService(ILogon.class).logoff();
+ } catch (Exception e) {
+ LogManager.logDetail(LogConstants.CTX_TRANSPORT, e, "Exception closing client
instance"); //$NON-NLS-1$
+ }
+ }
+ });
+ }
+ }
private void receivedHahdshake(Handshake handshake) throws CommunicationException {
if (usingEncryption) {
Show replies by date