Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

made socket service better handle normal errors (user disconnects ear…

…ly etc.) - also added IntelliJ IDEA iml files
  • Loading branch information...
commit def4ba55e2694d35ed53981155c0d5fec7664aa2 1 parent 147c973
Henrik Hofmeister authored February 08, 2013
1  modules/webi-client/webi-client.iml
@@ -11,7 +11,6 @@
11 11
     </content>
12 12
     <orderEntry type="inheritedJdk" />
13 13
     <orderEntry type="sourceFolder" forTests="false" />
14  
-    <orderEntry type="library" name="Maven: vonhof:babelshark:1.0-SNAPSHOT" level="project" />
15 14
     <orderEntry type="library" scope="TEST" name="Maven: junit:junit:3.8.1" level="project" />
16 15
     <orderEntry type="module" module-name="babelshark" />
17 16
     <orderEntry type="library" name="Maven: org.codehaus.jackson:jackson-core-asl:1.9.5" level="project" />
1  modules/webi-db/webi-db.iml
@@ -11,7 +11,6 @@
11 11
     </content>
12 12
     <orderEntry type="inheritedJdk" />
13 13
     <orderEntry type="sourceFolder" forTests="false" />
14  
-    <orderEntry type="library" name="Maven: vonhof:babelshark:1.0-SNAPSHOT" level="project" />
15 14
     <orderEntry type="library" scope="TEST" name="Maven: junit:junit:3.8.1" level="project" />
16 15
     <orderEntry type="module" module-name="webi" />
17 16
     <orderEntry type="library" name="Maven: org.eclipse.jetty:jetty-server:8.1.2.v20120308" level="project" />
1  modules/webi-mongo/webi-mongo.iml
@@ -11,7 +11,6 @@
11 11
     </content>
12 12
     <orderEntry type="inheritedJdk" />
13 13
     <orderEntry type="sourceFolder" forTests="false" />
14  
-    <orderEntry type="library" name="Maven: vonhof:babelshark:1.0-SNAPSHOT" level="project" />
15 14
     <orderEntry type="library" scope="TEST" name="Maven: junit:junit:3.8.1" level="project" />
16 15
     <orderEntry type="library" name="Maven: org.mongodb:mongo-java-driver:2.8.0" level="project" />
17 16
     <orderEntry type="module" module-name="webi-db" />
1  modules/webi-php/webi-php.iml
@@ -11,7 +11,6 @@
11 11
     </content>
12 12
     <orderEntry type="inheritedJdk" />
13 13
     <orderEntry type="sourceFolder" forTests="false" />
14  
-    <orderEntry type="library" name="Maven: vonhof:babelshark:1.0-SNAPSHOT" level="project" />
15 14
     <orderEntry type="library" scope="TEST" name="Maven: junit:junit:3.8.1" level="project" />
16 15
     <orderEntry type="module" module-name="webi" />
17 16
     <orderEntry type="library" name="Maven: org.eclipse.jetty:jetty-server:8.1.2.v20120308" level="project" />
1  modules/webi-postgres/webi-postgres.iml
@@ -11,7 +11,6 @@
11 11
     </content>
12 12
     <orderEntry type="inheritedJdk" />
13 13
     <orderEntry type="sourceFolder" forTests="false" />
14  
-    <orderEntry type="library" name="Maven: vonhof:babelshark:1.0-SNAPSHOT" level="project" />
15 14
     <orderEntry type="library" scope="TEST" name="Maven: junit:junit:3.8.1" level="project" />
16 15
     <orderEntry type="library" name="Maven: postgresql:postgresql:9.1-901-1.jdbc4" level="project" />
17 16
     <orderEntry type="library" name="Maven: org.springframework:spring-jdbc:3.0.5.RELEASE" level="project" />
13  modules/webi-websockets/src/main/java/com/vonhof/webi/websockets/SocketService.java
@@ -10,6 +10,7 @@
10 10
 import com.vonhof.babelshark.reflect.MethodInfo.Parameter;
11 11
 import com.vonhof.webi.HttpException;
12 12
 import java.lang.reflect.InvocationTargetException;
  13
+import java.nio.channels.ClosedChannelException;
13 14
 import java.util.ArrayList;
14 15
 import java.util.HashMap;
15 16
 import java.util.List;
@@ -18,6 +19,8 @@
18 19
 import java.util.logging.Level;
19 20
 import java.util.logging.Logger;
20 21
 import javax.inject.Inject;
  22
+
  23
+import org.eclipse.jetty.io.EofException;
21 24
 import org.eclipse.jetty.websocket.WebSocket;
22 25
 
23 26
 public class SocketService<T extends SocketService.Client> {
@@ -93,7 +96,17 @@ private boolean send(Client client, Event evt) {
93 96
             client.connection.sendMessage(output);
94 97
             
95 98
             return true;
  99
+        } catch (EofException ex) {
  100
+            //Ignore error
  101
+            return false;
  102
+        } catch (ClosedChannelException ex) {
  103
+            //Ignore error
  104
+            return false;
96 105
         } catch (Exception ex) {
  106
+            if (ex.getMessage() != null && ex.getMessage().contains("Broken pipe")) {
  107
+                //Ignore error - user disconnected quickly.
  108
+                return false;
  109
+            }
97 110
             Logger.getLogger(SocketService.class.getName()).log(Level.SEVERE, null, ex);
98 111
             return false;
99 112
         }
1  modules/webi-websockets/webi-websockets.iml
@@ -10,7 +10,6 @@
10 10
     </content>
11 11
     <orderEntry type="inheritedJdk" />
12 12
     <orderEntry type="sourceFolder" forTests="false" />
13  
-    <orderEntry type="library" name="Maven: vonhof:babelshark:1.0-SNAPSHOT" level="project" />
14 13
     <orderEntry type="library" scope="TEST" name="Maven: junit:junit:3.8.1" level="project" />
15 14
     <orderEntry type="module" module-name="webi" />
16 15
     <orderEntry type="library" name="Maven: org.eclipse.jetty:jetty-server:8.1.2.v20120308" level="project" />
1  webi.iml
@@ -11,7 +11,6 @@
11 11
     </content>
12 12
     <orderEntry type="inheritedJdk" />
13 13
     <orderEntry type="sourceFolder" forTests="false" />
14  
-    <orderEntry type="library" name="Maven: vonhof:babelshark:1.0-SNAPSHOT" level="project" />
15 14
     <orderEntry type="library" scope="TEST" name="Maven: junit:junit:3.8.1" level="project" />
16 15
     <orderEntry type="library" name="Maven: org.eclipse.jetty:jetty-server:8.1.2.v20120308" level="project" />
17 16
     <orderEntry type="library" name="Maven: org.eclipse.jetty.orbit:javax.servlet:3.0.0.v201112011016" level="project" />

0 notes on commit def4ba5

Please sign in to comment.
Something went wrong with that request. Please try again.