incubator-isis-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From danhayw...@apache.org
Subject svn commit: r1098939 [11/11] - in /incubator/isis/trunk/runtimes/dflt: profilestores/dflt/src/main/java/org/apache/isis/runtimes/dflt/profilestores/dflt/ profilestores/xml/src/main/java/org/apache/isis/runtimes/dflt/profilestores/xml/ profilestores/xml...
Date Tue, 03 May 2011 06:33:49 GMT
Modified: incubator/isis/trunk/runtimes/dflt/remoting/transport-sockets/src/main/java/org/apache/isis/runtimes/dflt/remoting/transport/sockets/shared/Worker.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/runtimes/dflt/remoting/transport-sockets/src/main/java/org/apache/isis/runtimes/dflt/remoting/transport/sockets/shared/Worker.java?rev=1098939&r1=1098938&r2=1098939&view=diff
==============================================================================
--- incubator/isis/trunk/runtimes/dflt/remoting/transport-sockets/src/main/java/org/apache/isis/runtimes/dflt/remoting/transport/sockets/shared/Worker.java
(original)
+++ incubator/isis/trunk/runtimes/dflt/remoting/transport-sockets/src/main/java/org/apache/isis/runtimes/dflt/remoting/transport/sockets/shared/Worker.java
Tue May  3 06:33:43 2011
@@ -17,28 +17,27 @@
  *  under the License.
  */
 
-
 package org.apache.isis.runtimes.dflt.remoting.transport.sockets.shared;
 
 import java.io.IOException;
 import java.net.SocketException;
 
+import org.apache.isis.core.commons.debug.DebugBuilder;
 import org.apache.isis.runtimes.dflt.remoting.server.ServerConnection;
 import org.apache.isis.runtimes.dflt.remoting.transport.ServerConnectionHandler;
-import org.apache.isis.core.commons.debug.DebugBuilder;
 import org.apache.log4j.Logger;
 
 public class Worker implements Runnable {
     private static final Logger LOG = Logger.getLogger(Worker.class);
     private static int nextId = 1;
-    
+
     private final WorkerPool poolToReturnTo;
     private final int id = nextId++;
 
     private boolean running = true;
-    
+
     private ServerConnection connection;
-	private ServerConnectionHandler serverDelegate;
+    private ServerConnectionHandler serverDelegate;
 
     public Worker(final WorkerPool pool) {
         this.poolToReturnTo = pool;
@@ -52,15 +51,16 @@ public class Worker implements Runnable 
         return connection == null;
     }
 
-    ///////////////////////////////////////////////////////
+    // /////////////////////////////////////////////////////
     // run, setIncomingConnection, wait
-    ///////////////////////////////////////////////////////
+    // /////////////////////////////////////////////////////
 
+    @Override
     public synchronized void run() {
         while (running) {
-        	waitForIncomingConnection();
+            waitForIncomingConnection();
             if (connection == null) {
-            	break;
+                break;
             }
 
             handleRequest();
@@ -80,60 +80,55 @@ public class Worker implements Runnable 
     /**
      * @see #setIncomingConnection(ServerConnection)
      */
-	private void waitForIncomingConnection() {
-		while (connection == null) {
-		    try {
-		        wait();
-		    } catch (final InterruptedException e) {
-		        if (!running) {
-		            LOG.info("Request to stop : " + toString());
-		            break;
-		        }
-		    }
-		}
-	}
-
+    private void waitForIncomingConnection() {
+        while (connection == null) {
+            try {
+                wait();
+            } catch (final InterruptedException e) {
+                if (!running) {
+                    LOG.info("Request to stop : " + toString());
+                    break;
+                }
+            }
+        }
+    }
 
-    ///////////////////////////////////////////////////////
+    // /////////////////////////////////////////////////////
     // handleRequest
-    ///////////////////////////////////////////////////////
+    // /////////////////////////////////////////////////////
 
-	private void handleRequest() {
-		try {
-			serverDelegate.handleRequest();
-		} catch (final SocketException e) {
-		    LOG.info("shutting down receiver (" + e + ")");
-		} catch (final IOException e) {
-		    LOG.info("connection exception; closing connection", e);
-		} finally {
-		    end();
-		}
-	}
+    private void handleRequest() {
+        try {
+            serverDelegate.handleRequest();
+        } catch (final SocketException e) {
+            LOG.info("shutting down receiver (" + e + ")");
+        } catch (final IOException e) {
+            LOG.info("connection exception; closing connection", e);
+        } finally {
+            end();
+        }
+    }
 
     private void end() {
-    	serverDelegate = null;
+        serverDelegate = null;
         connection = null;
         poolToReturnTo.returnWorker(this);
     }
 
-    
-    
-    ///////////////////////////////////////////////////////
+    // /////////////////////////////////////////////////////
     // Debug
-    ///////////////////////////////////////////////////////
-    
+    // /////////////////////////////////////////////////////
+
     public void debug(final DebugBuilder debug) {
-    	serverDelegate.debug(debug);
+        serverDelegate.debug(debug);
     }
 
-    
-    ///////////////////////////////////////////////////////
+    // /////////////////////////////////////////////////////
     // toString
-    ///////////////////////////////////////////////////////
+    // /////////////////////////////////////////////////////
 
     @Override
     public String toString() {
         return "Worker#" + id;
     }
 }
-

Modified: incubator/isis/trunk/runtimes/dflt/remoting/transport-sockets/src/main/java/org/apache/isis/runtimes/dflt/remoting/transport/sockets/shared/WorkerPool.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/runtimes/dflt/remoting/transport-sockets/src/main/java/org/apache/isis/runtimes/dflt/remoting/transport/sockets/shared/WorkerPool.java?rev=1098939&r1=1098938&r2=1098939&view=diff
==============================================================================
--- incubator/isis/trunk/runtimes/dflt/remoting/transport-sockets/src/main/java/org/apache/isis/runtimes/dflt/remoting/transport/sockets/shared/WorkerPool.java
(original)
+++ incubator/isis/trunk/runtimes/dflt/remoting/transport-sockets/src/main/java/org/apache/isis/runtimes/dflt/remoting/transport/sockets/shared/WorkerPool.java
Tue May  3 06:33:43 2011
@@ -17,7 +17,6 @@
  *  under the License.
  */
 
-
 package org.apache.isis.runtimes.dflt.remoting.transport.sockets.shared;
 
 import java.lang.reflect.InvocationTargetException;
@@ -29,13 +28,12 @@ import org.apache.isis.core.commons.debu
 import org.apache.isis.core.commons.exceptions.IsisException;
 import org.apache.log4j.Logger;
 
-
 // REVIEW should this class be replaced with something from concurrent.util ? 
 public class WorkerPool {
     private static final Logger LOG = Logger.getLogger(WorkerPool.class);
-    
+
     private final ThreadGroup group;
-    
+
     public Vector available = new Vector();
     public Vector all = new Vector();
 
@@ -87,7 +85,8 @@ public class WorkerPool {
         while (available.size() == 0) {
             try {
                 wait();
-            } catch (final InterruptedException e) {}
+            } catch (final InterruptedException e) {
+            }
         }
         final Worker worker = (Worker) available.elementAt(0);
         available.removeElementAt(0);
@@ -125,4 +124,3 @@ public class WorkerPool {
         return "WorkerGroup[groupName=" + group.getName() + "]";
     }
 }
-



Mime
View raw message