[jboss-remoting-commits] JBoss Remoting SVN: r4617 - remoting3/trunk/protocol/multiplex/src/main/java/org/jboss/remoting/protocol/multiplex.

jboss-remoting-commits at lists.jboss.org jboss-remoting-commits at lists.jboss.org
Wed Oct 22 21:44:56 EDT 2008


Author: david.lloyd at jboss.com
Date: 2008-10-22 21:44:56 -0400 (Wed, 22 Oct 2008)
New Revision: 4617

Added:
   remoting3/trunk/protocol/multiplex/src/main/java/org/jboss/remoting/protocol/multiplex/MultiplexConfiguration.java
Removed:
   remoting3/trunk/protocol/multiplex/src/main/java/org/jboss/remoting/protocol/multiplex/RemotingChannelConfiguration.java
Modified:
   remoting3/trunk/protocol/multiplex/src/main/java/org/jboss/remoting/protocol/multiplex/MultiplexHandler.java
   remoting3/trunk/protocol/multiplex/src/main/java/org/jboss/remoting/protocol/multiplex/MultiplexProtocol.java
Log:
Multiplex reorganization

Copied: remoting3/trunk/protocol/multiplex/src/main/java/org/jboss/remoting/protocol/multiplex/MultiplexConfiguration.java (from rev 4614, remoting3/trunk/protocol/multiplex/src/main/java/org/jboss/remoting/protocol/multiplex/RemotingChannelConfiguration.java)
===================================================================
--- remoting3/trunk/protocol/multiplex/src/main/java/org/jboss/remoting/protocol/multiplex/MultiplexConfiguration.java	                        (rev 0)
+++ remoting3/trunk/protocol/multiplex/src/main/java/org/jboss/remoting/protocol/multiplex/MultiplexConfiguration.java	2008-10-23 01:44:56 UTC (rev 4617)
@@ -0,0 +1,83 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.jboss.remoting.protocol.multiplex;
+
+import java.util.concurrent.Executor;
+import java.nio.ByteBuffer;
+import org.jboss.xnio.BufferAllocator;
+import org.jboss.marshalling.MarshallerFactory;
+import org.jboss.marshalling.Configuration;
+
+/**
+ *
+ */
+public final class MultiplexConfiguration {
+    private MarshallerFactory marshallerFactory;
+    private Configuration marshallingConfiguration;
+    private int linkMetric;
+    private Executor executor;
+    private BufferAllocator<ByteBuffer> allocator;
+
+    public MultiplexConfiguration() {
+    }
+
+    public MarshallerFactory getMarshallerFactory() {
+        return marshallerFactory;
+    }
+
+    public void setMarshallerFactory(final MarshallerFactory marshallerFactory) {
+        this.marshallerFactory = marshallerFactory;
+    }
+
+    public Configuration getMarshallingConfiguration() {
+        return marshallingConfiguration;
+    }
+
+    public void setMarshallingConfiguration(final Configuration marshallingConfiguration) {
+        this.marshallingConfiguration = marshallingConfiguration;
+    }
+
+    public int getLinkMetric() {
+        return linkMetric;
+    }
+
+    public void setLinkMetric(final int linkMetric) {
+        this.linkMetric = linkMetric;
+    }
+
+    public Executor getExecutor() {
+        return executor;
+    }
+
+    public void setExecutor(final Executor executor) {
+        this.executor = executor;
+    }
+
+    public BufferAllocator<ByteBuffer> getAllocator() {
+        return allocator;
+    }
+
+    public void setAllocator(final BufferAllocator<ByteBuffer> allocator) {
+        this.allocator = allocator;
+    }
+}

Modified: remoting3/trunk/protocol/multiplex/src/main/java/org/jboss/remoting/protocol/multiplex/MultiplexHandler.java
===================================================================
--- remoting3/trunk/protocol/multiplex/src/main/java/org/jboss/remoting/protocol/multiplex/MultiplexHandler.java	2008-10-23 01:44:01 UTC (rev 4616)
+++ remoting3/trunk/protocol/multiplex/src/main/java/org/jboss/remoting/protocol/multiplex/MultiplexHandler.java	2008-10-23 01:44:56 UTC (rev 4617)
@@ -66,7 +66,7 @@
  *
  * @param <A> stream channel address type (Void if streams are not supported)
  */
-public final class MultiplexHandler<A> implements IoHandler<AllocatedMessageChannel> {
+public final class MultiplexHandler implements IoHandler<AllocatedMessageChannel> {
 
     private static final Logger log = Logger.getLogger(MultiplexHandler.class);
 
@@ -107,7 +107,7 @@
 
     private volatile AllocatedMessageChannel channel;
 
-    public MultiplexHandler(final Endpoint endpoint, final RemotingChannelConfiguration configuration) {
+    public MultiplexHandler(final Endpoint endpoint, final MultiplexConfiguration configuration) {
         this.endpoint = endpoint;
         allocator = configuration.getAllocator();
         executor = configuration.getExecutor();

Modified: remoting3/trunk/protocol/multiplex/src/main/java/org/jboss/remoting/protocol/multiplex/MultiplexProtocol.java
===================================================================
--- remoting3/trunk/protocol/multiplex/src/main/java/org/jboss/remoting/protocol/multiplex/MultiplexProtocol.java	2008-10-23 01:44:01 UTC (rev 4616)
+++ remoting3/trunk/protocol/multiplex/src/main/java/org/jboss/remoting/protocol/multiplex/MultiplexProtocol.java	2008-10-23 01:44:56 UTC (rev 4617)
@@ -32,37 +32,26 @@
 import org.jboss.xnio.IoFuture;
 import org.jboss.xnio.AbstractConvertingIoFuture;
 import org.jboss.xnio.IoHandler;
-import org.jboss.xnio.BufferAllocator;
-import org.jboss.xnio.log.Logger;
 import org.jboss.xnio.channels.AllocatedMessageChannel;
 import java.io.IOException;
-import java.nio.ByteBuffer;
-import java.util.concurrent.Executor;
 
 /**
  *
  */
 public final class MultiplexProtocol {
 
-    private static final Logger log = Logger.getLogger(MultiplexProtocol.class);
-
     private MultiplexProtocol() {
     }
 
     /**
      * Create a request server for the multiplex protocol.
      *
-     * @return a handler factory for passing to an XNIO server @param executor the executor to use for invocations
-     * @param allocator the buffer allocator to use
+     * @return a handler factory for passing to an XNIO server @param executor the executor to use for invocations @param configuration
      */
-    public static <A> IoHandlerFactory<AllocatedMessageChannel> createServer(final Endpoint endpoint, final Executor executor, final BufferAllocator<ByteBuffer> allocator) {
+    public static IoHandlerFactory<AllocatedMessageChannel> createServer(final Endpoint endpoint, final MultiplexConfiguration configuration) {
         return new IoHandlerFactory<AllocatedMessageChannel>() {
             public IoHandler<? super AllocatedMessageChannel> createHandler() {
-                final RemotingChannelConfiguration configuration = new RemotingChannelConfiguration();
-                configuration.setAllocator(allocator);
-                configuration.setExecutor(executor);
-                // todo marshaller factory... etc
-                return new MultiplexHandler<A>(endpoint, configuration);
+                return new MultiplexHandler(endpoint, configuration);
             }
         };
     }
@@ -71,19 +60,14 @@
      * Create a request client for the multiplex protocol.
      *
      * @return a handle which may be used to close the connection
-     * @throws IOException if an error occurs @param executor the executor to use for invocations @param channelSource the XNIO channel source to use to establish the connection
-     * @param allocator the buffer allocator to use
+     * @throws IOException if an error occurs @param executor the executor to use for invocations @param channelSource the XNIO channel source to use to establish the connection @param allocator the buffer allocator to use @param configuration
      */
-    public static <A> IoFuture<SimpleCloseable> connect(final Endpoint endpoint, final Executor executor, final ChannelSource<AllocatedMessageChannel> channelSource, final BufferAllocator<ByteBuffer> allocator) throws IOException {
-        final RemotingChannelConfiguration configuration = new RemotingChannelConfiguration();
-        configuration.setAllocator(allocator);
-        configuration.setExecutor(executor);
-        // todo marshaller factory... etc
-        final MultiplexHandler<A> multiplexHandler = new MultiplexHandler<A>(endpoint, configuration);
+    public static IoFuture<SimpleCloseable> connect(final Endpoint endpoint, final MultiplexConfiguration configuration, final ChannelSource<AllocatedMessageChannel> channelSource) throws IOException {
+        final MultiplexHandler multiplexHandler = new MultiplexHandler(endpoint, configuration);
         final IoFuture<AllocatedMessageChannel> futureChannel = channelSource.open(multiplexHandler);
         return new AbstractConvertingIoFuture<SimpleCloseable, AllocatedMessageChannel>(futureChannel) {
             protected SimpleCloseable convert(final AllocatedMessageChannel channel) throws RemotingException {
-                return new AbstractConnection(executor) {
+                return new AbstractConnection(configuration.getExecutor()) {
                     public Handle<RequestHandlerSource> getServiceForId(final int id) throws IOException {
                         return multiplexHandler.getRemoteService(id).getHandle();
                     }

Deleted: remoting3/trunk/protocol/multiplex/src/main/java/org/jboss/remoting/protocol/multiplex/RemotingChannelConfiguration.java
===================================================================
--- remoting3/trunk/protocol/multiplex/src/main/java/org/jboss/remoting/protocol/multiplex/RemotingChannelConfiguration.java	2008-10-23 01:44:01 UTC (rev 4616)
+++ remoting3/trunk/protocol/multiplex/src/main/java/org/jboss/remoting/protocol/multiplex/RemotingChannelConfiguration.java	2008-10-23 01:44:56 UTC (rev 4617)
@@ -1,83 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2008, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-
-package org.jboss.remoting.protocol.multiplex;
-
-import java.util.concurrent.Executor;
-import java.nio.ByteBuffer;
-import org.jboss.xnio.BufferAllocator;
-import org.jboss.marshalling.MarshallerFactory;
-import org.jboss.marshalling.Configuration;
-
-/**
- *
- */
-public final class RemotingChannelConfiguration {
-    private MarshallerFactory marshallerFactory;
-    private Configuration marshallingConfiguration;
-    private int linkMetric;
-    private Executor executor;
-    private BufferAllocator<ByteBuffer> allocator;
-
-    public RemotingChannelConfiguration() {
-    }
-
-    public MarshallerFactory getMarshallerFactory() {
-        return marshallerFactory;
-    }
-
-    public void setMarshallerFactory(final MarshallerFactory marshallerFactory) {
-        this.marshallerFactory = marshallerFactory;
-    }
-
-    public Configuration getMarshallingConfiguration() {
-        return marshallingConfiguration;
-    }
-
-    public void setMarshallingConfiguration(final Configuration marshallingConfiguration) {
-        this.marshallingConfiguration = marshallingConfiguration;
-    }
-
-    public int getLinkMetric() {
-        return linkMetric;
-    }
-
-    public void setLinkMetric(final int linkMetric) {
-        this.linkMetric = linkMetric;
-    }
-
-    public Executor getExecutor() {
-        return executor;
-    }
-
-    public void setExecutor(final Executor executor) {
-        this.executor = executor;
-    }
-
-    public BufferAllocator<ByteBuffer> getAllocator() {
-        return allocator;
-    }
-
-    public void setAllocator(final BufferAllocator<ByteBuffer> allocator) {
-        this.allocator = allocator;
-    }
-}




More information about the jboss-remoting-commits mailing list