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

jboss-remoting-commits at lists.jboss.org jboss-remoting-commits at lists.jboss.org
Wed Sep 16 17:31:52 EDT 2009


Author: david.lloyd at jboss.com
Date: 2009-09-16 17:31:51 -0400 (Wed, 16 Sep 2009)
New Revision: 5508

Added:
   remoting3-multiplex/trunk/src/main/java/org/jboss/remoting3/multiplex/MarshallingProtocol.java
   remoting3-multiplex/trunk/src/main/java/org/jboss/remoting3/multiplex/MultiplexConnectionHandlerFactory.java
   remoting3-multiplex/trunk/src/main/java/org/jboss/remoting3/multiplex/MultiplexConnectionProviderFactory.java
   remoting3-multiplex/trunk/src/main/java/org/jboss/remoting3/multiplex/MultiplexServerFactory.java
Removed:
   remoting3-multiplex/trunk/src/main/java/org/jboss/remoting3/multiplex/AtomicArrayReferenceArray.java
Modified:
   remoting3-multiplex/trunk/src/main/java/org/jboss/remoting3/multiplex/ConnectionConfiguration.java
   remoting3-multiplex/trunk/src/main/java/org/jboss/remoting3/multiplex/EstablishedConnection.java
   remoting3-multiplex/trunk/src/main/java/org/jboss/remoting3/multiplex/MultiplexConnectionProvider.java
   remoting3-multiplex/trunk/src/main/java/org/jboss/remoting3/multiplex/MultiplexRequestHandler.java
   remoting3-multiplex/trunk/src/main/java/org/jboss/remoting3/multiplex/PermitManager.java
Log:
Point commit

Deleted: remoting3-multiplex/trunk/src/main/java/org/jboss/remoting3/multiplex/AtomicArrayReferenceArray.java
===================================================================
--- remoting3-multiplex/trunk/src/main/java/org/jboss/remoting3/multiplex/AtomicArrayReferenceArray.java	2009-09-16 21:31:30 UTC (rev 5507)
+++ remoting3-multiplex/trunk/src/main/java/org/jboss/remoting3/multiplex/AtomicArrayReferenceArray.java	2009-09-16 21:31:51 UTC (rev 5508)
@@ -1,170 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2009, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file 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.remoting3.multiplex;
-
-import java.lang.reflect.Array;
-import java.util.concurrent.atomic.AtomicReferenceArray;
-
-final class AtomicArrayReferenceArray<V> extends AtomicReferenceArray<V[]> {
-
-    private final V[] emptyArray;
-    private final Class<V> componentType;
-
-    private static final long serialVersionUID = -4748109403436000080L;
-
-    private AtomicArrayReferenceArray(Class<V> componentType, int length) {
-        super(length);
-        this.componentType = componentType;
-        emptyArray = newInstance(componentType, 0);
-    }
-
-    public static <V> AtomicArrayReferenceArray<V> create(AtomicReferenceArray<V[]> array, Class<V> componentType) {
-        return new AtomicArrayReferenceArray<V>(array, componentType);
-    }
-
-    @SuppressWarnings({ "unchecked" })
-    private static <V> V[] copyOf(final Class<V> componentType, V[] old, int newLen) {
-        final V[] target = newInstance(componentType, newLen);
-        System.arraycopy(old, 0, target, 0, Math.min(old.length, newLen));
-        return target;
-    }
-
-    public void add(int idx, V value) {
-        for (;;) {
-            final V[] oldVal = get(idx);
-            final int oldLen = oldVal.length;
-            final V[] newVal = copyOf(componentType, oldVal, oldLen + 1);
-            newVal[oldLen] = value;
-            if (compareAndSet(idx, oldVal, newVal)) {
-                return;
-            }
-        }
-    }
-
-    public boolean addIfAbsent(int idx, V value, boolean identity) {
-        for (;;) {
-            final V[] oldVal = get(idx);
-            final int oldLen = oldVal.length;
-            if (identity || value == null) {
-                for (int i = 0; i < oldLen; i++) {
-                    if (oldVal[i] == value) {
-                        return false;
-                    }
-                }
-            } else {
-                for (int i = 0; i < oldLen; i++) {
-                    if (value.equals(oldVal[i])) {
-                        return false;
-                    }
-                }
-            }
-            final V[] newVal = copyOf(componentType, oldVal, oldLen + 1);
-            newVal[oldLen] = value;
-            if (compareAndSet(idx, oldVal, newVal)) {
-                return true;
-            }
-        }
-    }
-
-    public boolean remove(int idx, V value, boolean identity) {
-        for (;;) {
-            final V[] oldVal = get(idx);
-            final int oldLen = oldVal.length;
-            if (oldLen == 0) {
-                return false;
-            } else {
-                int index = -1;
-                if (identity || value == null) {
-                    for (int i = 0; i < oldLen; i++) {
-                        if (oldVal[i] == value) {
-                            index = i;
-                            break;
-                        }
-                    }
-                } else {
-                    for (int i = 0; i < oldLen; i++) {
-                        if (value.equals(oldVal[i])) {
-                            index = i;
-                            break;
-                        }
-                    }
-                }
-                if (index == -1) {
-                    return false;
-                }
-                final V[] newVal = newInstance(componentType, oldLen - 1);
-                System.arraycopy(oldVal, 0, newVal, 0, index);
-                System.arraycopy(oldVal, index + 1, newVal, index, oldLen - index - 1);
-                if (compareAndSet(idx, oldVal, newVal)) {
-                    return true;
-                }
-            }
-        }
-    }
-
-    public int removeAll(int idx, V value, boolean identity) {
-        for (;;) {
-            final V[] oldVal = get(idx);
-            final int oldLen = oldVal.length;
-            if (oldLen == 0) {
-                return 0;
-            } else {
-                final boolean[] removeSlots = new boolean[oldLen];
-                int removeCount = 0;
-                if (identity || value == null) {
-                    for (int i = 0; i < oldLen; i++) {
-                        if (oldVal[i] == value) {
-                            removeSlots[i] = true;
-                            removeCount++;
-                        }
-                    }
-                } else {
-                    for (int i = 0; i < oldLen; i++) {
-                        if (value.equals(oldVal[i])) {
-                            removeSlots[i] = true;
-                            removeCount++;
-                        }
-                    }
-                }
-                if (removeCount == 0) {
-                    return 0;
-                }
-                final int newLen = oldLen - removeCount;
-                final V[] newVal;
-                if (newLen == 0) {
-                    newVal = emptyArray;
-                } else {
-                    newVal = newInstance(componentType, newLen);
-                    for (int i = 0, j = 0; i < oldLen; i ++) {
-                        if (! removeSlots[i]) {
-                            newVal[j++] = oldVal[i];
-                        }
-                    }
-                }
-                if (compareAndSet(idx, oldVal, newVal)) {
-                    return removeCount;
-                }
-            }
-        }
-    }
-}

Modified: remoting3-multiplex/trunk/src/main/java/org/jboss/remoting3/multiplex/ConnectionConfiguration.java
===================================================================
--- remoting3-multiplex/trunk/src/main/java/org/jboss/remoting3/multiplex/ConnectionConfiguration.java	2009-09-16 21:31:30 UTC (rev 5507)
+++ remoting3-multiplex/trunk/src/main/java/org/jboss/remoting3/multiplex/ConnectionConfiguration.java	2009-09-16 21:31:51 UTC (rev 5508)
@@ -25,7 +25,7 @@
 /**
  * A configuration object for the multiplex protocol.
  */
-public final class ConnectionConfiguration implements Cloneable {
+final class ConnectionConfiguration implements Cloneable {
 
     private int linkMetric = 100;
     private int maximumReceiveSize = 0x200;

Modified: remoting3-multiplex/trunk/src/main/java/org/jboss/remoting3/multiplex/EstablishedConnection.java
===================================================================
--- remoting3-multiplex/trunk/src/main/java/org/jboss/remoting3/multiplex/EstablishedConnection.java	2009-09-16 21:31:30 UTC (rev 5507)
+++ remoting3-multiplex/trunk/src/main/java/org/jboss/remoting3/multiplex/EstablishedConnection.java	2009-09-16 21:31:51 UTC (rev 5508)
@@ -27,8 +27,13 @@
 import java.util.concurrent.Executor;
 import java.util.concurrent.atomic.AtomicReferenceArray;
 import java.util.Iterator;
-import org.jboss.marshalling.Marshaller;
-import org.jboss.marshalling.Unmarshaller;
+import java.util.List;
+import org.jboss.marshalling.ClassTable;
+import org.jboss.marshalling.ObjectTable;
+import org.jboss.marshalling.ClassResolver;
+import org.jboss.marshalling.ObjectResolver;
+import org.jboss.marshalling.ClassExternalizerFactory;
+import org.jboss.marshalling.util.IntMap;
 import org.jboss.remoting3.IndeterminateOutcomeException;
 import org.jboss.remoting3.spi.AbstractHandleableCloseable;
 import org.jboss.remoting3.spi.Cancellable;
@@ -41,7 +46,6 @@
 import org.jboss.remoting3.spi.SpiUtils;
 import org.jboss.xnio.BufferAllocator;
 import org.jboss.xnio.Buffers;
-import org.jboss.xnio.Pool;
 import org.jboss.xnio.IoFuture;
 import org.jboss.xnio.IoUtils;
 import org.jboss.xnio.channels.AllocatedMessageChannel;
@@ -54,12 +58,33 @@
     private static final Logger log = Loggers.MAIN_LOGGER;
 
     //--== Connection configuration items ==--
-    private final Pool<Marshaller> marshallerPool;
-    private final Pool<Unmarshaller> unmarshallerPool;
-    private final int linkMetric;
     private final Executor executor;
     // buffer allocator for outbound message assembly
     private final BufferAllocator<ByteBuffer> allocator;
+    // remotely available marshalling protocol index
+    private final IntMap<String> remoteMarshallingProtocols;
+    // locally available marshalling protocol index
+    private final List<MarshallingProtocol> localMarshallingProtocols;
+    // remotely available class table index
+    private final IntMap<String> remoteClassTables;
+    // locally available class table index
+    private final List<ClassTable> localClassTables;
+    // remotely available object table index
+    private final IntMap<String> remoteObjectTables;
+    // locally available object table index
+    private final List<ObjectTable> localObjectTables;
+    // Remotely available class resolvers
+    private final IntMap<String> remoteClassResolvers;
+    // locally available class resolvers
+    private final List<ClassResolver> localClassResolvers;
+    // remotely available object resolvers
+    private final IntMap<String> remoteObjectResolvers;
+    // locally available object resolvers
+    private final List<ObjectResolver> localObjectResolvers;
+    // remotely available externalizer factories
+    private final IntMap<String> remoteExternalizerFactories;
+    // locally available externalizer factories
+    private final List<ClassExternalizerFactory> localExternalizerFactories;
 
     // running on remote node
     private final AtomicReferenceArray<ReplyHandler> remoteRequests;
@@ -85,21 +110,19 @@
     // the local connection handler
     private final ConnectionHandler localConnectionHandler;
 
-    private final int sendWindowSize;
+    private final int transmitWindowSize;
+    private final int receiveWindowSize;
 
+    private final int linkMetric;
+
     private static final ThreadLocal<EstablishedConnection> currentConnection = new ThreadLocal<EstablishedConnection>();
 
-    public EstablishedConnection(final AllocatedMessageChannel channel, final ConnectionConfiguration configuration, final ConnectionHandler localConnectionHandler) {
-        super(configuration.getExecutor());
+    public EstablishedConnection(final AllocatedMessageChannel channel, final Executor executor, final ConnectionConfiguration configuration, final ConnectionHandler localConnectionHandler) {
+        super(executor);
         this.channel = channel;
         linkMetric = configuration.getLinkMetric();
-        executor = configuration.getExecutor();
-        if (executor == null) {
-            throw new NullPointerException("executor is null");
-        }
+        this.executor = executor;
         allocator = Buffers.createHeapByteBufferAllocator(configuration.getMaximumTransmitSize());
-        marshallerPool = configuration.getMarshallerPool();
-        unmarshallerPool = configuration.getUnmarshallerPool();
         final int maximumInboundRequests = configuration.getMaximumInboundRequests();
         remoteRequests = new AtomicReferenceArray<ReplyHandler>(maximumInboundRequests);
         requestPermits = new PermitManager(maximumInboundRequests);
@@ -111,7 +134,8 @@
         final int maximumInboundClients = configuration.getMaximumInboundClients();
         requestedClients = new AtomicReferenceArray<RequestHandler>(maximumInboundClients);
         forwardedClientPermits = new PermitManager(maximumInboundClients);
-        sendWindowSize = configuration.getTransmitWindowSize();
+        transmitWindowSize = configuration.getTransmitWindowSize();
+        receiveWindowSize = configuration.getReceiveWindowSize();
         this.localConnectionHandler = localConnectionHandler;
     }
 
@@ -151,14 +175,6 @@
         return channel;
     }
 
-    Pool<Marshaller> getMarshallerPool() {
-        return marshallerPool;
-    }
-
-    Pool<Unmarshaller> getUnmarshallerPool() {
-        return unmarshallerPool;
-    }
-
     ConnectionHandler getLocalConnectionHandler() {
         return localConnectionHandler;
     }
@@ -210,10 +226,14 @@
         return null;
     }
 
-    int getSendWindowSize() {
-        return sendWindowSize;
+    int getTransmitWindowSize() {
+        return transmitWindowSize;
     }
 
+    int getReceiveWindowSize() {
+        return receiveWindowSize;
+    }
+
     private static <T> Iterable<T> clearing(final AtomicReferenceArray<T> array) {
         return new Iterable<T>() {
 

Added: remoting3-multiplex/trunk/src/main/java/org/jboss/remoting3/multiplex/MarshallingProtocol.java
===================================================================
--- remoting3-multiplex/trunk/src/main/java/org/jboss/remoting3/multiplex/MarshallingProtocol.java	                        (rev 0)
+++ remoting3-multiplex/trunk/src/main/java/org/jboss/remoting3/multiplex/MarshallingProtocol.java	2009-09-16 21:31:51 UTC (rev 5508)
@@ -0,0 +1,46 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2009, 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.remoting3.multiplex;
+
+import org.jboss.marshalling.MarshallerFactory;
+
+/**
+ * A registered marshalling protocol, which consists of the combination of a factory and the version.
+ */
+final class MarshallingProtocol {
+    private final MarshallerFactory marshallerFactory;
+    private final int configuredVersion;
+
+    MarshallingProtocol(final MarshallerFactory marshallerFactory, final int configuredVersion) {
+        this.marshallerFactory = marshallerFactory;
+        this.configuredVersion = configuredVersion;
+    }
+
+    public MarshallerFactory getMarshallerFactory() {
+        return marshallerFactory;
+    }
+
+    public int getConfiguredVersion() {
+        return configuredVersion;
+    }
+}

Added: remoting3-multiplex/trunk/src/main/java/org/jboss/remoting3/multiplex/MultiplexConnectionHandlerFactory.java
===================================================================
--- remoting3-multiplex/trunk/src/main/java/org/jboss/remoting3/multiplex/MultiplexConnectionHandlerFactory.java	                        (rev 0)
+++ remoting3-multiplex/trunk/src/main/java/org/jboss/remoting3/multiplex/MultiplexConnectionHandlerFactory.java	2009-09-16 21:31:51 UTC (rev 5508)
@@ -0,0 +1,33 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2009, 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.remoting3.multiplex;
+
+import org.jboss.remoting3.spi.ConnectionHandlerFactory;
+import org.jboss.remoting3.spi.ConnectionHandler;
+
+final class MultiplexConnectionHandlerFactory implements ConnectionHandlerFactory {
+
+    public ConnectionHandler createInstance(final ConnectionHandler localConnectionHandler) {
+        return new MultiplexConnectionHandler(localConnectionHandler);
+    }
+}

Modified: remoting3-multiplex/trunk/src/main/java/org/jboss/remoting3/multiplex/MultiplexConnectionProvider.java
===================================================================
--- remoting3-multiplex/trunk/src/main/java/org/jboss/remoting3/multiplex/MultiplexConnectionProvider.java	2009-09-16 21:31:30 UTC (rev 5507)
+++ remoting3-multiplex/trunk/src/main/java/org/jboss/remoting3/multiplex/MultiplexConnectionProvider.java	2009-09-16 21:31:51 UTC (rev 5508)
@@ -27,21 +27,32 @@
 import org.jboss.remoting3.spi.ConnectionHandlerFactory;
 import org.jboss.remoting3.spi.Result;
 import org.jboss.remoting3.spi.SpiUtils;
+import org.jboss.remoting3.spi.ConnectionProviderContext;
 import org.jboss.remoting3.OptionMap;
-import org.jboss.xnio.TcpConnector;
 import org.jboss.xnio.FutureConnection;
 import org.jboss.xnio.IoFuture;
-import org.jboss.xnio.channels.TcpChannel;
+import org.jboss.xnio.IoHandlerFactory;
+import org.jboss.xnio.Connector;
+import org.jboss.xnio.channels.AllocatedMessageChannel;
 import java.net.URI;
 import java.net.InetSocketAddress;
 import java.io.IOException;
 
-public final class MultiplexConnectionProvider implements ConnectionProvider {
+final class MultiplexConnectionProvider implements ConnectionProvider<MultiplexServerFactory> {
 
-    private final TcpConnector tcpConnector;
+    private final Connector<InetSocketAddress, AllocatedMessageChannel> connector;
+    private final ConnectionProviderContext context;
+    private final IoHandlerFactory<AllocatedMessageChannel> handlerFactory;
+    private final MultiplexServerFactory providerInterface = new MultiplexServerFactory() {
+        public IoHandlerFactory<AllocatedMessageChannel> getHandlerFactory() {
+            return handlerFactory;
+        }
+    };
 
-    public MultiplexConnectionProvider(final TcpConnector tcpConnector) {
-        this.tcpConnector = tcpConnector;
+    public MultiplexConnectionProvider(final Connector<InetSocketAddress, AllocatedMessageChannel> connector, final ConnectionProviderContext context) {
+        this.connector = connector;
+        this.context = context;
+        handlerFactory = null;
     }
 
     public Cancellable connect(final URI uri, final OptionMap connectOptions, final Result<ConnectionHandlerFactory> result) throws IllegalArgumentException {
@@ -51,14 +62,14 @@
             throw new IllegalArgumentException("A valid port number must be explicitly specified");
         }
         // TODO - change this to use async DNS via XNIO DNS
-        final FutureConnection<InetSocketAddress,TcpChannel> connection = tcpConnector.connectTo(new InetSocketAddress(host, port), null);
-        connection.addNotifier(new IoFuture.HandlingNotifier<TcpChannel, Result<ConnectionHandlerFactory>>() {
+        final FutureConnection<InetSocketAddress, AllocatedMessageChannel> connection = connector.connectTo(new InetSocketAddress(host, port), null);
+        connection.addNotifier(new IoFuture.HandlingNotifier<AllocatedMessageChannel, Result<ConnectionHandlerFactory>>() {
             public void handleFailed(final IOException exception, final Result<ConnectionHandlerFactory> attachment) {
                 attachment.setException(exception);
             }
 
-            public void handleDone(final TcpChannel result, final Result<ConnectionHandlerFactory> attachment) {
-                attachment.setResult(null);
+            public void handleDone(final AllocatedMessageChannel result, final Result<ConnectionHandlerFactory> attachment) {
+                attachment.setResult(new MultiplexConnectionHandlerFactory());
             }
 
             public void handleCancelled(final Result<ConnectionHandlerFactory> attachment) {
@@ -67,4 +78,23 @@
         }, result);
         return SpiUtils.cancellable(connection);
     }
+
+    /**
+     * Get the server factory.
+     *
+     * @return the server factory
+     */
+    public MultiplexServerFactory getProviderInterface() {
+        return providerInterface;
+    }
+
+    /**
+     * Get the server handler for this connection provider.
+     *
+     * @return the server handler factory
+     */
+    public IoHandlerFactory<AllocatedMessageChannel> getHandlerFactory() {
+        // todo - should this be secured somehow?
+        return handlerFactory;
+    }
 }

Added: remoting3-multiplex/trunk/src/main/java/org/jboss/remoting3/multiplex/MultiplexConnectionProviderFactory.java
===================================================================
--- remoting3-multiplex/trunk/src/main/java/org/jboss/remoting3/multiplex/MultiplexConnectionProviderFactory.java	                        (rev 0)
+++ remoting3-multiplex/trunk/src/main/java/org/jboss/remoting3/multiplex/MultiplexConnectionProviderFactory.java	2009-09-16 21:31:51 UTC (rev 5508)
@@ -0,0 +1,42 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2009, 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.remoting3.multiplex;
+
+import org.jboss.remoting3.spi.ConnectionProviderFactory;
+import org.jboss.remoting3.spi.ConnectionProvider;
+import org.jboss.remoting3.spi.ConnectionProviderContext;
+import org.jboss.xnio.Connector;
+import org.jboss.xnio.channels.AllocatedMessageChannel;
+import java.net.InetSocketAddress;
+
+public final class MultiplexConnectionProviderFactory implements ConnectionProviderFactory<MultiplexServerFactory> {
+    private final Connector<InetSocketAddress, AllocatedMessageChannel> connector;
+
+    public MultiplexConnectionProviderFactory(final Connector<InetSocketAddress, AllocatedMessageChannel> connector) {
+        this.connector = connector;
+    }
+
+    public ConnectionProvider<MultiplexServerFactory> createInstance(final ConnectionProviderContext context) {
+        return new MultiplexConnectionProvider(connector, context);
+    }
+}

Modified: remoting3-multiplex/trunk/src/main/java/org/jboss/remoting3/multiplex/MultiplexRequestHandler.java
===================================================================
--- remoting3-multiplex/trunk/src/main/java/org/jboss/remoting3/multiplex/MultiplexRequestHandler.java	2009-09-16 21:31:30 UTC (rev 5507)
+++ remoting3-multiplex/trunk/src/main/java/org/jboss/remoting3/multiplex/MultiplexRequestHandler.java	2009-09-16 21:31:51 UTC (rev 5508)
@@ -71,7 +71,7 @@
         connection.setCurrent();
         try {
             final Marshaller marshaller = marshallerPool.allocate();
-            final ByteOutput output = new SendingByteOutput(null, allocator, connection.getSendWindowSize());
+            final ByteOutput output = new SendingByteOutput(null, allocator, connection.getTransmitWindowSize());
             boolean ok = false;
             try {
                 marshaller.start(output);

Added: remoting3-multiplex/trunk/src/main/java/org/jboss/remoting3/multiplex/MultiplexServerFactory.java
===================================================================
--- remoting3-multiplex/trunk/src/main/java/org/jboss/remoting3/multiplex/MultiplexServerFactory.java	                        (rev 0)
+++ remoting3-multiplex/trunk/src/main/java/org/jboss/remoting3/multiplex/MultiplexServerFactory.java	2009-09-16 21:31:51 UTC (rev 5508)
@@ -0,0 +1,40 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2009, 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.remoting3.multiplex;
+
+import org.jboss.xnio.channels.AllocatedMessageChannel;
+import org.jboss.xnio.IoHandlerFactory;
+
+/**
+ * The server factory for a multiplex connection provider.  Use this to create servers which connect to the
+ * corresponding endpoint.
+ */
+public interface MultiplexServerFactory {
+
+    /**
+     * Get the I/O handler factory for this server factory.
+     *
+     * @return the I/O handler factory
+     */
+    IoHandlerFactory<AllocatedMessageChannel> getHandlerFactory();
+}

Modified: remoting3-multiplex/trunk/src/main/java/org/jboss/remoting3/multiplex/PermitManager.java
===================================================================
--- remoting3-multiplex/trunk/src/main/java/org/jboss/remoting3/multiplex/PermitManager.java	2009-09-16 21:31:30 UTC (rev 5507)
+++ remoting3-multiplex/trunk/src/main/java/org/jboss/remoting3/multiplex/PermitManager.java	2009-09-16 21:31:51 UTC (rev 5508)
@@ -24,7 +24,7 @@
 
 import java.util.concurrent.atomic.AtomicIntegerFieldUpdater;
 
-public final class PermitManager {
+final class PermitManager {
 
     private final Object lock = new Object();
     private final int maxPermits;



More information about the jboss-remoting-commits mailing list