Author: david.lloyd(a)jboss.com
Date: 2009-11-04 18:31:39 -0500 (Wed, 04 Nov 2009)
New Revision: 5584
Modified:
remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/EndpointImpl.java
remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/spi/ConnectionHandlerContext.java
remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/spi/ConnectionProviderContext.java
remoting3/trunk/taglet/pom.xml
Log:
Minor cleanup
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-11-04
23:19:07 UTC (rev 5583)
+++
remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/EndpointImpl.java 2009-11-04
23:31:39 UTC (rev 5584)
@@ -114,11 +114,14 @@
private final ConcurrentMap<Registration, ServiceRegistrationListener>
serviceListenerRegistrations = concurrentIdentityMap(serviceRegistrationLock);
private final ConcurrentMap<String, ConcurrentMap<String,
ServiceRegistration>> registeredLocalServices =
concurrentMap(serviceRegistrationLock);
-
private final ConcurrentMap<String, ConnectionProvider<?>>
connectionProviders = concurrentMap();
-
private final ConcurrentMap[] providerMaps = new
ConcurrentMap[ProtocolServiceType.getServiceTypes().length];
+ private final ConnectionProviderContext connectionProviderContext;
+ private final ConnectionHandler loopbackConnectionHandler;
+ private final Connection loopbackConnection;
+ private final ConnectionHandlerContext localConnectionContext;
+
private static final EndpointPermission CREATE_ENDPOINT_PERM = new
EndpointPermission("createEndpoint");
private static final EndpointPermission CREATE_REQUEST_HANDLER_PERM = new
EndpointPermission("createRequestHandler");
private static final EndpointPermission REGISTER_SERVICE_PERM = new
EndpointPermission("registerService");
@@ -140,6 +143,10 @@
this.executor = executor;
this.name = name;
connectionProviders.put("local", new LocalConnectionProvider());
+ connectionProviderContext = new ConnectionProviderContextImpl();
+ loopbackConnectionHandler = new LoopbackConnectionHandler();
+ loopbackConnection = new LoopbackConnection();
+ localConnectionContext = new LocalConnectionContext(null, loopbackConnection);
}
private final Executor executor;
@@ -454,7 +461,7 @@
final FutureResult<Connection> futureResult = new
FutureResult<Connection>(executor);
futureResult.addCancelHandler(connectionProvider.connect(destination,
connectOptions, new TranslatingResult<ConnectionHandlerFactory,
Connection>(futureResult) {
protected Connection translate(final ConnectionHandlerFactory input) {
- return new ConnectionImpl(input);
+ return new ConnectionImpl(input, connectionProviderContext);
}
}));
return futureResult.getIoFuture();
@@ -542,12 +549,18 @@
}
private final class LocalConnectionContext implements ConnectionHandlerContext {
+ private final ConnectionProviderContext connectionProviderContext;
private final Connection connection;
- LocalConnectionContext(final Connection connection) {
+ LocalConnectionContext(final ConnectionProviderContext connectionProviderContext,
final Connection connection) {
+ this.connectionProviderContext = connectionProviderContext;
this.connection = connection;
}
+ public ConnectionProviderContext getConnectionProviderContext() {
+ return connectionProviderContext;
+ }
+
public void openService(final String serviceType, final String groupName, final
OptionMap optionMap, final ServiceResult serviceResult) {
final String canonServiceType = serviceType.toLowerCase();
final String canonGroupName = groupName.toLowerCase();
@@ -599,9 +612,9 @@
private class ConnectionImpl extends AbstractHandleableCloseable<Connection>
implements Connection {
private final ConnectionHandler connectionHandler;
- private ConnectionImpl(final ConnectionHandlerFactory connectionHandlerFactory)
{
+ private ConnectionImpl(final ConnectionHandlerFactory connectionHandlerFactory,
final ConnectionProviderContext connectionProviderContext) {
super(EndpointImpl.this.executor);
- connectionHandler = connectionHandlerFactory.createInstance(new
LocalConnectionContext(this));
+ connectionHandler = connectionHandlerFactory.createInstance(new
LocalConnectionContext(connectionProviderContext, this));
}
protected void closeAction() throws IOException {
@@ -646,10 +659,6 @@
}
}
- private final ConnectionHandler loopbackConnectionHandler = new
LoopbackConnectionHandler();
- private final Connection loopbackConnection = new LoopbackConnection();
- private final ConnectionHandlerContext localConnectionContext = new
LocalConnectionContext(loopbackConnection);
-
private final class LocalConnectionProvider implements ConnectionProvider<Void>
{
public Cancellable connect(final URI uri, final OptionMap connectOptions, final
Result<ConnectionHandlerFactory> result) throws IllegalArgumentException {
Modified:
remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/spi/ConnectionHandlerContext.java
===================================================================
---
remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/spi/ConnectionHandlerContext.java 2009-11-04
23:19:07 UTC (rev 5583)
+++
remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/spi/ConnectionHandlerContext.java 2009-11-04
23:31:39 UTC (rev 5584)
@@ -25,13 +25,20 @@
import org.jboss.xnio.OptionMap;
/**
- * The context for connections to service incoming requests to open a client service.
+ * The context for connection handlers. Used to inform the endpoint of incoming events
on an established connection.
*
* @remoting.consume
*/
public interface ConnectionHandlerContext {
/**
+ * Get the connection provider context associated with this connection handler
context.
+ *
+ * @return the connection provider context
+ */
+ ConnectionProviderContext getConnectionProviderContext();
+
+ /**
* Open a service.
*
* @remoting.nonblocking
Modified:
remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/spi/ConnectionProviderContext.java
===================================================================
---
remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/spi/ConnectionProviderContext.java 2009-11-04
23:19:07 UTC (rev 5583)
+++
remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/spi/ConnectionProviderContext.java 2009-11-04
23:31:39 UTC (rev 5584)
@@ -26,7 +26,8 @@
import java.util.Map;
/**
- * A context for a connection provider which provides a means to accept a connection.
+ * A context for a connection provider. This provides additional endpoint methods to
connection providers which are not
+ * accessible otherwise.
*
* @remoting.consume
*/
Modified: remoting3/trunk/taglet/pom.xml
===================================================================
--- remoting3/trunk/taglet/pom.xml 2009-11-04 23:19:07 UTC (rev 5583)
+++ remoting3/trunk/taglet/pom.xml 2009-11-04 23:31:39 UTC (rev 5584)
@@ -28,6 +28,8 @@
<groupId>org.jboss.remoting</groupId>
<artifactId>jboss-remoting-taglet</artifactId>
+ <name>JBoss Remoting Taglet</name>
+ <description>JBoss Remoting Documentation Taglet</description>
<packaging>jar</packaging>
<version>3.1.0.CR1</version>
Show replies by date