Author: david.lloyd(a)jboss.com
Date: 2009-04-15 20:26:11 -0400 (Wed, 15 Apr 2009)
New Revision: 5050
Added:
remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/spi/AbstractEndpointConnectionAcceptor.java
remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/spi/EndpointConnectionAcceptor.java
Modified:
remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/Endpoint.java
remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/EndpointImpl.java
Log:
Add a mechanism for an endpoint to receive incoming connections
Modified: remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/Endpoint.java
===================================================================
---
remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/Endpoint.java 2009-04-15
06:12:37 UTC (rev 5049)
+++
remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/Endpoint.java 2009-04-16
00:26:11 UTC (rev 5050)
@@ -9,6 +9,7 @@
import org.jboss.remoting3.spi.RequestHandler;
import org.jboss.remoting3.spi.RequestHandlerSource;
import org.jboss.remoting3.spi.ConnectionProvider;
+import org.jboss.remoting3.spi.EndpointConnectionAcceptor;
import org.jboss.xnio.IoFuture;
/**
@@ -145,7 +146,7 @@
* @param provider the provider
* @return a handle which may be used to remove the registration
*/
- SimpleCloseable addConnectionProvider(String uriScheme, ConnectionProvider<?>
provider);
+ EndpointConnectionAcceptor addConnectionProvider(String uriScheme,
ConnectionProvider<?> provider);
/**
* Get the type of resource specified by the given URI. If the type cannot be
determined, returns {@link org.jboss.remoting3.ResourceType#UNKNOWN UNKNOWN}.
Modified:
remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/EndpointImpl.java
===================================================================
---
remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/EndpointImpl.java 2009-04-15
06:12:37 UTC (rev 5049)
+++
remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/EndpointImpl.java 2009-04-16
00:26:11 UTC (rev 5050)
@@ -48,6 +48,8 @@
import org.jboss.remoting3.spi.RequestHandlerSource;
import org.jboss.remoting3.spi.Cancellable;
import org.jboss.remoting3.spi.EndpointConnection;
+import org.jboss.remoting3.spi.EndpointConnectionAcceptor;
+import org.jboss.remoting3.spi.AbstractEndpointConnectionAcceptor;
import org.jboss.xnio.IoFuture;
import org.jboss.xnio.IoUtils;
import org.jboss.xnio.WeakCloseable;
@@ -382,7 +384,7 @@
return futureEndpointConn;
}
- public SimpleCloseable addConnectionProvider(final String uriScheme, final
ConnectionProvider<?> provider) {
+ public EndpointConnectionAcceptor addConnectionProvider(final String uriScheme, final
ConnectionProvider<?> provider) {
final SecurityManager sm = System.getSecurityManager();
if (sm != null) {
sm.checkPermission(ADD_CONNECTION_PROVIDER_PERM);
@@ -391,10 +393,14 @@
if (connectionProviders.putIfAbsent(key, provider) != null) {
throw new IllegalArgumentException("Provider already registered for
scheme \"" + uriScheme + "\"");
}
- return new AbstractSimpleCloseable(executor) {
+ return new AbstractEndpointConnectionAcceptor(executor) {
protected void closeAction() throws IOException {
connectionProviders.remove(key, provider);
}
+
+ public void accept(final EndpointConnection connection) {
+ // todo - add the endpoint connection to the endpoint registry; notify
listeners; etc.
+ }
};
}
Added:
remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/spi/AbstractEndpointConnectionAcceptor.java
===================================================================
---
remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/spi/AbstractEndpointConnectionAcceptor.java
(rev 0)
+++
remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/spi/AbstractEndpointConnectionAcceptor.java 2009-04-16
00:26:11 UTC (rev 5050)
@@ -0,0 +1,37 @@
+/*
+ * 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.spi;
+
+import java.util.concurrent.Executor;
+
+public abstract class AbstractEndpointConnectionAcceptor extends
AbstractHandleableCloseable<EndpointConnectionAcceptor> implements
EndpointConnectionAcceptor {
+
+ /**
+ * Basic constructor.
+ *
+ * @param executor the executor used to execute the close notification handlers
+ */
+ protected AbstractEndpointConnectionAcceptor(final Executor executor) {
+ super(executor);
+ }
+}
Added:
remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/spi/EndpointConnectionAcceptor.java
===================================================================
---
remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/spi/EndpointConnectionAcceptor.java
(rev 0)
+++
remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/spi/EndpointConnectionAcceptor.java 2009-04-16
00:26:11 UTC (rev 5050)
@@ -0,0 +1,32 @@
+/*
+ * 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.spi;
+
+import org.jboss.remoting3.HandleableCloseable;
+
+/**
+ *
+ */
+public interface EndpointConnectionAcceptor extends
HandleableCloseable<EndpointConnectionAcceptor> {
+ void accept(EndpointConnection connection);
+}