[virtualcommons-svn] SF.net SVN: virtualcommons:[305] csidex/trunk/src/main/java/edu/asu/commons /n
Status: Beta
Brought to you by:
alllee
|
From: <al...@us...> - 2009-10-20 00:17:18
|
Revision: 305
http://virtualcommons.svn.sourceforge.net/virtualcommons/?rev=305&view=rev
Author: alllee
Date: 2009-10-20 00:15:43 +0000 (Tue, 20 Oct 2009)
Log Message:
-----------
turning EOFExceptions into a reason to disconnect the client.
Modified Paths:
--------------
csidex/trunk/src/main/java/edu/asu/commons/net/SocketDispatcherWorker.java
Modified: csidex/trunk/src/main/java/edu/asu/commons/net/SocketDispatcherWorker.java
===================================================================
--- csidex/trunk/src/main/java/edu/asu/commons/net/SocketDispatcherWorker.java 2009-10-19 21:03:43 UTC (rev 304)
+++ csidex/trunk/src/main/java/edu/asu/commons/net/SocketDispatcherWorker.java 2009-10-20 00:15:43 UTC (rev 305)
@@ -13,14 +13,11 @@
/**
* $Id$
*
- * Worker class that helps the Client and Server SocketDispatchers perform
- * reading and writing of edu.indiana.psych.gee.event.Event-S. Reading EventS
- * from the Socket is a blocking I/O operation and thus requirs its own
- * dedicated thread of execution. Writes can and often do occur within a
- * separate thread of execution, initiated by whatever class is manipulating
- * this one.
+ * This class is a basic Socket-based Runnable that helps Client and Server SocketDispatchers perform
+ * reading and writing of Events. Will read Events from the socket via blocking I/O after this Runnable
+ * is start()-ed. Writes occur within caller's thread of execution.
*
- * @author <a href='al...@cs...'>Allen Lee</a>
+ * @author <a href='all...@as...'>Allen Lee</a>
* @version $Revision$
*/
class SocketDispatcherWorker implements Runnable {
@@ -139,25 +136,26 @@
dispatcher.notifyAll();
}
}
- // XXX: try to recover from StreamCorruptedExceptions and
- // EOFExceptions...
+ // XXX: try to recover from StreamCorruptedExceptions
catch (StreamCorruptedException e) {
e.printStackTrace();
break;
}
catch (EOFException e) {
e.printStackTrace();
- break;
+ requestDisconnection(e);
+ // kills this thread.
+ stop();
}
catch (IOException e) {
e.printStackTrace();
requestDisconnection(e);
- running = false;
+ stop();
}
catch (ClassNotFoundException e) {
e.printStackTrace();
requestDisconnection(e);
- running = false;
+ stop();
}
}
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|