geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jdil...@apache.org
Subject svn commit: r578491 - /geronimo/sandbox/gshell/trunk/gshell-remote/gshell-remote-common/src/main/java/org/apache/geronimo/gshell/remote/request/Requestor.java
Date Sat, 22 Sep 2007 20:38:31 GMT
Author: jdillon
Date: Sat Sep 22 13:38:30 2007
New Revision: 578491

URL: http://svn.apache.org/viewvc?rev=578491&view=rev
Log:
Remove the writer muck, transport now has a getSession() so just use that

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

Modified: geronimo/sandbox/gshell/trunk/gshell-remote/gshell-remote-common/src/main/java/org/apache/geronimo/gshell/remote/request/Requestor.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/Requestor.java?rev=578491&r1=578490&r2=578491&view=diff
==============================================================================
--- geronimo/sandbox/gshell/trunk/gshell-remote/gshell-remote-common/src/main/java/org/apache/geronimo/gshell/remote/request/Requestor.java
(original)
+++ geronimo/sandbox/gshell/trunk/gshell-remote/gshell-remote-common/src/main/java/org/apache/geronimo/gshell/remote/request/Requestor.java
Sat Sep 22 13:38:30 2007
@@ -42,28 +42,24 @@
 
     private final Logger log = LoggerFactory.getLogger(getClass());
     
-    private final MessageWriter writer;
+    private final IoSession session;
 
     private final long timeout;
 
     private final TimeUnit unit;
 
-    private Requestor(final MessageWriter writer, final long timeout, final TimeUnit unit)
{
-        this.writer = writer;
+    private Requestor(final IoSession session, final long timeout, final TimeUnit unit) {
+        this.session = session;
         this.timeout = timeout;
         this.unit = unit;
     }
 
-    public Requestor(final IoSession session, final long timeout, final TimeUnit unit) {
-        this(new SessionMessageWriter(session), timeout, unit);
-    }
-
     public Requestor(final IoSession session) {
         this(session, DEFAULT_TIMEOUT, DEFAULT_TIMEOUT_UNIT);
     }
 
     public Requestor(final Transport transport, final long timeout, final TimeUnit unit)
{
-        this(new TransportMessageWriter(transport), timeout, unit);
+        this(transport.getSession(), timeout, unit);
     }
 
     public Requestor(final Transport transport) {
@@ -75,7 +71,7 @@
 
         Request req = new Request(msg, timeout, unit);
 
-        WriteFuture wf = writer.write(req);
+        WriteFuture wf = session.write(req);
 
         return new RequestWriteFuture(wf, req);
     }
@@ -99,47 +95,7 @@
     public Message request(final Message msg) throws Exception {
         return request(msg, timeout, unit);
     }
-
-    //
-    // MessageWriter
-    //
-
-    /**
-     * An abstraction to allow an {@link IoSession} or {@link Transport} instance to be used
to send messages.
-     */
-    private static interface MessageWriter
-    {
-        WriteFuture write(Object message) throws Exception;
-    }
-
-    private static class SessionMessageWriter
-        implements MessageWriter
-    {
-        private final IoSession session;
-
-        public SessionMessageWriter(final IoSession session) {
-            this.session = session;
-        }
-
-        public WriteFuture write(final Object message) throws Exception {
-            return session.write(message);
-        }
-    }
-
-    private static class TransportMessageWriter
-        implements MessageWriter
-    {
-        private final Transport transport;
-
-        public TransportMessageWriter(final Transport transport) {
-            this.transport = transport;
-        }
-
-        public WriteFuture write(final Object message) throws Exception {
-            return transport.send(message);
-        }
-    }
-
+    
     //
     // RequestWriteFuture
     //



Mime
View raw message