You are viewing a plain text version of this content. The canonical link for it is here.
Posted to scm@geronimo.apache.org by jd...@apache.org on 2007/09/22 10:21:31 UTC

svn commit: r578391 - in /geronimo/sandbox/gshell/trunk/gshell-remote/gshell-remote-common/src/main/java/org/apache/geronimo/gshell/remote/request: Request.java RequestManager.java RequestTimeoutException.java

Author: jdillon
Date: Sat Sep 22 01:21:30 2007
New Revision: 578391

URL: http://svn.apache.org/viewvc?rev=578391&view=rev
Log:
Tidy up some of the request time out bits

Modified:
    geronimo/sandbox/gshell/trunk/gshell-remote/gshell-remote-common/src/main/java/org/apache/geronimo/gshell/remote/request/Request.java
    geronimo/sandbox/gshell/trunk/gshell-remote/gshell-remote-common/src/main/java/org/apache/geronimo/gshell/remote/request/RequestManager.java
    geronimo/sandbox/gshell/trunk/gshell-remote/gshell-remote-common/src/main/java/org/apache/geronimo/gshell/remote/request/RequestTimeoutException.java

Modified: geronimo/sandbox/gshell/trunk/gshell-remote/gshell-remote-common/src/main/java/org/apache/geronimo/gshell/remote/request/Request.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/gshell/trunk/gshell-remote/gshell-remote-common/src/main/java/org/apache/geronimo/gshell/remote/request/Request.java?rev=578391&r1=578390&r2=578391&view=diff
==============================================================================
--- geronimo/sandbox/gshell/trunk/gshell-remote/gshell-remote-common/src/main/java/org/apache/geronimo/gshell/remote/request/Request.java (original)
+++ geronimo/sandbox/gshell/trunk/gshell-remote/gshell-remote-common/src/main/java/org/apache/geronimo/gshell/remote/request/Request.java Sat Sep 22 01:21:30 2007
@@ -153,9 +153,8 @@
         else if (obj == null) {
             return null;
         }
-        else if (obj instanceof RequestTimeoutException) {
-            // Throw a timeout exception preserving the client call stack
-            throw new RequestTimeoutException((RequestTimeoutException) obj);
+        else if (obj == RequestTimeoutException.class) {
+            throw new RequestTimeoutException(this);
         }
 
         // This should never happen
@@ -172,7 +171,7 @@
         return mutex;
     }
 
-    private void setResponse(final Object answer) {
+    private void queueResponse(final Object answer) {
         signaled = true;
 
         responses.add(answer);
@@ -189,7 +188,7 @@
                 log.debug("Signal response: {}", response.getRequest().getId());
             }
 
-            setResponse(response);
+            queueResponse(response);
 
             if (response.getType() != Response.Type.PARTIAL) {
                 endOfResponses = true;
@@ -197,18 +196,11 @@
         }
     }
 
-    void signal(final RequestTimeoutException e) {
-        assert e != null;
-
+    void timeout() {
         synchronized (mutex) {
-            if (log.isTraceEnabled()) {
-                log.debug("Signal timeout: " + e, e);
-            }
-            else {
-                log.debug("Signal timeout: {}", e.getId());
-            }
+            log.debug("Timeout");
 
-            setResponse(e);
+            queueResponse(RequestTimeoutException.class);
 
             endOfResponses = true;
         }

Modified: geronimo/sandbox/gshell/trunk/gshell-remote/gshell-remote-common/src/main/java/org/apache/geronimo/gshell/remote/request/RequestManager.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/gshell/trunk/gshell-remote/gshell-remote-common/src/main/java/org/apache/geronimo/gshell/remote/request/RequestManager.java?rev=578391&r1=578390&r2=578391&view=diff
==============================================================================
--- geronimo/sandbox/gshell/trunk/gshell-remote/gshell-remote-common/src/main/java/org/apache/geronimo/gshell/remote/request/RequestManager.java (original)
+++ geronimo/sandbox/gshell/trunk/gshell-remote/gshell-remote-common/src/main/java/org/apache/geronimo/gshell/remote/request/RequestManager.java Sat Sep 22 01:21:30 2007
@@ -203,8 +203,7 @@
 
         // If the request has not been signaled, then its a timeout :-(
         if (!request.isSignaled()) {
-            // noinspection ThrowableInstanceNeverThrown
-            request.signal(new RequestTimeoutException(request));
+            request.timeout();
         }
     }
 

Modified: geronimo/sandbox/gshell/trunk/gshell-remote/gshell-remote-common/src/main/java/org/apache/geronimo/gshell/remote/request/RequestTimeoutException.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/gshell/trunk/gshell-remote/gshell-remote-common/src/main/java/org/apache/geronimo/gshell/remote/request/RequestTimeoutException.java?rev=578391&r1=578390&r2=578391&view=diff
==============================================================================
--- geronimo/sandbox/gshell/trunk/gshell-remote/gshell-remote-common/src/main/java/org/apache/geronimo/gshell/remote/request/RequestTimeoutException.java (original)
+++ geronimo/sandbox/gshell/trunk/gshell-remote/gshell-remote-common/src/main/java/org/apache/geronimo/gshell/remote/request/RequestTimeoutException.java Sat Sep 22 01:21:30 2007
@@ -37,12 +37,6 @@
         this.id = request.getId();
     }
 
-    public RequestTimeoutException(final RequestTimeoutException cause) {
-        super("Request timed out: " + cause.getId());
-
-        this.id = cause.getId();
-    }
-
     public Object getId() {
         return id;
     }