Ticket #1768: SelectorBlockingThread.java.patch

Index: SelectorBlockingThread.java
===================================================================
RCS file: /cvs/glassfish/appserv-http-engine/src/java/com/sun/enterprise/web/connector/grizzly/blocking/SelectorBlockingThread.java,v
retrieving revision 1.10
diff -u -r1.10 SelectorBlockingThread.java
--- SelectorBlockingThread.java	5 May 2007 05:37:07 -0000	1.10
+++ SelectorBlockingThread.java	18 Dec 2008 06:03:52 -0000
@@ -212,7 +212,34 @@
         startListener();
     }    
     
-    
+    /**
+     * Stop a blocking server <code>Socket</code>
+     */
+    public void stopEndpoint() {
+        if (!isRunning()) {
+            return;
+        }
+        
+        setRunning(false);
+        
+        try {
+            try{
+                if ( getServerSocket() != null ) {
+                    getServerSocket().close();
+                }
+            } catch (Throwable t){
+                getLogger().log(Level.SEVERE,
+                        "selectorThread.closeSocketException", t);
+            }
+            
+            unregisterComponents();
+            
+            clearTasks();
+        } catch (Throwable t) {
+            getLogger().log(Level.SEVERE,"selectorThread.stopException", t);
+        }
+    }
+
     protected Socket acceptSocket() {
         if( !isRunning() || getServerSocket()==null ) return null;