Author: david.lloyd(a)jboss.com
Date: 2008-04-15 22:04:26 -0400 (Tue, 15 Apr 2008)
New Revision: 3992
Added:
remoting3/trunk/api/src/main/java/org/jboss/cx/remoting/Client.java
remoting3/trunk/api/src/main/java/org/jboss/cx/remoting/ClientContext.java
remoting3/trunk/api/src/main/java/org/jboss/cx/remoting/ClientSource.java
remoting3/trunk/api/src/main/java/org/jboss/cx/remoting/spi/protocol/ClientIdentifier.java
remoting3/trunk/api/src/main/java/org/jboss/cx/remoting/spi/protocol/SimpleClientIdentifier.java
remoting3/trunk/api/src/main/java/org/jboss/cx/remoting/spi/wrapper/ClientSourceWrapper.java
remoting3/trunk/api/src/main/java/org/jboss/cx/remoting/spi/wrapper/ClientWrapper.java
remoting3/trunk/core/src/main/java/org/jboss/cx/remoting/core/AbstractRealClient.java
remoting3/trunk/core/src/main/java/org/jboss/cx/remoting/core/AbstractRealClientSource.java
remoting3/trunk/core/src/main/java/org/jboss/cx/remoting/core/ClientInitiator.java
remoting3/trunk/core/src/main/java/org/jboss/cx/remoting/core/ClientMarker.java
remoting3/trunk/core/src/main/java/org/jboss/cx/remoting/core/ClientResponder.java
remoting3/trunk/core/src/main/java/org/jboss/cx/remoting/core/CoreInboundClient.java
remoting3/trunk/core/src/main/java/org/jboss/cx/remoting/core/CoreOutboundClient.java
remoting3/trunk/core/src/main/java/org/jboss/cx/remoting/core/ProtocolClientInitiator.java
remoting3/trunk/core/src/main/java/org/jboss/cx/remoting/core/ProtocolClientResponder.java
remoting3/trunk/core/src/main/java/org/jboss/cx/remoting/core/RequestInitiator.java
remoting3/trunk/core/src/main/java/org/jboss/cx/remoting/core/RequestResponder.java
remoting3/trunk/core/src/main/java/org/jboss/cx/remoting/core/ServiceInitiator.java
remoting3/trunk/core/src/main/java/org/jboss/cx/remoting/core/ServiceResponder.java
remoting3/trunk/jrpp/src/main/java/org/jboss/cx/remoting/jrpp/id/JrppClientIdentifier.java
Removed:
remoting3/trunk/api/src/main/java/org/jboss/cx/remoting/Context.java
remoting3/trunk/api/src/main/java/org/jboss/cx/remoting/ContextContext.java
remoting3/trunk/api/src/main/java/org/jboss/cx/remoting/ContextSource.java
remoting3/trunk/api/src/main/java/org/jboss/cx/remoting/spi/protocol/ContextIdentifier.java
remoting3/trunk/api/src/main/java/org/jboss/cx/remoting/spi/protocol/SimpleContextIdentifier.java
remoting3/trunk/api/src/main/java/org/jboss/cx/remoting/spi/wrapper/ContextSourceWrapper.java
remoting3/trunk/api/src/main/java/org/jboss/cx/remoting/spi/wrapper/ContextWrapper.java
remoting3/trunk/core/src/main/java/org/jboss/cx/remoting/core/AbstractRealContext.java
remoting3/trunk/core/src/main/java/org/jboss/cx/remoting/core/AbstractRealContextSource.java
remoting3/trunk/core/src/main/java/org/jboss/cx/remoting/core/ContextClient.java
remoting3/trunk/core/src/main/java/org/jboss/cx/remoting/core/ContextMarker.java
remoting3/trunk/core/src/main/java/org/jboss/cx/remoting/core/ContextServer.java
remoting3/trunk/core/src/main/java/org/jboss/cx/remoting/core/CoreInboundContext.java
remoting3/trunk/core/src/main/java/org/jboss/cx/remoting/core/CoreOutboundContext.java
remoting3/trunk/core/src/main/java/org/jboss/cx/remoting/core/ProtocolContextClient.java
remoting3/trunk/core/src/main/java/org/jboss/cx/remoting/core/ProtocolContextServer.java
remoting3/trunk/core/src/main/java/org/jboss/cx/remoting/core/RequestClient.java
remoting3/trunk/core/src/main/java/org/jboss/cx/remoting/core/RequestServer.java
remoting3/trunk/core/src/main/java/org/jboss/cx/remoting/core/ServiceClient.java
remoting3/trunk/core/src/main/java/org/jboss/cx/remoting/core/ServiceServer.java
remoting3/trunk/jrpp/src/main/java/org/jboss/cx/remoting/jrpp/id/JrppContextIdentifier.java
Modified:
remoting3/trunk/api/src/main/java/org/jboss/cx/remoting/AbstractRequestListener.java
remoting3/trunk/api/src/main/java/org/jboss/cx/remoting/Endpoint.java
remoting3/trunk/api/src/main/java/org/jboss/cx/remoting/RequestContext.java
remoting3/trunk/api/src/main/java/org/jboss/cx/remoting/RequestListener.java
remoting3/trunk/api/src/main/java/org/jboss/cx/remoting/Session.java
remoting3/trunk/api/src/main/java/org/jboss/cx/remoting/service/ServiceReply.java
remoting3/trunk/api/src/main/java/org/jboss/cx/remoting/spi/protocol/ProtocolContext.java
remoting3/trunk/api/src/main/java/org/jboss/cx/remoting/spi/protocol/ProtocolHandler.java
remoting3/trunk/api/src/main/java/org/jboss/cx/remoting/spi/wrapper/EndpointWrapper.java
remoting3/trunk/api/src/main/java/org/jboss/cx/remoting/spi/wrapper/RequestContextWrapper.java
remoting3/trunk/api/src/main/java/org/jboss/cx/remoting/spi/wrapper/SessionWrapper.java
remoting3/trunk/core/src/main/java/org/jboss/cx/remoting/core/CoreEndpoint.java
remoting3/trunk/core/src/main/java/org/jboss/cx/remoting/core/CoreInboundRequest.java
remoting3/trunk/core/src/main/java/org/jboss/cx/remoting/core/CoreInboundService.java
remoting3/trunk/core/src/main/java/org/jboss/cx/remoting/core/CoreOutboundRequest.java
remoting3/trunk/core/src/main/java/org/jboss/cx/remoting/core/CoreOutboundService.java
remoting3/trunk/core/src/main/java/org/jboss/cx/remoting/core/CoreSession.java
remoting3/trunk/core/src/main/java/org/jboss/cx/remoting/core/RemoteClassLoader.java
remoting3/trunk/core/src/main/java/org/jboss/cx/remoting/core/protocol/LocalProtocolHandler.java
remoting3/trunk/core/src/main/java/org/jboss/cx/remoting/core/service/ClassLoaderResourceListener.java
remoting3/trunk/core/src/main/java/org/jboss/cx/remoting/core/service/ServiceLocatorListener.java
remoting3/trunk/http-mina-client/.project
remoting3/trunk/http/src/main/java/org/jboss/cx/remoting/http/RemotingHttpSession.java
remoting3/trunk/jrpp/src/main/java/org/jboss/cx/remoting/jrpp/JrppConnection.java
remoting3/trunk/samples/src/main/java/org/jboss/cx/remoting/samples/simple/JrppBasicExampleMain.java
remoting3/trunk/samples/src/main/java/org/jboss/cx/remoting/samples/simple/JrppStreamExampleMain.java
remoting3/trunk/samples/src/main/java/org/jboss/cx/remoting/samples/simple/LocalBasicExampleMain.java
remoting3/trunk/samples/src/main/java/org/jboss/cx/remoting/samples/simple/LocalStreamExampleMain.java
remoting3/trunk/standalone/src/main/java/org/jboss/cx/remoting/Remoting.java
Log:
The Big Rename: Context -> Client and various related naming cleanups. Tally-ho!
Modified:
remoting3/trunk/api/src/main/java/org/jboss/cx/remoting/AbstractRequestListener.java
===================================================================
---
remoting3/trunk/api/src/main/java/org/jboss/cx/remoting/AbstractRequestListener.java 2008-04-16
01:40:57 UTC (rev 3991)
+++
remoting3/trunk/api/src/main/java/org/jboss/cx/remoting/AbstractRequestListener.java 2008-04-16
02:04:26 UTC (rev 3992)
@@ -4,7 +4,7 @@
*
*/
public abstract class AbstractRequestListener<I, O> implements
RequestListener<I, O> {
- public void handleContextOpen(final ContextContext context) {
+ public void handleClientOpen(final ClientContext context) {
}
public void handleServiceOpen(final ServiceContext context) {
@@ -13,6 +13,6 @@
public void handleServiceClose(final ServiceContext context) {
}
- public void handleContextClose(final ContextContext context) {
+ public void handleClientClose(final ClientContext context) {
}
}
Copied: remoting3/trunk/api/src/main/java/org/jboss/cx/remoting/Client.java (from rev
3985, remoting3/trunk/api/src/main/java/org/jboss/cx/remoting/Context.java)
===================================================================
--- remoting3/trunk/api/src/main/java/org/jboss/cx/remoting/Client.java
(rev 0)
+++ remoting3/trunk/api/src/main/java/org/jboss/cx/remoting/Client.java 2008-04-16
02:04:26 UTC (rev 3992)
@@ -0,0 +1,68 @@
+package org.jboss.cx.remoting;
+
+import java.util.concurrent.ConcurrentMap;
+
+/**
+ * A communications context. The context may be associated with a
security/authentication state and a transactional
+ * state, as well as other state maintained by the remote side.
+ */
+public interface Client<I, O> extends Closeable<Client<I, O>> {
+ /**
+ * Send a request and block until a reply is received.
+ * <p/>
+ * Uses the default invocation policy for handling remote invocations. If the remote
side manipulates a stream, the
+ * current thread MAY be used to handle it.
+ * <p/>
+ * If the remote session cannot handle the request, a {@code RemotingException} will
be thrown.
+ *
+ * @param request the request to send
+ *
+ * @return the result of the request
+ *
+ * @throws RemotingException if the request could not be sent
+ * @throws RemoteExecutionException if the remote handler threw an exception
+ */
+ O invoke(I request) throws RemotingException, RemoteExecutionException;
+
+ /**
+ * Send a request asynchronously.
+ * <p/>
+ * Uses the default invocation policy for handling remote invocations. If the remote
side manipulates a stream, it
+ * MAY fail with an exception (e.g. if this method is called on a client with no
threads to handle streaming).
+ * <p/>
+ * Returns immediately.
+ *
+ * @param request the request to send
+ *
+ * @return a future representing the result of the request
+ *
+ * @throws RemotingException if the request could not be sent
+ */
+ FutureReply<O> send(I request) throws RemotingException;
+
+ /**
+ * Send a request asynchronously, ignoring the reply.
+ * </p>
+ * Uses the default invocation policy for handling remote invocations. If the remote
side manipulates a stream, it
+ * MAY fail with an exception (e.g. if this method is called on a client with no
threads to handle streaming).
+ * <p/>
+ * Returns immediately.
+ *
+ * @param request the request to send
+ * @throws RemotingException if the request could not be sent
+ */
+ void sendOneWay(I request) throws RemotingException;
+
+ /**
+ * Get the context map. This map holds metadata about the current context.
+ *
+ * @return the context map
+ */
+ ConcurrentMap<Object, Object> getAttributes();
+
+ void close() throws RemotingException;
+
+ void closeImmediate() throws RemotingException;
+
+ void addCloseHandler(final CloseHandler<Client<I, O>> closeHandler);
+}
Copied: remoting3/trunk/api/src/main/java/org/jboss/cx/remoting/ClientContext.java (from
rev 3985, remoting3/trunk/api/src/main/java/org/jboss/cx/remoting/ContextContext.java)
===================================================================
--- remoting3/trunk/api/src/main/java/org/jboss/cx/remoting/ClientContext.java
(rev 0)
+++ remoting3/trunk/api/src/main/java/org/jboss/cx/remoting/ClientContext.java 2008-04-16
02:04:26 UTC (rev 3992)
@@ -0,0 +1,23 @@
+package org.jboss.cx.remoting;
+
+import java.util.concurrent.ConcurrentMap;
+
+/**
+ *
+ */
+public interface ClientContext extends Closeable<ClientContext> {
+ /**
+ * Get the attributes for this end of the context as a map.
+ *
+ * @return the attribute map
+ */
+ ConcurrentMap<Object, Object> getAttributes();
+
+ /**
+ * Get the service that this context is associated with, or {@code null} if there is
no
+ * service.
+ *
+ * @return the service, or {@code null} if there is none
+ */
+ ServiceContext getServiceContext();
+}
Copied: remoting3/trunk/api/src/main/java/org/jboss/cx/remoting/ClientSource.java (from
rev 3985, remoting3/trunk/api/src/main/java/org/jboss/cx/remoting/ContextSource.java)
===================================================================
--- remoting3/trunk/api/src/main/java/org/jboss/cx/remoting/ClientSource.java
(rev 0)
+++ remoting3/trunk/api/src/main/java/org/jboss/cx/remoting/ClientSource.java 2008-04-16
02:04:26 UTC (rev 3992)
@@ -0,0 +1,19 @@
+package org.jboss.cx.remoting;
+
+/**
+ * A source for new Remoting contexts.
+ */
+public interface ClientSource<I, O> extends Closeable<ClientSource<I,
O>> {
+ /**
+ * Close the context source. New contexts may no longer be created after this
+ * method is called. Subsequent calls to this method have no additional effect.
+ */
+ void close() throws RemotingException;
+
+ /**
+ * Create a new communications context.
+ *
+ * @return the new context
+ */
+ Client<I, O> createContext() throws RemotingException;
+}
Deleted: remoting3/trunk/api/src/main/java/org/jboss/cx/remoting/Context.java
===================================================================
--- remoting3/trunk/api/src/main/java/org/jboss/cx/remoting/Context.java 2008-04-16
01:40:57 UTC (rev 3991)
+++ remoting3/trunk/api/src/main/java/org/jboss/cx/remoting/Context.java 2008-04-16
02:04:26 UTC (rev 3992)
@@ -1,68 +0,0 @@
-package org.jboss.cx.remoting;
-
-import java.util.concurrent.ConcurrentMap;
-
-/**
- * A communications context. The context may be associated with a
security/authentication state and a transactional
- * state, as well as other state maintained by the remote side.
- */
-public interface Context<I, O> extends Closeable<Context<I, O>> {
- /**
- * Send a request and block until a reply is received.
- * <p/>
- * Uses the default invocation policy for handling remote invocations. If the remote
side manipulates a stream, the
- * current thread MAY be used to handle it.
- * <p/>
- * If the remote session cannot handle the request, a {@code RemotingException} will
be thrown.
- *
- * @param request the request to send
- *
- * @return the result of the request
- *
- * @throws RemotingException if the request could not be sent
- * @throws RemoteExecutionException if the remote handler threw an exception
- */
- O invoke(I request) throws RemotingException, RemoteExecutionException;
-
- /**
- * Send a request asynchronously.
- * <p/>
- * Uses the default invocation policy for handling remote invocations. If the remote
side manipulates a stream, it
- * MAY fail with an exception (e.g. if this method is called on a client with no
threads to handle streaming).
- * <p/>
- * Returns immediately.
- *
- * @param request the request to send
- *
- * @return a future representing the result of the request
- *
- * @throws RemotingException if the request could not be sent
- */
- FutureReply<O> send(I request) throws RemotingException;
-
- /**
- * Send a request asynchronously, ignoring the reply.
- * </p>
- * Uses the default invocation policy for handling remote invocations. If the remote
side manipulates a stream, it
- * MAY fail with an exception (e.g. if this method is called on a client with no
threads to handle streaming).
- * <p/>
- * Returns immediately.
- *
- * @param request the request to send
- * @throws RemotingException if the request could not be sent
- */
- void sendOneWay(I request) throws RemotingException;
-
- /**
- * Get the context map. This map holds metadata about the current context.
- *
- * @return the context map
- */
- ConcurrentMap<Object, Object> getAttributes();
-
- void close() throws RemotingException;
-
- void closeImmediate() throws RemotingException;
-
- void addCloseHandler(final CloseHandler<Context<I, O>> closeHandler);
-}
Deleted: remoting3/trunk/api/src/main/java/org/jboss/cx/remoting/ContextContext.java
===================================================================
--- remoting3/trunk/api/src/main/java/org/jboss/cx/remoting/ContextContext.java 2008-04-16
01:40:57 UTC (rev 3991)
+++ remoting3/trunk/api/src/main/java/org/jboss/cx/remoting/ContextContext.java 2008-04-16
02:04:26 UTC (rev 3992)
@@ -1,23 +0,0 @@
-package org.jboss.cx.remoting;
-
-import java.util.concurrent.ConcurrentMap;
-
-/**
- *
- */
-public interface ContextContext extends Closeable<ContextContext> {
- /**
- * Get the attributes for this end of the context as a map.
- *
- * @return the attribute map
- */
- ConcurrentMap<Object, Object> getAttributes();
-
- /**
- * Get the service that this context is associated with, or {@code null} if there is
no
- * service.
- *
- * @return the service, or {@code null} if there is none
- */
- ServiceContext getServiceContext();
-}
Deleted: remoting3/trunk/api/src/main/java/org/jboss/cx/remoting/ContextSource.java
===================================================================
--- remoting3/trunk/api/src/main/java/org/jboss/cx/remoting/ContextSource.java 2008-04-16
01:40:57 UTC (rev 3991)
+++ remoting3/trunk/api/src/main/java/org/jboss/cx/remoting/ContextSource.java 2008-04-16
02:04:26 UTC (rev 3992)
@@ -1,19 +0,0 @@
-package org.jboss.cx.remoting;
-
-/**
- * A source for new Remoting contexts.
- */
-public interface ContextSource<I, O> extends Closeable<ContextSource<I,
O>> {
- /**
- * Close the context source. New contexts may no longer be created after this
- * method is called. Subsequent calls to this method have no additional effect.
- */
- void close() throws RemotingException;
-
- /**
- * Create a new communications context.
- *
- * @return the new context
- */
- Context<I, O> createContext() throws RemotingException;
-}
Modified: remoting3/trunk/api/src/main/java/org/jboss/cx/remoting/Endpoint.java
===================================================================
--- remoting3/trunk/api/src/main/java/org/jboss/cx/remoting/Endpoint.java 2008-04-16
01:40:57 UTC (rev 3991)
+++ remoting3/trunk/api/src/main/java/org/jboss/cx/remoting/Endpoint.java 2008-04-16
02:04:26 UTC (rev 3992)
@@ -79,7 +79,7 @@
* @param requestListener the request listener
* @return the context
*/
- <I, O> Context<I, O> createContext(RequestListener<I, O>
requestListener);
+ <I, O> Client<I, O> createContext(RequestListener<I, O>
requestListener);
/**
* Create a context source that can be used to acquire contexts associated with a
request listener on this endpoint.
@@ -91,7 +91,7 @@
* @param requestListener the request listener
* @return the context source
*/
- <I, O> ContextSource<I, O> createService(RequestListener<I, O>
requestListener);
+ <I, O> ClientSource<I, O> createService(RequestListener<I, O>
requestListener);
/**
* Add a listener that is notified when a session is created.
Modified: remoting3/trunk/api/src/main/java/org/jboss/cx/remoting/RequestContext.java
===================================================================
--- remoting3/trunk/api/src/main/java/org/jboss/cx/remoting/RequestContext.java 2008-04-16
01:40:57 UTC (rev 3991)
+++ remoting3/trunk/api/src/main/java/org/jboss/cx/remoting/RequestContext.java 2008-04-16
02:04:26 UTC (rev 3992)
@@ -11,7 +11,7 @@
*
* @return the context
*/
- ContextContext getContext();
+ ClientContext getContext();
/**
* Determine whether the current request was cancelled.
Modified: remoting3/trunk/api/src/main/java/org/jboss/cx/remoting/RequestListener.java
===================================================================
---
remoting3/trunk/api/src/main/java/org/jboss/cx/remoting/RequestListener.java 2008-04-16
01:40:57 UTC (rev 3991)
+++
remoting3/trunk/api/src/main/java/org/jboss/cx/remoting/RequestListener.java 2008-04-16
02:04:26 UTC (rev 3992)
@@ -5,11 +5,11 @@
*/
public interface RequestListener<I, O> {
/**
- * Handle the opening of a context.
+ * Handle the opening of a client.
*
- * @param context the context context
+ * @param context the client context
*/
- void handleContextOpen(ContextContext context);
+ void handleClientOpen(ClientContext context);
/**
* Handle the opening of a service.
@@ -42,9 +42,9 @@
void handleServiceClose(ServiceContext context);
/**
- * Handle the close of a context.
+ * Handle the close of a client.
*
* @param context
*/
- void handleContextClose(ContextContext context);
+ void handleClientClose(ClientContext context);
}
Modified: remoting3/trunk/api/src/main/java/org/jboss/cx/remoting/Session.java
===================================================================
--- remoting3/trunk/api/src/main/java/org/jboss/cx/remoting/Session.java 2008-04-16
01:40:57 UTC (rev 3991)
+++ remoting3/trunk/api/src/main/java/org/jboss/cx/remoting/Session.java 2008-04-16
02:04:26 UTC (rev 3992)
@@ -42,5 +42,5 @@
*
* @return the root context
*/
- <I, O> Context<I, O> getRootContext();
+ <I, O> Client<I, O> getRootContext();
}
Modified:
remoting3/trunk/api/src/main/java/org/jboss/cx/remoting/service/ServiceReply.java
===================================================================
---
remoting3/trunk/api/src/main/java/org/jboss/cx/remoting/service/ServiceReply.java 2008-04-16
01:40:57 UTC (rev 3991)
+++
remoting3/trunk/api/src/main/java/org/jboss/cx/remoting/service/ServiceReply.java 2008-04-16
02:04:26 UTC (rev 3992)
@@ -1,8 +1,8 @@
package org.jboss.cx.remoting.service;
import java.io.Serializable;
-import org.jboss.cx.remoting.Context;
-import org.jboss.cx.remoting.ContextSource;
+import org.jboss.cx.remoting.Client;
+import org.jboss.cx.remoting.ClientSource;
/**
*
@@ -10,25 +10,25 @@
public final class ServiceReply<I, O> implements Serializable {
private static final long serialVersionUID = 1L;
- private ContextSource<I, O> serviceContextSource;
- private Context<ClassLoaderResourceRequest, ClassLoaderResourceReply>
classLoadingContext;
+ private ClientSource<I, O> serviceClientSource;
+ private Client<ClassLoaderResourceRequest, ClassLoaderResourceReply>
classLoadingClient;
public ServiceReply() {
}
- public ContextSource<I, O> getServiceContextSource() {
- return serviceContextSource;
+ public ClientSource<I, O> getServiceContextSource() {
+ return serviceClientSource;
}
- public void setServiceContextSource(final ContextSource<I, O>
serviceContextSource) {
- this.serviceContextSource = serviceContextSource;
+ public void setServiceContextSource(final ClientSource<I, O>
serviceClientSource) {
+ this.serviceClientSource = serviceClientSource;
}
- public Context<ClassLoaderResourceRequest, ClassLoaderResourceReply>
getClassLoadingContext() {
- return classLoadingContext;
+ public Client<ClassLoaderResourceRequest, ClassLoaderResourceReply>
getClassLoadingContext() {
+ return classLoadingClient;
}
- public void setClassLoadingContext(final Context<ClassLoaderResourceRequest,
ClassLoaderResourceReply> classLoadingContext) {
- this.classLoadingContext = classLoadingContext;
+ public void setClassLoadingContext(final Client<ClassLoaderResourceRequest,
ClassLoaderResourceReply> classLoadingClient) {
+ this.classLoadingClient = classLoadingClient;
}
}
Copied:
remoting3/trunk/api/src/main/java/org/jboss/cx/remoting/spi/protocol/ClientIdentifier.java
(from rev 3985,
remoting3/trunk/api/src/main/java/org/jboss/cx/remoting/spi/protocol/ContextIdentifier.java)
===================================================================
---
remoting3/trunk/api/src/main/java/org/jboss/cx/remoting/spi/protocol/ClientIdentifier.java
(rev 0)
+++
remoting3/trunk/api/src/main/java/org/jboss/cx/remoting/spi/protocol/ClientIdentifier.java 2008-04-16
02:04:26 UTC (rev 3992)
@@ -0,0 +1,7 @@
+package org.jboss.cx.remoting.spi.protocol;
+
+/**
+ *
+ */
+public interface ClientIdentifier {
+}
Deleted:
remoting3/trunk/api/src/main/java/org/jboss/cx/remoting/spi/protocol/ContextIdentifier.java
===================================================================
---
remoting3/trunk/api/src/main/java/org/jboss/cx/remoting/spi/protocol/ContextIdentifier.java 2008-04-16
01:40:57 UTC (rev 3991)
+++
remoting3/trunk/api/src/main/java/org/jboss/cx/remoting/spi/protocol/ContextIdentifier.java 2008-04-16
02:04:26 UTC (rev 3992)
@@ -1,7 +0,0 @@
-package org.jboss.cx.remoting.spi.protocol;
-
-/**
- *
- */
-public interface ContextIdentifier {
-}
Modified:
remoting3/trunk/api/src/main/java/org/jboss/cx/remoting/spi/protocol/ProtocolContext.java
===================================================================
---
remoting3/trunk/api/src/main/java/org/jboss/cx/remoting/spi/protocol/ProtocolContext.java 2008-04-16
01:40:57 UTC (rev 3991)
+++
remoting3/trunk/api/src/main/java/org/jboss/cx/remoting/spi/protocol/ProtocolContext.java 2008-04-16
02:04:26 UTC (rev 3992)
@@ -15,27 +15,27 @@
/* CLIENT methods */
- void receiveReply(ContextIdentifier contextIdentifier, RequestIdentifier
requestIdentifier, Object reply);
+ void receiveReply(ClientIdentifier clientIdentifier, RequestIdentifier
requestIdentifier, Object reply);
- void receiveException(ContextIdentifier contextIdentifier, RequestIdentifier
requestIdentifier, RemoteExecutionException exception);
+ void receiveException(ClientIdentifier clientIdentifier, RequestIdentifier
requestIdentifier, RemoteExecutionException exception);
- void receiveCancelAcknowledge(ContextIdentifier contextIdentifier, RequestIdentifier
requestIdentifier);
+ void receiveCancelAcknowledge(ClientIdentifier clientIdentifier, RequestIdentifier
requestIdentifier);
void receiveServiceClosing(ServiceIdentifier serviceIdentifier);
- void receiveContextClosing(ContextIdentifier contextIdentifier, boolean done);
+ void receiveClientClosing(ClientIdentifier clientIdentifier, boolean done);
/* SERVER methods */
void receiveServiceClose(ServiceIdentifier remoteServiceIdentifier);
- void receiveContextClose(ContextIdentifier remoteContextIdentifier, boolean
immediate, boolean cancel, boolean interrupt);
+ void receiveClientClose(ClientIdentifier remoteClientIdentifier, boolean immediate,
boolean cancel, boolean interrupt);
- void receiveOpenedContext(ServiceIdentifier remoteServiceIdentifier,
ContextIdentifier remoteContextIdentifier);
+ void receiveOpenedContext(ServiceIdentifier remoteServiceIdentifier, ClientIdentifier
remoteClientIdentifier);
- void receiveRequest(ContextIdentifier remoteContextIdentifier, RequestIdentifier
requestIdentifier, Object request);
+ void receiveRequest(ClientIdentifier remoteClientIdentifier, RequestIdentifier
requestIdentifier, Object request);
- void receiveCancelRequest(ContextIdentifier remoteContextIdentifier,
RequestIdentifier requestIdentifier, boolean mayInterrupt);
+ void receiveCancelRequest(ClientIdentifier remoteClientIdentifier, RequestIdentifier
requestIdentifier, boolean mayInterrupt);
/* SESSION methods */
Modified:
remoting3/trunk/api/src/main/java/org/jboss/cx/remoting/spi/protocol/ProtocolHandler.java
===================================================================
---
remoting3/trunk/api/src/main/java/org/jboss/cx/remoting/spi/protocol/ProtocolHandler.java 2008-04-16
01:40:57 UTC (rev 3991)
+++
remoting3/trunk/api/src/main/java/org/jboss/cx/remoting/spi/protocol/ProtocolHandler.java 2008-04-16
02:04:26 UTC (rev 3992)
@@ -32,31 +32,31 @@
/**
* Send the reply to a request.
*
- * @param remoteContextIdentifier the context that the request was received under
+ * @param remoteClientIdentifier the client that the request was received under
* @param requestIdentifier the request identifier
* @param reply the reply to send
* @throws IOException if an I/O error occurs
*/
- void sendReply(ContextIdentifier remoteContextIdentifier, RequestIdentifier
requestIdentifier, Object reply) throws IOException;
+ void sendReply(ClientIdentifier remoteClientIdentifier, RequestIdentifier
requestIdentifier, Object reply) throws IOException;
/**
* Send an exception reply to a request.
*
- * @param remoteContextIdentifier the context that the request was received under
+ * @param remoteClientIdentifier the client that the request was received under
* @param requestIdentifier the request identifier
* @param exception the exception to send
* @throws IOException if an I/O error occurs
*/
- void sendException(ContextIdentifier remoteContextIdentifier, RequestIdentifier
requestIdentifier, RemoteExecutionException exception) throws IOException;
+ void sendException(ClientIdentifier remoteClientIdentifier, RequestIdentifier
requestIdentifier, RemoteExecutionException exception) throws IOException;
/**
* Send a notification to the client that a request was cancelled.
*
- * @param remoteContextIdentifier the context that the request was received under
+ * @param remoteClientIdentifier the client that the request was received under
* @param requestIdentifier the request identifier
* @throws IOException if an I/O error occurs
*/
- void sendCancelAcknowledge(ContextIdentifier remoteContextIdentifier,
RequestIdentifier requestIdentifier) throws IOException;
+ void sendCancelAcknowledge(ClientIdentifier remoteClientIdentifier, RequestIdentifier
requestIdentifier) throws IOException;
/**
* Notify the client side that the service has been terminated on the server. A
service may be terminated
@@ -68,67 +68,67 @@
void sendServiceClosing(ServiceIdentifier remoteServiceIdentifier) throws
IOException;
/**
- * Notify the client side that a context is closing and is no longer available for
new requests.
+ * Notify the client side that the server is closing the client, and thus it will no
longer be available for new requests.
*
- * @param remoteContextIdentifier the remote context identifier
- * @param done {@code true} if the context is closed and no more replies will arrive
for it
+ * @param remoteClientIdentifier the remote client identifier
+ * @param done {@code true} if the client is closed and no more replies will arrive
for it
* @throws IOException if an I/O error occurs
*/
- void sendContextClosing(ContextIdentifier remoteContextIdentifier, boolean done)
throws IOException;
+ void sendClientClosing(ClientIdentifier remoteClientIdentifier, boolean done) throws
IOException;
/* CLIENT methods */
/**
- * Get the identifier for the root context for this session. The root context lives
as long as the session is up.
- * This identifier is used to invoke the root context listener from the local side to
the remote side.
+ * Get the identifier for the root client for this session. The root client lives as
long as the session is up.
+ * This identifier is used to invoke the root client listener from the local side to
the remote side.
*
- * @return the identifier for the root context
+ * @return the identifier for the root client
* @throws IOException if an I/O error occurs
*/
- ContextIdentifier getLocalRootContextIdentifier();
+ ClientIdentifier getLocalRootClientIdentifier();
/**
- * Get the identifier for the root context for this session. The root context lives
as long as the session is up.
- * This identifier is used to invoke the root context listener from the remote side
to the local side.
+ * Get the identifier for the root client for this session. The root client lives as
long as the session is up.
+ * This identifier is used to invoke the root client listener from the remote side to
the local side.
*
- * @return the identifier for the root context
+ * @return the identifier for the root client
* @throws IOException if an I/O error occurs
*/
- ContextIdentifier getRemoteRootContextIdentifier();
+ ClientIdentifier getRemoteRootClientIdentifier();
/**
- * Get a new context identifier. The service identifier was received from the remote
side. Should send a message
+ * Get a new client identifier. The service identifier was received from the remote
side. Should send a message
* to the remote side such that the
- * {@link ProtocolContext#receiveOpenedContext(ServiceIdentifier, ContextIdentifier)}
method is called with
- * the service and context identifiers.
+ * {@link ProtocolContext#receiveOpenedContext(ServiceIdentifier, ClientIdentifier)}
method is called with
+ * the service and client identifiers.
*
* @param serviceIdentifier the service identifier
- * @return a context identifier associated with the given service identifier
+ * @return a client identifier associated with the given service identifier
* @throws IOException if an I/O error occurs
*/
- ContextIdentifier openContext(ServiceIdentifier serviceIdentifier) throws
IOException;
+ ClientIdentifier openClient(ServiceIdentifier serviceIdentifier) throws IOException;
/**
- * Close a previously opened context. The protocol handler should cause the
- * {@link
ProtocolContext#receiveContextClose(ContextIdentifier,boolean,boolean,boolean)} method to
be called
- * on the remote side for this context identifier.
+ * Close a previously opened client. The protocol handler should cause the
+ * {@link ProtocolContext#receiveClientClose(ClientIdentifier
,boolean,boolean,boolean)} method to be called
+ * on the remote side for this client identifier.
*
- * @param contextIdentifier the context identifier
- * @param immediate {@code true} to immediately shut down the context and throw out
any executing requests (implies {@code cancel} and {@code interrupt})
+ * @param clientIdentifier the client identifier
+ * @param immediate {@code true} to immediately shut down the client and throw out
any executing requests (implies {@code cancel} and {@code interrupt})
* @param cancel {@code true} to cancel any outstanding requests
* @param interrupt {@code true} to interrupt tasks that are cancelled (ignored
unless {@code immediate} or {@code cancel} are {@code true})
* @throws IOException if an I/O error occurs
*/
- void sendContextClose(ContextIdentifier contextIdentifier, boolean immediate, boolean
cancel, boolean interrupt) throws IOException;
+ void sendClientClose(ClientIdentifier clientIdentifier, boolean immediate, boolean
cancel, boolean interrupt) throws IOException;
/**
* Acquire a new request identifier that will be used to send a request.
*
- * @param contextIdentifier the context identifier
+ * @param clientIdentifier the client identifier
* @return the new request identifier
* @throws IOException if an I/O error occurs
*/
- RequestIdentifier openRequest(ContextIdentifier contextIdentifier) throws
IOException;
+ RequestIdentifier openRequest(ClientIdentifier clientIdentifier) throws IOException;
/**
* Send a notification that the client is no longer using the given service.
@@ -141,33 +141,33 @@
/**
* Send a request to the remote side.
*
- * @param contextIdentifier the context identifier
+ * @param clientIdentifier the client identifier
* @param requestIdentifier the request identifier
* @param request the request body
* @param streamExecutor the executor to use for stream callbacks
* @throws IOException if an I/O error occurs
*/
- void sendRequest(ContextIdentifier contextIdentifier, RequestIdentifier
requestIdentifier, Object request, Executor streamExecutor) throws IOException;
+ void sendRequest(ClientIdentifier clientIdentifier, RequestIdentifier
requestIdentifier, Object request, Executor streamExecutor) throws IOException;
/**
* Send a request to cancel a previously sent request.
*
- * @param contextIdentifier the context identifier
+ * @param clientIdentifier the client identifier
* @param requestIdentifier the request identifier to cancel
* @param mayInterrupt {@code true} if processing may be interrupted
* @throws IOException if an I/O error occurs
*/
- void sendCancelRequest(ContextIdentifier contextIdentifier, RequestIdentifier
requestIdentifier, boolean mayInterrupt) throws IOException;
+ void sendCancelRequest(ClientIdentifier clientIdentifier, RequestIdentifier
requestIdentifier, boolean mayInterrupt) throws IOException;
/* SESSION methods */
/**
- * Open a serviceless context. The context identifier may be transmitted to the
remote side.
+ * Open a serviceless client. The client identifier may be transmitted to the remote
side.
*
- * @return a context identifier
+ * @return a client identifier
* @throws IOException if an I/O error occurs
*/
- ContextIdentifier openContext() throws IOException;
+ ClientIdentifier openClient() throws IOException;
/**
* Get a new service identifier that may be transmitted to the remote side.
Copied:
remoting3/trunk/api/src/main/java/org/jboss/cx/remoting/spi/protocol/SimpleClientIdentifier.java
(from rev 3985,
remoting3/trunk/api/src/main/java/org/jboss/cx/remoting/spi/protocol/SimpleContextIdentifier.java)
===================================================================
---
remoting3/trunk/api/src/main/java/org/jboss/cx/remoting/spi/protocol/SimpleClientIdentifier.java
(rev 0)
+++
remoting3/trunk/api/src/main/java/org/jboss/cx/remoting/spi/protocol/SimpleClientIdentifier.java 2008-04-16
02:04:26 UTC (rev 3992)
@@ -0,0 +1,7 @@
+package org.jboss.cx.remoting.spi.protocol;
+
+/**
+ *
+ */
+public final class SimpleClientIdentifier implements ClientIdentifier {
+}
Deleted:
remoting3/trunk/api/src/main/java/org/jboss/cx/remoting/spi/protocol/SimpleContextIdentifier.java
===================================================================
---
remoting3/trunk/api/src/main/java/org/jboss/cx/remoting/spi/protocol/SimpleContextIdentifier.java 2008-04-16
01:40:57 UTC (rev 3991)
+++
remoting3/trunk/api/src/main/java/org/jboss/cx/remoting/spi/protocol/SimpleContextIdentifier.java 2008-04-16
02:04:26 UTC (rev 3992)
@@ -1,7 +0,0 @@
-package org.jboss.cx.remoting.spi.protocol;
-
-/**
- *
- */
-public final class SimpleContextIdentifier implements ContextIdentifier {
-}
Copied:
remoting3/trunk/api/src/main/java/org/jboss/cx/remoting/spi/wrapper/ClientSourceWrapper.java
(from rev 3985,
remoting3/trunk/api/src/main/java/org/jboss/cx/remoting/spi/wrapper/ContextSourceWrapper.java)
===================================================================
---
remoting3/trunk/api/src/main/java/org/jboss/cx/remoting/spi/wrapper/ClientSourceWrapper.java
(rev 0)
+++
remoting3/trunk/api/src/main/java/org/jboss/cx/remoting/spi/wrapper/ClientSourceWrapper.java 2008-04-16
02:04:26 UTC (rev 3992)
@@ -0,0 +1,37 @@
+package org.jboss.cx.remoting.spi.wrapper;
+
+import org.jboss.cx.remoting.CloseHandler;
+import org.jboss.cx.remoting.Client;
+import org.jboss.cx.remoting.ClientSource;
+import org.jboss.cx.remoting.RemotingException;
+
+/**
+ *
+ */
+public class ClientSourceWrapper<I, O> implements ClientSource<I, O> {
+ private final ClientSource<I, O> delegate;
+
+ protected ClientSourceWrapper(ClientSource<I, O> delegate) {
+ this.delegate = delegate;
+ }
+
+ public void close() throws RemotingException {
+ delegate.close();
+ }
+
+ public void closeImmediate() throws RemotingException {
+ delegate.closeImmediate();
+ }
+
+ public void addCloseHandler(final CloseHandler<ClientSource<I, O>>
closeHandler) {
+ delegate.addCloseHandler(new CloseHandler<ClientSource<I, O>>() {
+ public void handleClose(final ClientSource<I, O> closed) {
+ closeHandler.handleClose(ClientSourceWrapper.this);
+ }
+ });
+ }
+
+ public Client<I, O> createContext() throws RemotingException {
+ return delegate.createContext();
+ }
+}
Copied:
remoting3/trunk/api/src/main/java/org/jboss/cx/remoting/spi/wrapper/ClientWrapper.java
(from rev 3985,
remoting3/trunk/api/src/main/java/org/jboss/cx/remoting/spi/wrapper/ContextWrapper.java)
===================================================================
---
remoting3/trunk/api/src/main/java/org/jboss/cx/remoting/spi/wrapper/ClientWrapper.java
(rev 0)
+++
remoting3/trunk/api/src/main/java/org/jboss/cx/remoting/spi/wrapper/ClientWrapper.java 2008-04-16
02:04:26 UTC (rev 3992)
@@ -0,0 +1,52 @@
+package org.jboss.cx.remoting.spi.wrapper;
+
+import java.util.concurrent.ConcurrentMap;
+import org.jboss.cx.remoting.CloseHandler;
+import org.jboss.cx.remoting.Client;
+import org.jboss.cx.remoting.FutureReply;
+import org.jboss.cx.remoting.RemoteExecutionException;
+import org.jboss.cx.remoting.RemotingException;
+
+/**
+ *
+ */
+public class ClientWrapper<I, O> implements Client<I, O> {
+ protected final Client<I, O> delegate;
+
+ protected ClientWrapper(final Client<I, O> delegate) {
+ this.delegate = delegate;
+ }
+
+ public void close() throws RemotingException {
+ delegate.close();
+ }
+
+ public void closeImmediate() throws RemotingException {
+ delegate.closeImmediate();
+ }
+
+ public void addCloseHandler(final CloseHandler<Client<I, O>>
closeHandler) {
+ delegate.addCloseHandler(new CloseHandler<Client<I, O>>() {
+ public void handleClose(final Client<I, O> closed) {
+ closeHandler.handleClose(ClientWrapper.this);
+ }
+ });
+ }
+
+ public O invoke(final I request) throws RemotingException, RemoteExecutionException
{
+ return delegate.invoke(request);
+ }
+
+ public FutureReply<O> send(final I request) throws RemotingException {
+ return delegate.send(request);
+ }
+
+ public void sendOneWay(final I request) throws RemotingException {
+ delegate.sendOneWay(request);
+ }
+
+ public ConcurrentMap<Object, Object> getAttributes() {
+ return delegate.getAttributes();
+ }
+
+}
Deleted:
remoting3/trunk/api/src/main/java/org/jboss/cx/remoting/spi/wrapper/ContextSourceWrapper.java
===================================================================
---
remoting3/trunk/api/src/main/java/org/jboss/cx/remoting/spi/wrapper/ContextSourceWrapper.java 2008-04-16
01:40:57 UTC (rev 3991)
+++
remoting3/trunk/api/src/main/java/org/jboss/cx/remoting/spi/wrapper/ContextSourceWrapper.java 2008-04-16
02:04:26 UTC (rev 3992)
@@ -1,37 +0,0 @@
-package org.jboss.cx.remoting.spi.wrapper;
-
-import org.jboss.cx.remoting.CloseHandler;
-import org.jboss.cx.remoting.Context;
-import org.jboss.cx.remoting.ContextSource;
-import org.jboss.cx.remoting.RemotingException;
-
-/**
- *
- */
-public class ContextSourceWrapper<I, O> implements ContextSource<I, O> {
- private final ContextSource<I, O> delegate;
-
- protected ContextSourceWrapper(ContextSource<I, O> delegate) {
- this.delegate = delegate;
- }
-
- public void close() throws RemotingException {
- delegate.close();
- }
-
- public void closeImmediate() throws RemotingException {
- delegate.closeImmediate();
- }
-
- public void addCloseHandler(final CloseHandler<ContextSource<I, O>>
closeHandler) {
- delegate.addCloseHandler(new CloseHandler<ContextSource<I, O>>() {
- public void handleClose(final ContextSource<I, O> closed) {
- closeHandler.handleClose(ContextSourceWrapper.this);
- }
- });
- }
-
- public Context<I, O> createContext() throws RemotingException {
- return delegate.createContext();
- }
-}
Deleted:
remoting3/trunk/api/src/main/java/org/jboss/cx/remoting/spi/wrapper/ContextWrapper.java
===================================================================
---
remoting3/trunk/api/src/main/java/org/jboss/cx/remoting/spi/wrapper/ContextWrapper.java 2008-04-16
01:40:57 UTC (rev 3991)
+++
remoting3/trunk/api/src/main/java/org/jboss/cx/remoting/spi/wrapper/ContextWrapper.java 2008-04-16
02:04:26 UTC (rev 3992)
@@ -1,52 +0,0 @@
-package org.jboss.cx.remoting.spi.wrapper;
-
-import java.util.concurrent.ConcurrentMap;
-import org.jboss.cx.remoting.CloseHandler;
-import org.jboss.cx.remoting.Context;
-import org.jboss.cx.remoting.FutureReply;
-import org.jboss.cx.remoting.RemoteExecutionException;
-import org.jboss.cx.remoting.RemotingException;
-
-/**
- *
- */
-public class ContextWrapper<I, O> implements Context<I, O> {
- protected final Context<I, O> delegate;
-
- protected ContextWrapper(final Context<I, O> delegate) {
- this.delegate = delegate;
- }
-
- public void close() throws RemotingException {
- delegate.close();
- }
-
- public void closeImmediate() throws RemotingException {
- delegate.closeImmediate();
- }
-
- public void addCloseHandler(final CloseHandler<Context<I, O>>
closeHandler) {
- delegate.addCloseHandler(new CloseHandler<Context<I, O>>() {
- public void handleClose(final Context<I, O> closed) {
- closeHandler.handleClose(ContextWrapper.this);
- }
- });
- }
-
- public O invoke(final I request) throws RemotingException, RemoteExecutionException
{
- return delegate.invoke(request);
- }
-
- public FutureReply<O> send(final I request) throws RemotingException {
- return delegate.send(request);
- }
-
- public void sendOneWay(final I request) throws RemotingException {
- delegate.sendOneWay(request);
- }
-
- public ConcurrentMap<Object, Object> getAttributes() {
- return delegate.getAttributes();
- }
-
-}
Modified:
remoting3/trunk/api/src/main/java/org/jboss/cx/remoting/spi/wrapper/EndpointWrapper.java
===================================================================
---
remoting3/trunk/api/src/main/java/org/jboss/cx/remoting/spi/wrapper/EndpointWrapper.java 2008-04-16
01:40:57 UTC (rev 3991)
+++
remoting3/trunk/api/src/main/java/org/jboss/cx/remoting/spi/wrapper/EndpointWrapper.java 2008-04-16
02:04:26 UTC (rev 3992)
@@ -3,8 +3,8 @@
import java.net.URI;
import java.util.concurrent.ConcurrentMap;
import org.jboss.cx.remoting.CloseHandler;
-import org.jboss.cx.remoting.Context;
-import org.jboss.cx.remoting.ContextSource;
+import org.jboss.cx.remoting.Client;
+import org.jboss.cx.remoting.ClientSource;
import org.jboss.cx.remoting.Endpoint;
import org.jboss.cx.remoting.RemotingException;
import org.jboss.cx.remoting.RequestListener;
@@ -46,11 +46,11 @@
return delegate.registerProtocol(scheme, protocolHandlerFactory);
}
- public <I, O> Context<I, O> createContext(final RequestListener<I,
O> requestListener) {
+ public <I, O> Client<I, O> createContext(final RequestListener<I,
O> requestListener) {
return delegate.createContext(requestListener);
}
- public <I, O> ContextSource<I, O> createService(final
RequestListener<I, O> requestListener) {
+ public <I, O> ClientSource<I, O> createService(final
RequestListener<I, O> requestListener) {
return delegate.createService(requestListener);
}
Modified:
remoting3/trunk/api/src/main/java/org/jboss/cx/remoting/spi/wrapper/RequestContextWrapper.java
===================================================================
---
remoting3/trunk/api/src/main/java/org/jboss/cx/remoting/spi/wrapper/RequestContextWrapper.java 2008-04-16
01:40:57 UTC (rev 3991)
+++
remoting3/trunk/api/src/main/java/org/jboss/cx/remoting/spi/wrapper/RequestContextWrapper.java 2008-04-16
02:04:26 UTC (rev 3992)
@@ -3,7 +3,7 @@
import org.jboss.cx.remoting.RemotingException;
import org.jboss.cx.remoting.RequestCancelHandler;
import org.jboss.cx.remoting.RequestContext;
-import org.jboss.cx.remoting.ContextContext;
+import org.jboss.cx.remoting.ClientContext;
/**
*
@@ -15,7 +15,7 @@
this.delegate = delegate;
}
- public ContextContext getContext() {
+ public ClientContext getContext() {
return delegate.getContext();
}
Modified:
remoting3/trunk/api/src/main/java/org/jboss/cx/remoting/spi/wrapper/SessionWrapper.java
===================================================================
---
remoting3/trunk/api/src/main/java/org/jboss/cx/remoting/spi/wrapper/SessionWrapper.java 2008-04-16
01:40:57 UTC (rev 3991)
+++
remoting3/trunk/api/src/main/java/org/jboss/cx/remoting/spi/wrapper/SessionWrapper.java 2008-04-16
02:04:26 UTC (rev 3992)
@@ -2,7 +2,7 @@
import java.util.concurrent.ConcurrentMap;
import org.jboss.cx.remoting.CloseHandler;
-import org.jboss.cx.remoting.Context;
+import org.jboss.cx.remoting.Client;
import org.jboss.cx.remoting.RemotingException;
import org.jboss.cx.remoting.Session;
@@ -44,7 +44,7 @@
return delegate.getRemoteEndpointName();
}
- public <I, O> Context<I, O> getRootContext() {
+ public <I, O> Client<I, O> getRootContext() {
return delegate.getRootContext();
}
}
Copied:
remoting3/trunk/core/src/main/java/org/jboss/cx/remoting/core/AbstractRealClient.java
(from rev 3985,
remoting3/trunk/core/src/main/java/org/jboss/cx/remoting/core/AbstractRealContext.java)
===================================================================
--- remoting3/trunk/core/src/main/java/org/jboss/cx/remoting/core/AbstractRealClient.java
(rev 0)
+++
remoting3/trunk/core/src/main/java/org/jboss/cx/remoting/core/AbstractRealClient.java 2008-04-16
02:04:26 UTC (rev 3992)
@@ -0,0 +1,22 @@
+package org.jboss.cx.remoting.core;
+
+import org.jboss.cx.remoting.Client;
+
+/**
+ *
+ */
+public abstract class AbstractRealClient<I, O> implements Client<I, O> {
+
+ private ClientResponder<I,O> clientResponder;
+
+ protected AbstractRealClient(final ClientResponder<I, O> clientResponder) {
+ if (clientResponder == null) {
+ throw new NullPointerException("clientResponder is null");
+ }
+ this.clientResponder = clientResponder;
+ }
+
+ protected ClientResponder<I, O> getContextServer() {
+ return clientResponder;
+ }
+}
Copied:
remoting3/trunk/core/src/main/java/org/jboss/cx/remoting/core/AbstractRealClientSource.java
(from rev 3985,
remoting3/trunk/core/src/main/java/org/jboss/cx/remoting/core/AbstractRealContextSource.java)
===================================================================
---
remoting3/trunk/core/src/main/java/org/jboss/cx/remoting/core/AbstractRealClientSource.java
(rev 0)
+++
remoting3/trunk/core/src/main/java/org/jboss/cx/remoting/core/AbstractRealClientSource.java 2008-04-16
02:04:26 UTC (rev 3992)
@@ -0,0 +1,21 @@
+package org.jboss.cx.remoting.core;
+
+import org.jboss.cx.remoting.ClientSource;
+
+/**
+ *
+ */
+public abstract class AbstractRealClientSource<I, O> implements ClientSource<I,
O> {
+ private ServiceResponder<I, O> serviceResponder;
+
+ protected AbstractRealClientSource(final ServiceResponder<I, O>
serviceResponder) {
+ if (serviceResponder == null) {
+ throw new NullPointerException("serviceResponder is null");
+ }
+ this.serviceResponder = serviceResponder;
+ }
+
+ public ServiceResponder<I, O> getServiceServer() {
+ return serviceResponder;
+ }
+}
Deleted:
remoting3/trunk/core/src/main/java/org/jboss/cx/remoting/core/AbstractRealContext.java
===================================================================
---
remoting3/trunk/core/src/main/java/org/jboss/cx/remoting/core/AbstractRealContext.java 2008-04-16
01:40:57 UTC (rev 3991)
+++
remoting3/trunk/core/src/main/java/org/jboss/cx/remoting/core/AbstractRealContext.java 2008-04-16
02:04:26 UTC (rev 3992)
@@ -1,22 +0,0 @@
-package org.jboss.cx.remoting.core;
-
-import org.jboss.cx.remoting.Context;
-
-/**
- *
- */
-public abstract class AbstractRealContext<I, O> implements Context<I, O> {
-
- private ContextServer<I,O> contextServer;
-
- protected AbstractRealContext(final ContextServer<I, O> contextServer) {
- if (contextServer == null) {
- throw new NullPointerException("contextServer is null");
- }
- this.contextServer = contextServer;
- }
-
- protected ContextServer<I, O> getContextServer() {
- return contextServer;
- }
-}
Deleted:
remoting3/trunk/core/src/main/java/org/jboss/cx/remoting/core/AbstractRealContextSource.java
===================================================================
---
remoting3/trunk/core/src/main/java/org/jboss/cx/remoting/core/AbstractRealContextSource.java 2008-04-16
01:40:57 UTC (rev 3991)
+++
remoting3/trunk/core/src/main/java/org/jboss/cx/remoting/core/AbstractRealContextSource.java 2008-04-16
02:04:26 UTC (rev 3992)
@@ -1,21 +0,0 @@
-package org.jboss.cx.remoting.core;
-
-import org.jboss.cx.remoting.ContextSource;
-
-/**
- *
- */
-public abstract class AbstractRealContextSource<I, O> implements
ContextSource<I, O> {
- private ServiceServer<I, O> serviceServer;
-
- protected AbstractRealContextSource(final ServiceServer<I, O> serviceServer) {
- if (serviceServer == null) {
- throw new NullPointerException("serviceServer is null");
- }
- this.serviceServer = serviceServer;
- }
-
- public ServiceServer<I, O> getServiceServer() {
- return serviceServer;
- }
-}
Copied: remoting3/trunk/core/src/main/java/org/jboss/cx/remoting/core/ClientInitiator.java
(from rev 3985,
remoting3/trunk/core/src/main/java/org/jboss/cx/remoting/core/ContextClient.java)
===================================================================
--- remoting3/trunk/core/src/main/java/org/jboss/cx/remoting/core/ClientInitiator.java
(rev 0)
+++
remoting3/trunk/core/src/main/java/org/jboss/cx/remoting/core/ClientInitiator.java 2008-04-16
02:04:26 UTC (rev 3992)
@@ -0,0 +1,10 @@
+package org.jboss.cx.remoting.core;
+
+import org.jboss.cx.remoting.RemotingException;
+
+/**
+ *
+ */
+public interface ClientInitiator {
+ void handleClosing(boolean done) throws RemotingException;
+}
Copied: remoting3/trunk/core/src/main/java/org/jboss/cx/remoting/core/ClientMarker.java
(from rev 3985,
remoting3/trunk/core/src/main/java/org/jboss/cx/remoting/core/ContextMarker.java)
===================================================================
--- remoting3/trunk/core/src/main/java/org/jboss/cx/remoting/core/ClientMarker.java
(rev 0)
+++
remoting3/trunk/core/src/main/java/org/jboss/cx/remoting/core/ClientMarker.java 2008-04-16
02:04:26 UTC (rev 3992)
@@ -0,0 +1,28 @@
+package org.jboss.cx.remoting.core;
+
+import java.io.Serializable;
+import org.jboss.cx.remoting.spi.protocol.ClientIdentifier;
+
+/**
+ *
+ */
+public final class ClientMarker implements Serializable {
+ private static final long serialVersionUID = 1L;
+
+ private ClientIdentifier clientIdentifer;
+
+ public ClientMarker() {
+ }
+
+ public ClientMarker(final ClientIdentifier clientIdentifer) {
+ this.clientIdentifer = clientIdentifer;
+ }
+
+ public ClientIdentifier getContextIdentifer() {
+ return clientIdentifer;
+ }
+
+ public void setContextIdentifer(final ClientIdentifier clientIdentifer) {
+ this.clientIdentifer = clientIdentifer;
+ }
+}
Copied: remoting3/trunk/core/src/main/java/org/jboss/cx/remoting/core/ClientResponder.java
(from rev 3985,
remoting3/trunk/core/src/main/java/org/jboss/cx/remoting/core/ContextServer.java)
===================================================================
--- remoting3/trunk/core/src/main/java/org/jboss/cx/remoting/core/ClientResponder.java
(rev 0)
+++
remoting3/trunk/core/src/main/java/org/jboss/cx/remoting/core/ClientResponder.java 2008-04-16
02:04:26 UTC (rev 3992)
@@ -0,0 +1,12 @@
+package org.jboss.cx.remoting.core;
+
+import org.jboss.cx.remoting.RemotingException;
+
+/**
+ *
+ */
+public interface ClientResponder<I, O> {
+ RequestResponder<I> createNewRequest(RequestInitiator<O>
requestInitiator) throws RemotingException;
+
+ void handleClose(boolean immediate, boolean cancel) throws RemotingException;
+}
Deleted: remoting3/trunk/core/src/main/java/org/jboss/cx/remoting/core/ContextClient.java
===================================================================
---
remoting3/trunk/core/src/main/java/org/jboss/cx/remoting/core/ContextClient.java 2008-04-16
01:40:57 UTC (rev 3991)
+++
remoting3/trunk/core/src/main/java/org/jboss/cx/remoting/core/ContextClient.java 2008-04-16
02:04:26 UTC (rev 3992)
@@ -1,10 +0,0 @@
-package org.jboss.cx.remoting.core;
-
-import org.jboss.cx.remoting.RemotingException;
-
-/**
- *
- */
-public interface ContextClient {
- void handleClosing(boolean done) throws RemotingException;
-}
Deleted: remoting3/trunk/core/src/main/java/org/jboss/cx/remoting/core/ContextMarker.java
===================================================================
---
remoting3/trunk/core/src/main/java/org/jboss/cx/remoting/core/ContextMarker.java 2008-04-16
01:40:57 UTC (rev 3991)
+++
remoting3/trunk/core/src/main/java/org/jboss/cx/remoting/core/ContextMarker.java 2008-04-16
02:04:26 UTC (rev 3992)
@@ -1,28 +0,0 @@
-package org.jboss.cx.remoting.core;
-
-import java.io.Serializable;
-import org.jboss.cx.remoting.spi.protocol.ContextIdentifier;
-
-/**
- *
- */
-public final class ContextMarker implements Serializable {
- private static final long serialVersionUID = 1L;
-
- private ContextIdentifier contextIdentifer;
-
- public ContextMarker() {
- }
-
- public ContextMarker(final ContextIdentifier contextIdentifer) {
- this.contextIdentifer = contextIdentifer;
- }
-
- public ContextIdentifier getContextIdentifer() {
- return contextIdentifer;
- }
-
- public void setContextIdentifer(final ContextIdentifier contextIdentifer) {
- this.contextIdentifer = contextIdentifer;
- }
-}
Deleted: remoting3/trunk/core/src/main/java/org/jboss/cx/remoting/core/ContextServer.java
===================================================================
---
remoting3/trunk/core/src/main/java/org/jboss/cx/remoting/core/ContextServer.java 2008-04-16
01:40:57 UTC (rev 3991)
+++
remoting3/trunk/core/src/main/java/org/jboss/cx/remoting/core/ContextServer.java 2008-04-16
02:04:26 UTC (rev 3992)
@@ -1,12 +0,0 @@
-package org.jboss.cx.remoting.core;
-
-import org.jboss.cx.remoting.RemotingException;
-
-/**
- *
- */
-public interface ContextServer<I, O> {
- RequestServer<I> createNewRequest(RequestClient<O> requestClient) throws
RemotingException;
-
- void handleClose(boolean immediate, boolean cancel) throws RemotingException;
-}
Modified: remoting3/trunk/core/src/main/java/org/jboss/cx/remoting/core/CoreEndpoint.java
===================================================================
---
remoting3/trunk/core/src/main/java/org/jboss/cx/remoting/core/CoreEndpoint.java 2008-04-16
01:40:57 UTC (rev 3991)
+++
remoting3/trunk/core/src/main/java/org/jboss/cx/remoting/core/CoreEndpoint.java 2008-04-16
02:04:26 UTC (rev 3992)
@@ -11,8 +11,8 @@
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import org.jboss.cx.remoting.CloseHandler;
-import org.jboss.cx.remoting.Context;
-import org.jboss.cx.remoting.ContextSource;
+import org.jboss.cx.remoting.Client;
+import org.jboss.cx.remoting.ClientSource;
import org.jboss.cx.remoting.Endpoint;
import org.jboss.cx.remoting.RemotingException;
import org.jboss.cx.remoting.RequestListener;
@@ -247,19 +247,19 @@
}
}
- public <I, O> Context<I, O> createContext(RequestListener<I, O>
requestListener) {
- final CoreInboundContext<I, O> inbound = new CoreInboundContext<I,
O>(requestListener, executor);
- final CoreOutboundContext<I, O> outbound = new
CoreOutboundContext<I, O>(executor);
+ public <I, O> Client<I, O> createContext(RequestListener<I, O>
requestListener) {
+ final CoreInboundClient<I, O> inbound = new CoreInboundClient<I,
O>(requestListener, executor);
+ final CoreOutboundClient<I, O> outbound = new CoreOutboundClient<I,
O>(executor);
inbound.initialize(outbound.getContextClient());
- outbound.initialize(inbound.getContextServer());
+ outbound.initialize(inbound.getClientResponder());
return outbound.getUserContext();
}
- public <I, O> ContextSource<I, O> createService(RequestListener<I,
O> requestListener) {
+ public <I, O> ClientSource<I, O> createService(RequestListener<I,
O> requestListener) {
final CoreInboundService<I, O> inbound = new CoreInboundService<I,
O>(requestListener, executor);
final CoreOutboundService<I, O> outbound = new
CoreOutboundService<I, O>(executor);
inbound.initialize(outbound.getServiceClient());
- outbound.initialize(inbound.getServiceServer());
+ outbound.initialize(inbound.getServiceResponder());
return outbound.getUserContextSource();
}
Copied:
remoting3/trunk/core/src/main/java/org/jboss/cx/remoting/core/CoreInboundClient.java (from
rev 3985,
remoting3/trunk/core/src/main/java/org/jboss/cx/remoting/core/CoreInboundContext.java)
===================================================================
--- remoting3/trunk/core/src/main/java/org/jboss/cx/remoting/core/CoreInboundClient.java
(rev 0)
+++
remoting3/trunk/core/src/main/java/org/jboss/cx/remoting/core/CoreInboundClient.java 2008-04-16
02:04:26 UTC (rev 3992)
@@ -0,0 +1,149 @@
+package org.jboss.cx.remoting.core;
+
+import java.util.Set;
+import java.util.concurrent.ConcurrentMap;
+import java.util.concurrent.Executor;
+import org.jboss.cx.remoting.CloseHandler;
+import org.jboss.cx.remoting.ClientContext;
+import org.jboss.cx.remoting.RemotingException;
+import org.jboss.cx.remoting.RequestListener;
+import org.jboss.cx.remoting.ServiceContext;
+import org.jboss.cx.remoting.log.Logger;
+import org.jboss.cx.remoting.util.AtomicStateMachine;
+import static org.jboss.cx.remoting.util.AtomicStateMachine.start;
+import org.jboss.cx.remoting.util.CollectionUtil;
+import static org.jboss.cx.remoting.util.CollectionUtil.synchronizedHashSet;
+
+/**
+ *
+ */
+public final class CoreInboundClient<I, O> {
+ private static final Logger log = Logger.getLogger(CoreInboundClient.class);
+
+ private final RequestListener<I, O> requestListener;
+ private final Executor executor;
+ private final ServiceContext serviceContext;
+ private final Set<CoreInboundRequest<I, O>> requests =
synchronizedHashSet();
+ private final AtomicStateMachine<State> state = start(State.NEW);
+ private final ClientContext clientContext = new UserClientContext();
+
+ private ClientInitiator clientInitiator;
+ private ConcurrentMap<Object, Object> attributes =
CollectionUtil.concurrentMap();
+
+ private enum State implements org.jboss.cx.remoting.util.State<State> {
+ NEW,
+ UP,
+ STOPPING,
+ DOWN;
+
+ public boolean isReachable(final State dest) {
+ return compareTo(dest) < 0;
+ }
+ }
+
+ public CoreInboundClient(final RequestListener<I, O> requestListener, final
Executor executor) {
+ this.requestListener = requestListener;
+ this.executor = executor;
+ serviceContext = null;
+ }
+
+ public CoreInboundClient(final RequestListener<I, O> requestListener, final
Executor executor, final ServiceContext serviceContext) {
+ this.requestListener = requestListener;
+ this.executor = executor;
+ this.serviceContext = serviceContext;
+ }
+
+ public ClientResponder<I, O> getClientResponder() {
+ return new Responder();
+ }
+
+ public void initialize(final ClientInitiator clientInitiator) {
+ state.requireTransitionExclusive(State.NEW, State.UP);
+ this.clientInitiator = clientInitiator;
+ state.releaseDowngrade();
+ try {
+ requestListener.handleClientOpen(clientContext);
+ } finally {
+ state.release();
+ }
+ }
+
+ public void remove(final CoreInboundRequest<I, O> request) {
+ final State current = state.getStateHold();
+ try {
+ requests.remove(request);
+ if (current != State.STOPPING) {
+ return;
+ }
+ } finally {
+ state.release();
+ }
+ if (requests.isEmpty()) {
+ state.transition(State.STOPPING, State.DOWN);
+ }
+ }
+
+ // Accessors
+
+ public ClientContext getClientContext() {
+ return clientContext;
+ }
+
+ // Support classes
+
+ public final class Responder implements ClientResponder<I, O> {
+ private Responder() {
+ }
+
+ public RequestResponder<I> createNewRequest(final RequestInitiator<O>
requestInitiator) throws RemotingException {
+ if (state.inHold(State.UP)) try {
+ final CoreInboundRequest<I, O> inboundRequest = new
CoreInboundRequest<I, O>(requestListener, executor, clientContext);
+ inboundRequest.initialize(requestInitiator);
+ requests.add(inboundRequest);
+ return inboundRequest.getRequestResponder();
+ } finally {
+ state.release();
+ } else {
+ throw new RemotingException("Client is not up");
+ }
+ }
+
+ public void handleClose(final boolean immediate, final boolean cancel) throws
RemotingException {
+ if (state.transition(State.UP, State.STOPPING)) {
+ clientInitiator.handleClosing(false);
+ if (immediate || cancel) {
+ for (CoreInboundRequest<I, O> inboundRequest : requests) {
+ try {
+
inboundRequest.getRequestResponder().handleCancelRequest(immediate );
+ } catch (Exception e) {
+ log.trace("Failed to notify inbound request of
cancellation upon context close: %s", e);
+ }
+ }
+ }
+ }
+ }
+ }
+
+ public final class UserClientContext implements ClientContext {
+ private UserClientContext() {
+ }
+
+ public ConcurrentMap<Object, Object> getAttributes() {
+ return attributes;
+ }
+
+ public ServiceContext getServiceContext() {
+ return serviceContext;
+ }
+
+ public void close() throws RemotingException {
+ clientInitiator.handleClosing(false);
+ }
+
+ public void closeImmediate() throws RemotingException {
+ }
+
+ public void addCloseHandler(final CloseHandler<ClientContext>
contextContextCloseHandler) {
+ }
+ }
+}
Deleted:
remoting3/trunk/core/src/main/java/org/jboss/cx/remoting/core/CoreInboundContext.java
===================================================================
---
remoting3/trunk/core/src/main/java/org/jboss/cx/remoting/core/CoreInboundContext.java 2008-04-16
01:40:57 UTC (rev 3991)
+++
remoting3/trunk/core/src/main/java/org/jboss/cx/remoting/core/CoreInboundContext.java 2008-04-16
02:04:26 UTC (rev 3992)
@@ -1,149 +0,0 @@
-package org.jboss.cx.remoting.core;
-
-import java.util.Set;
-import java.util.concurrent.ConcurrentMap;
-import java.util.concurrent.Executor;
-import org.jboss.cx.remoting.CloseHandler;
-import org.jboss.cx.remoting.ContextContext;
-import org.jboss.cx.remoting.RemotingException;
-import org.jboss.cx.remoting.RequestListener;
-import org.jboss.cx.remoting.ServiceContext;
-import org.jboss.cx.remoting.log.Logger;
-import org.jboss.cx.remoting.util.AtomicStateMachine;
-import static org.jboss.cx.remoting.util.AtomicStateMachine.start;
-import org.jboss.cx.remoting.util.CollectionUtil;
-import static org.jboss.cx.remoting.util.CollectionUtil.synchronizedHashSet;
-
-/**
- *
- */
-public final class CoreInboundContext<I, O> {
- private static final Logger log = Logger.getLogger(CoreInboundContext.class);
-
- private final RequestListener<I, O> requestListener;
- private final Executor executor;
- private final ServiceContext serviceContext;
- private final Set<CoreInboundRequest<I, O>> requests =
synchronizedHashSet();
- private final AtomicStateMachine<State> state = start(State.NEW);
- private final ContextContext contextContext = new UserContextContext();
-
- private ContextClient contextClient;
- private ConcurrentMap<Object, Object> attributes =
CollectionUtil.concurrentMap();
-
- private enum State implements org.jboss.cx.remoting.util.State<State> {
- NEW,
- UP,
- STOPPING,
- DOWN;
-
- public boolean isReachable(final State dest) {
- return compareTo(dest) < 0;
- }
- }
-
- public CoreInboundContext(final RequestListener<I, O> requestListener, final
Executor executor) {
- this.requestListener = requestListener;
- this.executor = executor;
- serviceContext = null;
- }
-
- public CoreInboundContext(final RequestListener<I, O> requestListener, final
Executor executor, final ServiceContext serviceContext) {
- this.requestListener = requestListener;
- this.executor = executor;
- this.serviceContext = serviceContext;
- }
-
- public ContextServer<I, O> getContextServer() {
- return new Server();
- }
-
- public void initialize(final ContextClient contextClient) {
- state.requireTransitionExclusive(State.NEW, State.UP);
- this.contextClient = contextClient;
- state.releaseDowngrade();
- try {
- requestListener.handleContextOpen(contextContext);
- } finally {
- state.release();
- }
- }
-
- public void remove(final CoreInboundRequest<I, O> request) {
- final State current = state.getStateHold();
- try {
- requests.remove(request);
- if (current != State.STOPPING) {
- return;
- }
- } finally {
- state.release();
- }
- if (requests.isEmpty()) {
- state.transition(State.STOPPING, State.DOWN);
- }
- }
-
- // Accessors
-
- public ContextContext getContextContext() {
- return contextContext;
- }
-
- // Support classes
-
- public final class Server implements ContextServer<I, O> {
- private Server() {
- }
-
- public RequestServer<I> createNewRequest(final RequestClient<O>
requestClient) throws RemotingException {
- if (state.inHold(State.UP)) try {
- final CoreInboundRequest<I, O> inboundRequest = new
CoreInboundRequest<I, O>(requestListener, executor, contextContext);
- inboundRequest.initialize(requestClient);
- requests.add(inboundRequest);
- return inboundRequest.getRequester();
- } finally {
- state.release();
- } else {
- throw new RemotingException("Context is not up");
- }
- }
-
- public void handleClose(final boolean immediate, final boolean cancel) throws
RemotingException {
- if (state.transition(State.UP, State.STOPPING)) {
- contextClient.handleClosing(false);
- if (immediate || cancel) {
- for (CoreInboundRequest<I, O> inboundRequest : requests) {
- try {
- inboundRequest.getRequester().handleCancelRequest(immediate
);
- } catch (Exception e) {
- log.trace("Failed to notify inbound request of
cancellation upon context close: %s", e);
- }
- }
- }
- }
- }
- }
-
- public final class UserContextContext implements ContextContext {
- private UserContextContext() {
- }
-
- public ConcurrentMap<Object, Object> getAttributes() {
- return attributes;
- }
-
- public ServiceContext getServiceContext() {
- return serviceContext;
- }
-
- public void close() throws RemotingException {
- contextClient.handleClosing(false);
- }
-
- public void closeImmediate() throws RemotingException {
- }
-
- public void addCloseHandler(final CloseHandler<ContextContext>
contextContextCloseHandler) {
- }
- }
-}
Modified:
remoting3/trunk/core/src/main/java/org/jboss/cx/remoting/core/CoreInboundRequest.java
===================================================================
---
remoting3/trunk/core/src/main/java/org/jboss/cx/remoting/core/CoreInboundRequest.java 2008-04-16
01:40:57 UTC (rev 3991)
+++
remoting3/trunk/core/src/main/java/org/jboss/cx/remoting/core/CoreInboundRequest.java 2008-04-16
02:04:26 UTC (rev 3992)
@@ -11,7 +11,7 @@
import org.jboss.cx.remoting.RequestCancelHandler;
import org.jboss.cx.remoting.RequestContext;
import org.jboss.cx.remoting.RequestListener;
-import org.jboss.cx.remoting.ContextContext;
+import org.jboss.cx.remoting.ClientContext;
import org.jboss.cx.remoting.log.Logger;
import org.jboss.cx.remoting.util.AtomicStateMachine;
@@ -23,13 +23,13 @@
private final RequestListener<I,O> requestListener;
private final Executor executor;
- private final ContextContext contextContext;
+ private final ClientContext clientContext;
private final AtomicStateMachine<State> state =
AtomicStateMachine.start(State.INITIAL);
private final UserRequestContext userRequestContext = new UserRequestContext();
- private final RequestServer<I> request = new Request();
+ private final RequestResponder<I> request = new Request();
- private RequestClient<O> requestClient;
+ private RequestInitiator<O> requestInitiator;
/**
* @protectedby {@code this}
@@ -48,10 +48,10 @@
*/
private List<RequestCancelHandler<O>> cancelHandlers;
- public CoreInboundRequest(final RequestListener<I, O> requestListener, final
Executor executor, final ContextContext contextContext) {
+ public CoreInboundRequest(final RequestListener<I, O> requestListener, final
Executor executor, final ClientContext clientContext) {
this.requestListener = requestListener;
this.executor = executor;
- this.contextContext = contextContext;
+ this.clientContext = clientContext;
}
private enum State implements org.jboss.cx.remoting.util.State<State> {
@@ -65,13 +65,13 @@
}
}
- public void initialize(final RequestClient<O> requestClient) {
+ public void initialize(final RequestInitiator<O> requestInitiator) {
state.requireTransitionExclusive(State.INITIAL, State.UNSENT);
- this.requestClient = requestClient;
+ this.requestInitiator = requestInitiator;
state.releaseExclusive();
}
- public RequestServer<I> getRequester() {
+ public RequestResponder<I> getRequestResponder() {
return request;
}
@@ -101,7 +101,7 @@
});
}
- public final class Request implements RequestServer<I> {
+ public final class Request implements RequestResponder<I> {
public void handleCancelRequest(final boolean mayInterrupt) {
synchronized(CoreInboundRequest.this) {
if (! cancel) {
@@ -143,17 +143,17 @@
if (state.transition(State.UNSENT, State.SENT)) {
if (wasCancelled) {
try {
- requestClient.handleCancelAcknowledge();
+ requestInitiator.handleCancelAcknowledge();
} catch (RemotingException e1) {
try {
- requestClient.handleException(new
RemoteExecutionException("Failed to send a cancel ack to client: " +
e1.toString(), e1));
+ requestInitiator.handleException(new
RemoteExecutionException("Failed to send a cancel ack to client: " +
e1.toString(), e1));
} catch (RemotingException e2) {
log.debug("Tried and failed to send an
exception (%s): %s", e1, e2);
}
}
} else {
try {
- requestClient.handleException(new
RemoteExecutionException("Execution failed: " + e.toString(), e));
+ requestInitiator.handleException(new
RemoteExecutionException("Execution failed: " + e.toString(), e));
} catch (RemotingException e1) {
log.debug("Tried and failed to send an exception
(%s): %s", e, e1);
}
@@ -164,9 +164,9 @@
if (state.transition(State.UNSENT, State.SENT)) {
try {
if (e instanceof RemoteExecutionException) {
-
requestClient.handleException((RemoteExecutionException) e);
+
requestInitiator.handleException((RemoteExecutionException) e);
} else {
- requestClient.handleException(new
RemoteExecutionException("Execution failed: " + e.toString(), e));
+ requestInitiator.handleException(new
RemoteExecutionException("Execution failed: " + e.toString(), e));
}
} catch (RemotingException e1) {
log.debug("Tried and failed to send an exception
(%s): %s", e, e1);
@@ -182,8 +182,8 @@
public final class UserRequestContext implements RequestContext<O> {
private UserRequestContext() {}
- public ContextContext getContext() {
- return contextContext;
+ public ClientContext getContext() {
+ return clientContext;
}
public boolean isCancelled() {
@@ -194,19 +194,19 @@
public void sendReply(final O reply) throws RemotingException,
IllegalStateException {
state.requireTransition(State.UNSENT, State.SENT);
- requestClient.handleReply(reply);
+ requestInitiator.handleReply(reply);
}
public void sendFailure(final String msg, final Throwable cause) throws
RemotingException, IllegalStateException {
state.requireTransition(State.UNSENT, State.SENT);
final RemoteExecutionException rex = new RemoteExecutionException(msg,
cause);
rex.setStackTrace(cause.getStackTrace());
- requestClient.handleException(rex);
+ requestInitiator.handleException(rex);
}
public void sendCancelled() throws RemotingException, IllegalStateException {
state.requireTransition(State.UNSENT, State.SENT);
- requestClient.handleCancelAcknowledge();
+ requestInitiator.handleCancelAcknowledge();
}
public void addCancelHandler(final RequestCancelHandler<O>
requestCancelHandler) {
Modified:
remoting3/trunk/core/src/main/java/org/jboss/cx/remoting/core/CoreInboundService.java
===================================================================
---
remoting3/trunk/core/src/main/java/org/jboss/cx/remoting/core/CoreInboundService.java 2008-04-16
01:40:57 UTC (rev 3991)
+++
remoting3/trunk/core/src/main/java/org/jboss/cx/remoting/core/CoreInboundService.java 2008-04-16
02:04:26 UTC (rev 3992)
@@ -24,7 +24,7 @@
private final AtomicStateMachine<State> state = start(State.INITIAL);
private final ConcurrentMap<Object, Object> attributes =
CollectionUtil.concurrentMap();
- private ServiceClient serviceClient;
+ private ServiceInitiator serviceInitiator;
private final Set<CloseHandler<ServiceContext>> closeHandlers =
CollectionUtil.synchronizedSet(new
LinkedHashSet<CloseHandler<ServiceContext>>());
private enum State implements org.jboss.cx.remoting.util.State<State> {
@@ -42,9 +42,9 @@
this.executor = executor;
}
- public void initialize(final ServiceClient serviceClient) {
+ public void initialize(final ServiceInitiator serviceInitiator) {
state.requireTransitionExclusive(State.INITIAL, State.UP);
- this.serviceClient = serviceClient;
+ this.serviceInitiator = serviceInitiator;
state.releaseDowngrade();
try {
requestListener.handleServiceOpen(serviceContext);
@@ -68,16 +68,16 @@
}
}
- public ServiceServer<I, O> getServiceServer() {
- return new ServiceServer<I, O>() {
+ public ServiceResponder<I, O> getServiceResponder() {
+ return new ServiceResponder<I, O>() {
public void handleClose() throws RemotingException {
doClose();
}
- public ContextServer<I, O> createNewContext(final ContextClient client)
{
- final CoreInboundContext<I, O> context = new
CoreInboundContext<I, O>(requestListener, executor, serviceContext);
- context.initialize(client);
- return context.getContextServer();
+ public ClientResponder<I, O> createNewClient(final ClientInitiator
clientInitiator) {
+ final CoreInboundClient<I, O> client = new CoreInboundClient<I,
O>(requestListener, executor, serviceContext);
+ client.initialize(clientInitiator);
+ return client.getClientResponder();
}
};
}
@@ -92,12 +92,12 @@
public void close() throws RemotingException {
doClose();
- serviceClient.handleClosing();
+ serviceInitiator.handleClosing();
}
public void closeImmediate() throws RemotingException {
doClose();
- serviceClient.handleClosing();
+ serviceInitiator.handleClosing();
}
public void addCloseHandler(final CloseHandler<ServiceContext>
closeHandler) {
Copied:
remoting3/trunk/core/src/main/java/org/jboss/cx/remoting/core/CoreOutboundClient.java
(from rev 3985,
remoting3/trunk/core/src/main/java/org/jboss/cx/remoting/core/CoreOutboundContext.java)
===================================================================
--- remoting3/trunk/core/src/main/java/org/jboss/cx/remoting/core/CoreOutboundClient.java
(rev 0)
+++
remoting3/trunk/core/src/main/java/org/jboss/cx/remoting/core/CoreOutboundClient.java 2008-04-16
02:04:26 UTC (rev 3992)
@@ -0,0 +1,180 @@
+package org.jboss.cx.remoting.core;
+
+import java.util.LinkedHashSet;
+import java.util.Set;
+import java.util.concurrent.ConcurrentMap;
+import java.util.concurrent.Executor;
+import org.jboss.cx.remoting.CloseHandler;
+import org.jboss.cx.remoting.Client;
+import org.jboss.cx.remoting.FutureReply;
+import org.jboss.cx.remoting.RemoteExecutionException;
+import org.jboss.cx.remoting.RemotingException;
+import org.jboss.cx.remoting.RequestCompletionHandler;
+import org.jboss.cx.remoting.core.util.QueueExecutor;
+import org.jboss.cx.remoting.log.Logger;
+import org.jboss.cx.remoting.util.AtomicStateMachine;
+import org.jboss.cx.remoting.util.CollectionUtil;
+
+/**
+ *
+ */
+public final class CoreOutboundClient<I, O> {
+ private static final Logger log = Logger.getLogger(CoreOutboundClient.class);
+
+ private final ConcurrentMap<Object, Object> contextMap =
CollectionUtil.concurrentMap();
+ private final AtomicStateMachine<State> state =
AtomicStateMachine.start(State.INITIAL);
+ private final ClientInitiator clientInitiator = new ClientInitiatorImpl();
+ private final Set<CloseHandler<Client<I, O>>> closeHandlers =
CollectionUtil.synchronizedSet(new LinkedHashSet<CloseHandler<Client<I,
O>>>());
+ private final Executor executor;
+
+ private Client<I, O> userClient;
+ private ClientResponder<I, O> clientResponder;
+
+ public CoreOutboundClient(final Executor executor) {
+ this.executor = executor;
+ }
+
+ public void initialize(final ClientResponder<I, O> clientResponder) {
+ state.requireTransitionExclusive(State.INITIAL, State.UP);
+ this.clientResponder = clientResponder;
+ userClient = new UserClient();
+ state.releaseExclusive();
+ }
+
+ private enum State implements org.jboss.cx.remoting.util.State<State> {
+ INITIAL,
+ UP,
+ STOPPING,
+ DOWN,;
+
+ public boolean isReachable(final State dest) {
+ return compareTo(dest) < 0;
+ }
+ }
+
+ // Getters
+
+ Client<I,O> getUserContext() {
+ return userClient;
+ }
+
+ ClientInitiator getContextClient() {
+ return clientInitiator;
+ }
+
+ // Other mgmt
+
+ protected void finalize() throws Throwable {
+ try {
+ super.finalize();
+ } finally {
+ // todo close it
+ log.trace("Leaked a context instance: %s", this);
+ }
+ }
+
+ public final class UserClient extends AbstractRealClient<I, O> {
+
+ private UserClient() {
+ super(clientResponder);
+ }
+
+ private void doClose(final boolean immediate, final boolean cancel) throws
RemotingException {
+ state.waitForNot(State.INITIAL);
+ if (state.transitionHold(State.UP, State.STOPPING)) try {
+ synchronized (closeHandlers) {
+ for (final CloseHandler<Client<I, O>> handler :
closeHandlers) {
+ executor.execute(new Runnable() {
+ public void run() {
+ handler.handleClose(UserClient.this);
+ }
+ });
+ }
+ closeHandlers.clear();
+ }
+ clientResponder.handleClose(immediate, cancel);
+ } finally {
+ state.release();
+ }
+ }
+
+ public void close() throws RemotingException {
+ doClose(false, false);
+ }
+
+ public void closeImmediate() throws RemotingException {
+ doClose(true, true);
+ }
+
+ public void addCloseHandler(final CloseHandler<Client<I, O>>
closeHandler) {
+ final State current = state.getStateHold();
+ try {
+ switch (current) {
+ case STOPPING:
+ case DOWN:
+ closeHandler.handleClose(this);
+ break;
+ default:
+ closeHandlers.add(closeHandler);
+ break;
+ }
+ } finally {
+ state.release();
+ }
+ }
+
+ public O invoke(final I request) throws RemotingException,
RemoteExecutionException {
+ state.requireHold(State.UP);
+ try {
+ final QueueExecutor queueExecutor = new QueueExecutor();
+ final CoreOutboundRequest<I, O> outboundRequest = new
CoreOutboundRequest<I, O>();
+ final RequestResponder<I> requestTerminus =
clientResponder.createNewRequest(outboundRequest.getReplier());
+ outboundRequest.setRequester(requestTerminus);
+ requestTerminus.handleRequest(request, queueExecutor);
+ final FutureReply<O> futureReply =
outboundRequest.getFutureReply();
+ futureReply.addCompletionNotifier(new RequestCompletionHandler<O>()
{
+ public void notifyComplete(final FutureReply<O> futureReply) {
+ queueExecutor.shutdown();
+ }
+ });
+ queueExecutor.runQueue();
+ return futureReply.get();
+ } finally {
+ state.release();
+ }
+ }
+
+ public FutureReply<O> send(final I request) throws RemotingException {
+ state.requireHold(State.UP);
+ try {
+ final CoreOutboundRequest<I, O> outboundRequest = new
CoreOutboundRequest<I, O>();
+ final RequestResponder<I> requestTerminus =
clientResponder.createNewRequest(outboundRequest.getReplier());
+ outboundRequest.setRequester(requestTerminus);
+ requestTerminus.handleRequest(request, executor);
+ return outboundRequest.getFutureReply();
+ } finally {
+ state.release();
+ }
+ }
+
+ public void sendOneWay(final I request) throws RemotingException {
+ state.requireHold(State.UP);
+ try {
+ final RequestResponder<I> requestResponder =
clientResponder.createNewRequest(null);
+ requestResponder.handleRequest(request, executor);
+ } finally {
+ state.release();
+ }
+ }
+
+ public ConcurrentMap<Object, Object> getAttributes() {
+ return contextMap;
+ }
+ }
+
+ public final class ClientInitiatorImpl implements ClientInitiator {
+ public void handleClosing(boolean done) throws RemotingException {
+ // todo - remote side is closing
+ }
+ }
+}
Deleted:
remoting3/trunk/core/src/main/java/org/jboss/cx/remoting/core/CoreOutboundContext.java
===================================================================
---
remoting3/trunk/core/src/main/java/org/jboss/cx/remoting/core/CoreOutboundContext.java 2008-04-16
01:40:57 UTC (rev 3991)
+++
remoting3/trunk/core/src/main/java/org/jboss/cx/remoting/core/CoreOutboundContext.java 2008-04-16
02:04:26 UTC (rev 3992)
@@ -1,180 +0,0 @@
-package org.jboss.cx.remoting.core;
-
-import java.util.LinkedHashSet;
-import java.util.Set;
-import java.util.concurrent.ConcurrentMap;
-import java.util.concurrent.Executor;
-import org.jboss.cx.remoting.CloseHandler;
-import org.jboss.cx.remoting.Context;
-import org.jboss.cx.remoting.FutureReply;
-import org.jboss.cx.remoting.RemoteExecutionException;
-import org.jboss.cx.remoting.RemotingException;
-import org.jboss.cx.remoting.RequestCompletionHandler;
-import org.jboss.cx.remoting.core.util.QueueExecutor;
-import org.jboss.cx.remoting.log.Logger;
-import org.jboss.cx.remoting.util.AtomicStateMachine;
-import org.jboss.cx.remoting.util.CollectionUtil;
-
-/**
- *
- */
-public final class CoreOutboundContext<I, O> {
- private static final Logger log = Logger.getLogger(CoreOutboundContext.class);
-
- private final ConcurrentMap<Object, Object> contextMap =
CollectionUtil.concurrentMap();
- private final AtomicStateMachine<State> state =
AtomicStateMachine.start(State.INITIAL);
- private final ContextClient contextClient = new ContextClientImpl();
- private final Set<CloseHandler<Context<I, O>>> closeHandlers =
CollectionUtil.synchronizedSet(new LinkedHashSet<CloseHandler<Context<I,
O>>>());
- private final Executor executor;
-
- private Context<I, O> userContext;
- private ContextServer<I, O> contextServer;
-
- public CoreOutboundContext(final Executor executor) {
- this.executor = executor;
- }
-
- public void initialize(final ContextServer<I, O> contextServer) {
- state.requireTransitionExclusive(State.INITIAL, State.UP);
- this.contextServer = contextServer;
- userContext = new UserContext();
- state.releaseExclusive();
- }
-
- private enum State implements org.jboss.cx.remoting.util.State<State> {
- INITIAL,
- UP,
- STOPPING,
- DOWN,;
-
- public boolean isReachable(final State dest) {
- return compareTo(dest) < 0;
- }
- }
-
- // Getters
-
- Context<I,O> getUserContext() {
- return userContext;
- }
-
- ContextClient getContextClient() {
- return contextClient;
- }
-
- // Other mgmt
-
- protected void finalize() throws Throwable {
- try {
- super.finalize();
- } finally {
- // todo close it
- log.trace("Leaked a context instance: %s", this);
- }
- }
-
- public final class UserContext extends AbstractRealContext<I, O> {
-
- private UserContext() {
- super(contextServer);
- }
-
- private void doClose(final boolean immediate, final boolean cancel) throws
RemotingException {
- state.waitForNot(State.INITIAL);
- if (state.transitionHold(State.UP, State.STOPPING)) try {
- synchronized (closeHandlers) {
- for (final CloseHandler<Context<I, O>> handler :
closeHandlers) {
- executor.execute(new Runnable() {
- public void run() {
- handler.handleClose(UserContext.this);
- }
- });
- }
- closeHandlers.clear();
- }
- contextServer.handleClose(immediate, cancel);
- } finally {
- state.release();
- }
- }
-
- public void close() throws RemotingException {
- doClose(false, false);
- }
-
- public void closeImmediate() throws RemotingException {
- doClose(true, true);
- }
-
- public void addCloseHandler(final CloseHandler<Context<I, O>>
closeHandler) {
- final State current = state.getStateHold();
- try {
- switch (current) {
- case STOPPING:
- case DOWN:
- closeHandler.handleClose(this);
- break;
- default:
- closeHandlers.add(closeHandler);
- break;
- }
- } finally {
- state.release();
- }
- }
-
- public O invoke(final I request) throws RemotingException,
RemoteExecutionException {
- state.requireHold(State.UP);
- try {
- final QueueExecutor queueExecutor = new QueueExecutor();
- final CoreOutboundRequest<I, O> outboundRequest = new
CoreOutboundRequest<I, O>();
- final RequestServer<I> requestTerminus =
contextServer.createNewRequest(outboundRequest.getReplier());
- outboundRequest.setRequester(requestTerminus);
- requestTerminus.handleRequest(request, queueExecutor);
- final FutureReply<O> futureReply =
outboundRequest.getFutureReply();
- futureReply.addCompletionNotifier(new RequestCompletionHandler<O>()
{
- public void notifyComplete(final FutureReply<O> futureReply) {
- queueExecutor.shutdown();
- }
- });
- queueExecutor.runQueue();
- return futureReply.get();
- } finally {
- state.release();
- }
- }
-
- public FutureReply<O> send(final I request) throws RemotingException {
- state.requireHold(State.UP);
- try {
- final CoreOutboundRequest<I, O> outboundRequest = new
CoreOutboundRequest<I, O>();
- final RequestServer<I> requestTerminus =
contextServer.createNewRequest(outboundRequest.getReplier());
- outboundRequest.setRequester(requestTerminus);
- requestTerminus.handleRequest(request, executor);
- return outboundRequest.getFutureReply();
- } finally {
- state.release();
- }
- }
-
- public void sendOneWay(final I request) throws RemotingException {
- state.requireHold(State.UP);
- try {
- final RequestServer<I> requestServer =
contextServer.createNewRequest(null);
- requestServer.handleRequest(request, executor);
- } finally {
- state.release();
- }
- }
-
- public ConcurrentMap<Object, Object> getAttributes() {
- return contextMap;
- }
- }
-
- public final class ContextClientImpl implements ContextClient {
- public void handleClosing(boolean done) throws RemotingException {
- // todo - remote side is closing
- }
- }
-}
Modified:
remoting3/trunk/core/src/main/java/org/jboss/cx/remoting/core/CoreOutboundRequest.java
===================================================================
---
remoting3/trunk/core/src/main/java/org/jboss/cx/remoting/core/CoreOutboundRequest.java 2008-04-16
01:40:57 UTC (rev 3991)
+++
remoting3/trunk/core/src/main/java/org/jboss/cx/remoting/core/CoreOutboundRequest.java 2008-04-16
02:04:26 UTC (rev 3992)
@@ -21,9 +21,9 @@
private static final Logger log = Logger.getLogger(CoreOutboundRequest.class);
- private RequestServer<I> requestServer;
+ private RequestResponder<I> requestResponder;
- private final RequestClient<O> requestClient = new RequestClientImpl();
+ private final RequestInitiator<O> requestInitiator = new
RequestInitiatorImpl();
private final AtomicStateMachine<State> state =
AtomicStateMachine.start(State.WAITING);
private final FutureReply<O> futureReply = new FutureReplyImpl();
@@ -37,20 +37,20 @@
public CoreOutboundRequest() {
}
- public RequestServer<I> getRequester() {
- return requestServer;
+ public RequestResponder<I> getRequester() {
+ return requestResponder;
}
- public void setRequester(final RequestServer<I> requestServer) {
- this.requestServer = requestServer;
+ public void setRequester(final RequestResponder<I> requestResponder) {
+ this.requestResponder = requestResponder;
}
public FutureReply<O> getFutureReply() {
return futureReply;
}
- public RequestClient<O> getReplier() {
- return requestClient;
+ public RequestInitiator<O> getReplier() {
+ return requestInitiator;
}
private enum State implements org.jboss.cx.remoting.util.State<State> {
@@ -91,7 +91,7 @@
}
}
- public final class RequestClientImpl implements RequestClient<O> {
+ public final class RequestInitiatorImpl implements RequestInitiator<O> {
public void handleCancelAcknowledge() {
if (state.transitionHold(State.WAITING, State.CANCELLED)) try {
complete();
@@ -135,7 +135,7 @@
public boolean cancel(final boolean mayInterruptIfRunning) {
if (state.inHold(State.WAITING)) try {
try {
- requestServer.handleCancelRequest(mayInterruptIfRunning);
+ requestResponder.handleCancelRequest(mayInterruptIfRunning);
} catch (RemotingException e) {
return false;
}
@@ -148,7 +148,7 @@
public FutureReply<O> sendCancel(final boolean mayInterruptIfRunning) {
if (state.inHold(State.WAITING)) try {
try {
- requestServer.handleCancelRequest(mayInterruptIfRunning);
+ requestResponder.handleCancelRequest(mayInterruptIfRunning);
} catch (RemotingException e) {
// do nothing
}
Modified:
remoting3/trunk/core/src/main/java/org/jboss/cx/remoting/core/CoreOutboundService.java
===================================================================
---
remoting3/trunk/core/src/main/java/org/jboss/cx/remoting/core/CoreOutboundService.java 2008-04-16
01:40:57 UTC (rev 3991)
+++
remoting3/trunk/core/src/main/java/org/jboss/cx/remoting/core/CoreOutboundService.java 2008-04-16
02:04:26 UTC (rev 3992)
@@ -4,8 +4,8 @@
import java.util.Set;
import java.util.concurrent.Executor;
import org.jboss.cx.remoting.CloseHandler;
-import org.jboss.cx.remoting.Context;
-import org.jboss.cx.remoting.ContextSource;
+import org.jboss.cx.remoting.Client;
+import org.jboss.cx.remoting.ClientSource;
import org.jboss.cx.remoting.RemotingException;
import org.jboss.cx.remoting.log.Logger;
import org.jboss.cx.remoting.util.AtomicStateMachine;
@@ -18,12 +18,12 @@
private static final Logger log = Logger.getLogger(CoreOutboundService.class);
private final AtomicStateMachine<State> state =
AtomicStateMachine.start(State.INITIAL);
- private final ContextSource<I, O> userContextSource = new UserContextSource();
- private final ServiceClient serviceClient = new ServiceClientImpl();
+ private final ClientSource<I, O> userClientSource = new UserClientSource();
+ private final ServiceInitiator serviceInitiator = new ServiceInitiatorImpl();
private final Executor executor;
- private ServiceServer<I,O> serviceServer;
- private Set<CloseHandler<ContextSource<I,O>>> closeHandlers =
CollectionUtil.synchronizedSet(new LinkedHashSet<CloseHandler<ContextSource<I,
O>>>());
+ private ServiceResponder<I,O> serviceResponder;
+ private Set<CloseHandler<ClientSource<I,O>>> closeHandlers =
CollectionUtil.synchronizedSet(new LinkedHashSet<CloseHandler<ClientSource<I,
O>>>());
public CoreOutboundService(final Executor executor) {
this.executor = executor;
@@ -42,40 +42,40 @@
// Getters
- ContextSource<I, O> getUserContextSource() {
- return userContextSource;
+ ClientSource<I, O> getUserContextSource() {
+ return userClientSource;
}
- public ServiceClient getServiceClient() {
- return serviceClient;
+ public ServiceInitiator getServiceClient() {
+ return serviceInitiator;
}
- public void initialize(final ServiceServer<I, O> serviceServer) {
+ public void initialize(final ServiceResponder<I, O> serviceResponder) {
state.requireTransitionExclusive(State.INITIAL, State.UP);
- this.serviceServer = serviceServer;
+ this.serviceResponder = serviceResponder;
state.releaseExclusive();
}
@SuppressWarnings
({"SerializableInnerClassWithNonSerializableOuterClass"})
- public final class UserContextSource extends AbstractRealContextSource<I, O> {
- protected UserContextSource() {
- super(serviceServer);
+ public final class UserClientSource extends AbstractRealClientSource<I, O> {
+ protected UserClientSource() {
+ super(serviceResponder);
}
private void doClose() throws RemotingException {
state.waitForNot(State.INITIAL);
if (state.transitionHold(State.UP, State.DOWN)) try {
synchronized (closeHandlers) {
- for (final CloseHandler<ContextSource<I, O>> handler :
closeHandlers) {
+ for (final CloseHandler<ClientSource<I, O>> handler :
closeHandlers) {
executor.execute(new Runnable() {
public void run() {
- handler.handleClose(UserContextSource.this);
+ handler.handleClose(UserClientSource.this);
}
});
}
closeHandlers.clear();
}
- serviceServer.handleClose();
+ serviceResponder.handleClose();
} finally {
state.release();
}
@@ -89,7 +89,7 @@
doClose();
}
- public void addCloseHandler(final CloseHandler<ContextSource<I, O>>
closeHandler) {
+ public void addCloseHandler(final CloseHandler<ClientSource<I, O>>
closeHandler) {
final State current = state.getStateHold();
try {
switch (current) {
@@ -105,15 +105,15 @@
}
}
- public Context<I, O> createContext() throws RemotingException {
- final CoreOutboundContext<I, O> context = new CoreOutboundContext<I,
O>(executor);
- final ContextServer<I, O> contextServer =
serviceServer.createNewContext(context.getContextClient());
- context.initialize(contextServer);
- return context.getUserContext();
+ public Client<I, O> createContext() throws RemotingException {
+ final CoreOutboundClient<I, O> client = new CoreOutboundClient<I,
O>(executor);
+ final ClientResponder<I, O> clientResponder =
serviceResponder.createNewClient(client.getContextClient());
+ client.initialize(clientResponder);
+ return client.getUserContext();
}
}
- public final class ServiceClientImpl implements ServiceClient {
+ public final class ServiceInitiatorImpl implements ServiceInitiator {
public void handleClosing() throws RemotingException {
// todo - remote side is closing
}
Modified: remoting3/trunk/core/src/main/java/org/jboss/cx/remoting/core/CoreSession.java
===================================================================
---
remoting3/trunk/core/src/main/java/org/jboss/cx/remoting/core/CoreSession.java 2008-04-16
01:40:57 UTC (rev 3991)
+++
remoting3/trunk/core/src/main/java/org/jboss/cx/remoting/core/CoreSession.java 2008-04-16
02:04:26 UTC (rev 3992)
@@ -15,7 +15,7 @@
import java.util.concurrent.ConcurrentMap;
import java.util.concurrent.Executor;
import org.jboss.cx.remoting.CloseHandler;
-import org.jboss.cx.remoting.Context;
+import org.jboss.cx.remoting.Client;
import org.jboss.cx.remoting.RemoteExecutionException;
import org.jboss.cx.remoting.RemotingException;
import org.jboss.cx.remoting.Session;
@@ -26,7 +26,7 @@
import org.jboss.cx.remoting.spi.ByteMessageOutput;
import org.jboss.cx.remoting.spi.ObjectMessageInput;
import org.jboss.cx.remoting.spi.ObjectMessageOutput;
-import org.jboss.cx.remoting.spi.protocol.ContextIdentifier;
+import org.jboss.cx.remoting.spi.protocol.ClientIdentifier;
import org.jboss.cx.remoting.spi.protocol.ProtocolContext;
import org.jboss.cx.remoting.spi.protocol.ProtocolHandler;
import org.jboss.cx.remoting.spi.protocol.ProtocolHandlerFactory;
@@ -61,12 +61,12 @@
// Contexts and services that are available on the remote end of this session
// In these paris, the Server points to the ProtocolHandler, and the Client points
to...whatever
- private final ConcurrentMap<ContextIdentifier, ClientContextPair>
clientContexts = CollectionUtil.concurrentMap();
+ private final ConcurrentMap<ClientIdentifier, ClientContextPair> clientContexts
= CollectionUtil.concurrentMap();
private final ConcurrentMap<ServiceIdentifier, ClientServicePair>
clientServices = CollectionUtil.concurrentMap();
// Contexts and services that are available on this end of this session
// In these pairs, the Client points to the ProtocolHandler, and the Server points
to... whatever
- private final ConcurrentMap<ContextIdentifier, ServerContextPair>
serverContexts = CollectionUtil.concurrentMap();
+ private final ConcurrentMap<ClientIdentifier, ServerContextPair> serverContexts
= CollectionUtil.concurrentMap();
private final ConcurrentMap<ServiceIdentifier, ServerServicePair>
serverServices = CollectionUtil.concurrentMap();
// streams - strong references, only clean up if a close message is sent or received
@@ -82,7 +82,7 @@
/** The remote endpoint name. Set on CONNECTING -> UP */
private String remoteEndpointName;
/** The root context. Set on CONNECTING -> UP */
- private Context<?, ?> rootContext;
+ private Client<?, ?> rootClient;
private final AtomicStateMachine<State> state =
AtomicStateMachine.start(State.NEW);
@@ -109,43 +109,43 @@
// Initializers
- private <I, O> void doInitialize(final ProtocolHandler protocolHandler, final
Context<I, O> rootContext) {
+ private <I, O> void doInitialize(final ProtocolHandler protocolHandler, final
Client<I, O> rootClient) {
if (protocolHandler == null) {
throw new NullPointerException("protocolHandler is null");
}
this.protocolHandler = protocolHandler;
- if (rootContext instanceof AbstractRealContext) {
- final AbstractRealContext<I, O> abstractRealContext =
(AbstractRealContext<I, O>) rootContext;
+ if (rootClient instanceof AbstractRealClient) {
+ final AbstractRealClient<I, O> abstractRealContext =
(AbstractRealClient<I, O>) rootClient;
// Forward local context
- final ContextIdentifier localIdentifier =
protocolHandler.getLocalRootContextIdentifier();
+ final ClientIdentifier localIdentifier =
protocolHandler.getLocalRootClientIdentifier();
if (localIdentifier == null) {
throw new NullPointerException("localIdentifier is null");
}
- final ProtocolContextClientImpl<I, O> contextClient = new
ProtocolContextClientImpl<I, O>(localIdentifier);
+ final ProtocolClientInitiatorImpl<I, O> contextClient = new
ProtocolClientInitiatorImpl<I, O>(localIdentifier);
serverContexts.put(localIdentifier, new ServerContextPair<I,
O>(contextClient, abstractRealContext.getContextServer()));
log.trace("Initialized session with local context %s",
localIdentifier);
}
// Forward remote context
- final ContextIdentifier remoteIdentifier =
protocolHandler.getRemoteRootContextIdentifier();
+ final ClientIdentifier remoteIdentifier =
protocolHandler.getRemoteRootClientIdentifier();
if (remoteIdentifier == null) {
throw new NullPointerException("remoteIdentifier is null");
}
- final ProtocolContextServerImpl<I, O> contextServer = new
ProtocolContextServerImpl<I,O>(remoteIdentifier);
- final CoreOutboundContext<I, O> coreOutboundContext = new
CoreOutboundContext<I, O>(executor);
- clientContexts.put(remoteIdentifier, new ClientContextPair<I,
O>(coreOutboundContext.getContextClient(), contextServer, remoteIdentifier));
- coreOutboundContext.initialize(contextServer);
- this.rootContext = coreOutboundContext.getUserContext();
+ final ProtocolClientResponderImpl<I, O> contextServer = new
ProtocolClientResponderImpl<I,O>(remoteIdentifier);
+ final CoreOutboundClient<I, O> coreOutboundClient = new
CoreOutboundClient<I, O>(executor);
+ clientContexts.put(remoteIdentifier, new ClientContextPair<I,
O>(coreOutboundClient.getContextClient(), contextServer, remoteIdentifier));
+ coreOutboundClient.initialize(contextServer);
+ this.rootClient = coreOutboundClient.getUserContext();
log.trace("Initialized session with remote context %s",
remoteIdentifier);
}
- <I, O> void initializeServer(final ProtocolHandler protocolHandler, final
Context<I, O> rootContext) {
+ <I, O> void initializeServer(final ProtocolHandler protocolHandler, final
Client<I, O> rootClient) {
if (protocolHandler == null) {
throw new NullPointerException("protocolHandler is null");
}
boolean ok = false;
state.requireTransitionExclusive(State.NEW, State.CONNECTING);
try {
- doInitialize(protocolHandler, rootContext);
+ doInitialize(protocolHandler, rootClient);
ok = true;
} finally {
state.releaseExclusive();
@@ -155,14 +155,14 @@
}
}
- <I, O> void initializeClient(final ProtocolHandlerFactory
protocolHandlerFactory, final URI remoteUri, final AttributeMap attributeMap, final
Context<I, O> rootContext) throws IOException {
+ <I, O> void initializeClient(final ProtocolHandlerFactory
protocolHandlerFactory, final URI remoteUri, final AttributeMap attributeMap, final
Client<I, O> rootClient) throws IOException {
if (protocolHandlerFactory == null) {
throw new NullPointerException("protocolHandlerFactory is null");
}
boolean ok = false;
state.requireTransitionExclusive(State.NEW, State.CONNECTING);
try {
- doInitialize(protocolHandlerFactory.createHandler(protocolContext, remoteUri,
attributeMap), rootContext);
+ doInitialize(protocolHandlerFactory.createHandler(protocolContext, remoteUri,
attributeMap), rootClient);
ok = true;
} finally {
state.releaseExclusive();
@@ -194,7 +194,7 @@
}
}
- // Context mgmt
+ // Client mgmt
// User session impl
@@ -243,16 +243,16 @@
}
@SuppressWarnings ({"unchecked"})
- public <I, O> Context<I, O> getRootContext() {
- return (Context<I, O>) rootContext;
+ public <I, O> Client<I, O> getRootContext() {
+ return (Client<I, O>) rootClient;
}
}
// Protocol context
@SuppressWarnings ({"unchecked"})
- private static <O> void doSendReply(RequestClient<O> requestClient,
Object data) throws RemotingException {
- requestClient.handleReply((O)data);
+ private static <O> void doSendReply(RequestInitiator<O> requestInitiator,
Object data) throws RemotingException {
+ requestInitiator.handleReply((O)data);
}
// Lifecycle
@@ -315,14 +315,14 @@
return endpoint.getUserEndpoint().getName();
}
- public void receiveContextClose(ContextIdentifier remoteContextIdentifier, final
boolean immediate, final boolean cancel, final boolean interrupt) {
- if (remoteContextIdentifier == null) {
- throw new NullPointerException("remoteContextIdentifier is
null");
+ public void receiveClientClose(ClientIdentifier remoteClientIdentifier, final
boolean immediate, final boolean cancel, final boolean interrupt) {
+ if (remoteClientIdentifier == null) {
+ throw new NullPointerException("remoteClientIdentifier is
null");
}
- final ServerContextPair contextPair =
serverContexts.remove(remoteContextIdentifier);
+ final ServerContextPair contextPair =
serverContexts.remove(remoteClientIdentifier);
// todo - do the whole close operation
try {
- contextPair.contextServer.handleClose(immediate, cancel);
+ contextPair.clientResponder.handleClose(immediate, cancel);
} catch (RemotingException e) {
log.trace(e, "Failed to forward a context close");
}
@@ -342,26 +342,26 @@
}
final ServerServicePair servicePair =
serverServices.remove(serviceIdentifier);
try {
- servicePair.serviceServer.handleClose();
+ servicePair.serviceResponder.handleClose();
} catch (RemotingException e) {
log.trace(e, "Failed to forward a service close");
}
}
@SuppressWarnings ({"unchecked"})
- public void receiveOpenedContext(ServiceIdentifier remoteServiceIdentifier,
ContextIdentifier remoteContextIdentifier) {
+ public void receiveOpenedContext(ServiceIdentifier remoteServiceIdentifier,
ClientIdentifier remoteClientIdentifier) {
if (remoteServiceIdentifier == null) {
throw new NullPointerException("remoteServiceIdentifier is
null");
}
- if (remoteContextIdentifier == null) {
- throw new NullPointerException("remoteContextIdentifier is
null");
+ if (remoteClientIdentifier == null) {
+ throw new NullPointerException("remoteClientIdentifier is
null");
}
try {
final ServerServicePair servicePair =
serverServices.get(remoteServiceIdentifier);
- final ProtocolContextClientImpl contextClient = new
ProtocolContextClientImpl(remoteContextIdentifier);
- final ContextServer contextServer =
servicePair.serviceServer.createNewContext(contextClient);
+ final ProtocolClientInitiatorImpl contextClient = new
ProtocolClientInitiatorImpl(remoteClientIdentifier);
+ final ClientResponder clientResponder =
servicePair.serviceResponder.createNewClient(contextClient);
// todo - who puts it in the map?
- serverContexts.put(remoteContextIdentifier, new
ServerContextPair(contextClient, contextServer));
+ serverContexts.put(remoteClientIdentifier, new
ServerContextPair(contextClient, clientResponder));
} catch (RemotingException e) {
log.trace(e, "Failed to add a context to a service");
}
@@ -373,44 +373,44 @@
}
final ClientServicePair servicePair = clientServices.get(serviceIdentifier);
try {
- servicePair.serviceClient.handleClosing();
+ servicePair.serviceInitiator.handleClosing();
} catch (RemotingException e) {
log.trace(e, "Failed to signal that a service was closing on the
remote side");
}
}
- public void receiveContextClosing(ContextIdentifier contextIdentifier, boolean
done) {
- if (contextIdentifier == null) {
- throw new NullPointerException("contextIdentifier is null");
+ public void receiveClientClosing(ClientIdentifier clientIdentifier, boolean done)
{
+ if (clientIdentifier == null) {
+ throw new NullPointerException("clientIdentifier is null");
}
- final ClientContextPair contextPair = clientContexts.get(contextIdentifier);
+ final ClientContextPair contextPair = clientContexts.get(clientIdentifier);
try {
- contextPair.contextClient.handleClosing(done);
+ contextPair.clientInitiator.handleClosing(done);
} catch (RemotingException e) {
log.trace(e, "Failed to signal that a context was closing on the
remote side");
}
}
- public void receiveReply(ContextIdentifier contextIdentifier, RequestIdentifier
requestIdentifier, Object reply) {
- if (contextIdentifier == null) {
- throw new NullPointerException("contextIdentifier is null");
+ public void receiveReply(ClientIdentifier clientIdentifier, RequestIdentifier
requestIdentifier, Object reply) {
+ if (clientIdentifier == null) {
+ throw new NullPointerException("clientIdentifier is null");
}
if (requestIdentifier == null) {
throw new NullPointerException("requestIdentifier is null");
}
- final ClientContextPair contextPair = clientContexts.get(contextIdentifier);
+ final ClientContextPair contextPair = clientContexts.get(clientIdentifier);
if (contextPair == null) {
- log.trace("Got reply for request %s on unknown context %s",
requestIdentifier, contextIdentifier);
+ log.trace("Got reply for request %s on unknown context %s",
requestIdentifier, clientIdentifier);
} else {
- final ProtocolContextServerImpl<?, ?> contextServer =
contextPair.contextServerRef.get();
+ final ProtocolClientResponderImpl<?, ?> contextServer =
contextPair.contextServerRef.get();
if (contextServer == null) {
- log.trace("Got reply for request %s on unknown recently leaked
context %s", requestIdentifier, contextIdentifier);
+ log.trace("Got reply for request %s on unknown recently leaked
context %s", requestIdentifier, clientIdentifier);
} else {
- final RequestClient<?> requestClient = (RequestClient<?>)
contextServer.requests.get(requestIdentifier);
- if (requestClient == null) {
- log.trace("Got reply for unknown request %s on context
%s", requestIdentifier, contextIdentifier);
+ final RequestInitiator<?> requestInitiator =
(RequestInitiator<?>) contextServer.requests.get(requestIdentifier);
+ if (requestInitiator == null) {
+ log.trace("Got reply for unknown request %s on context
%s", requestIdentifier, clientIdentifier);
} else try {
- doSendReply(requestClient, reply);
+ doSendReply(requestInitiator, reply);
} catch (RemotingException e) {
log.trace(e, "Failed to receive a reply");
}
@@ -418,9 +418,9 @@
}
}
- public void receiveException(ContextIdentifier contextIdentifier,
RequestIdentifier requestIdentifier, RemoteExecutionException exception) {
- if (contextIdentifier == null) {
- throw new NullPointerException("contextIdentifier is null");
+ public void receiveException(ClientIdentifier clientIdentifier, RequestIdentifier
requestIdentifier, RemoteExecutionException exception) {
+ if (clientIdentifier == null) {
+ throw new NullPointerException("clientIdentifier is null");
}
if (requestIdentifier == null) {
throw new NullPointerException("requestIdentifier is null");
@@ -428,19 +428,19 @@
if (exception == null) {
throw new NullPointerException("exception is null");
}
- final ClientContextPair contextPair = clientContexts.get(contextIdentifier);
+ final ClientContextPair contextPair = clientContexts.get(clientIdentifier);
if (contextPair == null) {
- log.trace("Got exception reply for request %s on unknown context
%s", requestIdentifier, contextIdentifier);
+ log.trace("Got exception reply for request %s on unknown context
%s", requestIdentifier, clientIdentifier);
} else {
- final ProtocolContextServerImpl<?, ?> contextServer =
contextPair.contextServerRef.get();
+ final ProtocolClientResponderImpl<?, ?> contextServer =
contextPair.contextServerRef.get();
if (contextServer == null) {
- log.trace("Got exception reply for request %s on unknown
recently leaked context %s", requestIdentifier, contextIdentifier);
+ log.trace("Got exception reply for request %s on unknown
recently leaked context %s", requestIdentifier, clientIdentifier);
} else {
- final RequestClient<?> requestClient = (RequestClient<?>)
contextServer.requests.get(requestIdentifier);
- if (requestClient == null) {
- log.trace("Got exception reply for unknown request %s on
context %s", requestIdentifier, contextIdentifier);
+ final RequestInitiator<?> requestInitiator =
(RequestInitiator<?>) contextServer.requests.get(requestIdentifier);
+ if (requestInitiator == null) {
+ log.trace("Got exception reply for unknown request %s on
context %s", requestIdentifier, clientIdentifier);
} else try {
- requestClient.handleException(exception);
+ requestInitiator.handleException(exception);
} catch (RemotingException e) {
log.trace(e, "Failed to receive an exception reply");
}
@@ -448,26 +448,26 @@
}
}
- public void receiveCancelAcknowledge(ContextIdentifier contextIdentifier,
RequestIdentifier requestIdentifier) {
- if (contextIdentifier == null) {
- throw new NullPointerException("contextIdentifier is null");
+ public void receiveCancelAcknowledge(ClientIdentifier clientIdentifier,
RequestIdentifier requestIdentifier) {
+ if (clientIdentifier == null) {
+ throw new NullPointerException("clientIdentifier is null");
}
if (requestIdentifier == null) {
throw new NullPointerException("requestIdentifier is null");
}
- final ClientContextPair contextPair = clientContexts.get(contextIdentifier);
+ final ClientContextPair contextPair = clientContexts.get(clientIdentifier);
if (contextPair == null) {
- log.trace("Got cancellation acknowledgement for request %s on
unknown context %s", requestIdentifier, contextIdentifier);
+ log.trace("Got cancellation acknowledgement for request %s on
unknown context %s", requestIdentifier, clientIdentifier);
} else {
- final ProtocolContextServerImpl<?, ?> contextServer =
contextPair.contextServerRef.get();
+ final ProtocolClientResponderImpl<?, ?> contextServer =
contextPair.contextServerRef.get();
if (contextServer == null) {
- log.trace("Got cancellation acknowledgement for request %s on
unknown recently leaked context %s", requestIdentifier, contextIdentifier);
+ log.trace("Got cancellation acknowledgement for request %s on
unknown recently leaked context %s", requestIdentifier, clientIdentifier);
} else {
- final RequestClient<?> requestClient = (RequestClient<?>)
contextServer.requests.get(requestIdentifier);
- if (requestClient == null) {
- log.trace("Got cancellation acknowledgement for unknown
request %s on context %s", requestIdentifier, contextIdentifier);
+ final RequestInitiator<?> requestInitiator =
(RequestInitiator<?>) contextServer.requests.get(requestIdentifier);
+ if (requestInitiator == null) {
+ log.trace("Got cancellation acknowledgement for unknown
request %s on context %s", requestIdentifier, clientIdentifier);
} else try {
- requestClient.handleCancelAcknowledge();
+ requestInitiator.handleCancelAcknowledge();
} catch (RemotingException e) {
log.trace(e, "Failed to receive a cancellation
acknowledgement");
}
@@ -475,17 +475,17 @@
}
}
- public void receiveCancelRequest(ContextIdentifier remoteContextIdentifier,
RequestIdentifier requestIdentifier, boolean mayInterrupt) {
- if (remoteContextIdentifier == null) {
- throw new NullPointerException("remoteContextIdentifier is
null");
+ public void receiveCancelRequest(ClientIdentifier remoteClientIdentifier,
RequestIdentifier requestIdentifier, boolean mayInterrupt) {
+ if (remoteClientIdentifier == null) {
+ throw new NullPointerException("remoteClientIdentifier is
null");
}
if (requestIdentifier == null) {
throw new NullPointerException("requestIdentifier is null");
}
- final ServerContextPair contextPair =
serverContexts.get(remoteContextIdentifier);
- final RequestServer<?> requestServer = (RequestServer<?>)
contextPair.contextClient.requests.get(requestIdentifier);
+ final ServerContextPair contextPair =
serverContexts.get(remoteClientIdentifier);
+ final RequestResponder<?> requestResponder =
(RequestResponder<?>) contextPair.contextClient.requests.get(requestIdentifier);
try {
- requestServer.handleCancelRequest(mayInterrupt);
+ requestResponder.handleCancelRequest(mayInterrupt);
} catch (RemotingException e) {
log.trace(e, "Failed to receive a cancellation request");
}
@@ -518,22 +518,22 @@
}
@SuppressWarnings ({"unchecked"})
- public void receiveRequest(final ContextIdentifier remoteContextIdentifier, final
RequestIdentifier requestIdentifier, final Object request) {
- if (remoteContextIdentifier == null) {
- throw new NullPointerException("remoteContextIdentifier is
null");
+ public void receiveRequest(final ClientIdentifier remoteClientIdentifier, final
RequestIdentifier requestIdentifier, final Object request) {
+ if (remoteClientIdentifier == null) {
+ throw new NullPointerException("remoteClientIdentifier is
null");
}
if (requestIdentifier == null) {
throw new NullPointerException("requestIdentifier is null");
}
- final ServerContextPair contextPair =
serverContexts.get(remoteContextIdentifier);
+ final ServerContextPair contextPair =
serverContexts.get(remoteClientIdentifier);
if (contextPair == null) {
- log.trace("Received a request on an unknown context %s",
remoteContextIdentifier);
+ log.trace("Received a request on an unknown context %s",
remoteClientIdentifier);
return;
}
try {
- final RequestClient client =
contextPair.contextClient.addClient(requestIdentifier);
- final RequestServer requestServer =
contextPair.contextServer.createNewRequest(client);
- requestServer.handleRequest(request, executor);
+ final RequestInitiator requestInitiator =
contextPair.contextClient.addClient(requestIdentifier);
+ final RequestResponder requestResponder =
contextPair.clientResponder.createNewRequest(requestInitiator);
+ requestResponder.handleRequest(request, executor);
} catch (RemotingException e) {
e.printStackTrace();
}
@@ -603,26 +603,26 @@
return target.getBytesWritten();
}
- private final <I, O> ContextMarker doContextReplace(ContextServer<I,
O> contextServer) throws IOException {
- final ContextIdentifier contextIdentifier = protocolHandler.openContext();
- final ProtocolContextClientImpl<I, O> contextClient = new
ProtocolContextClientImpl<I, O>(contextIdentifier);
- new ServerContextPair<I, O>(contextClient, contextServer);
- return new ContextMarker(contextIdentifier);
+ private final <I, O> ClientMarker doContextReplace(ClientResponder<I,
O> clientResponder) throws IOException {
+ final ClientIdentifier clientIdentifier = protocolHandler.openClient();
+ final ProtocolClientInitiatorImpl<I, O> contextClient = new
ProtocolClientInitiatorImpl<I, O>(clientIdentifier);
+ new ServerContextPair<I, O>(contextClient, clientResponder);
+ return new ClientMarker(clientIdentifier);
}
- private final <I, O> ContextSourceMarker
doContextSourceReplace(ServiceServer<I, O> serviceServer) throws IOException {
+ private final <I, O> ContextSourceMarker
doContextSourceReplace(ServiceResponder<I, O> serviceResponder) throws IOException
{
final ServiceIdentifier serviceIdentifier = protocolHandler.openService();
- final ProtocolServiceClientImpl serviceClient = new
ProtocolServiceClientImpl(serviceIdentifier);
- new ServerServicePair<I, O>(serviceClient, serviceServer);
+ final ProtocolServiceInitiatorImpl serviceClient = new
ProtocolServiceInitiatorImpl(serviceIdentifier);
+ new ServerServicePair<I, O>(serviceClient, serviceResponder);
return new ContextSourceMarker(serviceIdentifier);
}
protected Object replaceObject(Object obj) throws IOException {
final Object testObject = super.replaceObject(obj);
- if (testObject instanceof AbstractRealContext) {
- return doContextReplace(((AbstractRealContext<?, ?>)
obj).getContextServer());
- } else if (testObject instanceof AbstractRealContextSource) {
- return doContextSourceReplace(((AbstractRealContextSource<?, ?>)
obj).getServiceServer());
+ if (testObject instanceof AbstractRealClient) {
+ return doContextReplace(((AbstractRealClient<?, ?>)
obj).getContextServer());
+ } else if (testObject instanceof AbstractRealClientSource) {
+ return doContextSourceReplace(((AbstractRealClientSource<?, ?>)
obj).getServiceServer());
}
for (StreamDetector detector : streamDetectors) {
final StreamSerializerFactory factory =
detector.detectStream(testObject);
@@ -757,21 +757,21 @@
}
}
- private final class WeakProtocolContextServerReference<I, O> extends
WeakReference<ProtocolContextServerImpl<I, O>> {
+ private final class WeakProtocolContextServerReference<I, O> extends
WeakReference<ProtocolClientResponderImpl<I, O>> {
private final ClientContextPair<I, O> contextPair;
- private WeakProtocolContextServerReference(ProtocolContextServerImpl<I, O>
referent, ClientContextPair<I, O> contextPair) {
+ private WeakProtocolContextServerReference(ProtocolClientResponderImpl<I,
O> referent, ClientContextPair<I, O> contextPair) {
super(referent);
this.contextPair = contextPair;
}
- public ProtocolContextServerImpl<I, O> get() {
+ public ProtocolClientResponderImpl<I, O> get() {
return super.get();
}
public boolean enqueue() {
try {
- clientContexts.remove(contextPair.contextIdentifier, contextPair);
+ clientContexts.remove(contextPair.clientIdentifier, contextPair);
// todo close?
} finally {
return super.enqueue();
@@ -780,70 +780,70 @@
}
private final class ClientContextPair<I, O> {
- private final ContextClient contextClient;
+ private final ClientInitiator clientInitiator;
private final WeakProtocolContextServerReference<I, O> contextServerRef;
- private final ContextIdentifier contextIdentifier;
+ private final ClientIdentifier clientIdentifier;
- private ClientContextPair(final ContextClient contextClient, final
ProtocolContextServerImpl<I, O> contextServer, final ContextIdentifier
contextIdentifier) {
- this.contextClient = contextClient;
- this.contextIdentifier = contextIdentifier;
+ private ClientContextPair(final ClientInitiator clientInitiator, final
ProtocolClientResponderImpl<I, O> contextServer, final ClientIdentifier
clientIdentifier) {
+ this.clientInitiator = clientInitiator;
+ this.clientIdentifier = clientIdentifier;
contextServerRef = new WeakProtocolContextServerReference<I,
O>(contextServer, this);
// todo - auto-cleanup
}
}
private static final class ServerContextPair<I, O> {
- private final ProtocolContextClientImpl<I, O> contextClient;
- private final ContextServer<I, O> contextServer;
+ private final ProtocolClientInitiatorImpl<I, O> contextClient;
+ private final ClientResponder<I, O> clientResponder;
- private ServerContextPair(final ProtocolContextClientImpl<I, O>
contextClient, final ContextServer<I, O> contextServer) {
+ private ServerContextPair(final ProtocolClientInitiatorImpl<I, O>
contextClient, final ClientResponder<I, O> clientResponder) {
if (contextClient == null) {
- throw new NullPointerException("contextClient is null");
+ throw new NullPointerException("clientInitiator is null");
}
- if (contextServer == null) {
- throw new NullPointerException("contextServer is null");
+ if (clientResponder == null) {
+ throw new NullPointerException("clientResponder is null");
}
this.contextClient = contextClient;
- this.contextServer = contextServer;
+ this.clientResponder = clientResponder;
}
}
private static final class ClientServicePair<I, O> {
- private final ServiceClient serviceClient;
- private final ProtocolServiceServerImpl<I, O> serviceServer;
+ private final ServiceInitiator serviceInitiator;
+ private final ProtocolServiceResponderImpl<I, O> serviceServer;
- private ClientServicePair(final ServiceClient serviceClient, final
ProtocolServiceServerImpl<I, O> serviceServer) {
- if (serviceClient == null) {
- throw new NullPointerException("serviceClient is null");
+ private ClientServicePair(final ServiceInitiator serviceInitiator, final
ProtocolServiceResponderImpl<I, O> serviceServer) {
+ if (serviceInitiator == null) {
+ throw new NullPointerException("serviceInitiator is null");
}
if (serviceServer == null) {
- throw new NullPointerException("serviceServer is null");
+ throw new NullPointerException("serviceResponder is null");
}
- this.serviceClient = serviceClient;
+ this.serviceInitiator = serviceInitiator;
this.serviceServer = serviceServer;
}
}
private static final class ServerServicePair<I, O> {
- private final ProtocolServiceClientImpl serviceClient;
- private final ServiceServer<I, O> serviceServer;
+ private final ProtocolServiceInitiatorImpl serviceClient;
+ private final ServiceResponder<I, O> serviceResponder;
- private ServerServicePair(final ProtocolServiceClientImpl serviceClient, final
ServiceServer<I, O> serviceServer) {
+ private ServerServicePair(final ProtocolServiceInitiatorImpl serviceClient, final
ServiceResponder<I, O> serviceResponder) {
if (serviceClient == null) {
- throw new NullPointerException("serviceClient is null");
+ throw new NullPointerException("serviceInitiator is null");
}
- if (serviceServer == null) {
- throw new NullPointerException("serviceServer is null");
+ if (serviceResponder == null) {
+ throw new NullPointerException("serviceResponder is null");
}
this.serviceClient = serviceClient;
- this.serviceServer = serviceServer;
+ this.serviceResponder = serviceResponder;
}
}
- private final class ProtocolServiceClientImpl implements ServiceClient {
+ private final class ProtocolServiceInitiatorImpl implements ServiceInitiator {
private final ServiceIdentifier serviceIdentifier;
- public ProtocolServiceClientImpl(final ServiceIdentifier serviceIdentifier) {
+ public ProtocolServiceInitiatorImpl(final ServiceIdentifier serviceIdentifier) {
if (serviceIdentifier == null) {
throw new NullPointerException("serviceIdentifier is null");
}
@@ -861,10 +861,10 @@
}
}
- private final class ProtocolServiceServerImpl<I, O> implements
ServiceServer<I, O> {
+ private final class ProtocolServiceResponderImpl<I, O> implements
ServiceResponder<I, O> {
private final ServiceIdentifier serviceIdentifier;
- public ProtocolServiceServerImpl(final ServiceIdentifier serviceIdentifier) {
+ public ProtocolServiceResponderImpl(final ServiceIdentifier serviceIdentifier) {
this.serviceIdentifier = serviceIdentifier;
}
@@ -878,14 +878,14 @@
}
}
- public ContextServer<I, O> createNewContext(final ContextClient client)
throws RemotingException {
+ public ClientResponder<I, O> createNewClient(final ClientInitiator
clientInitiator) throws RemotingException {
try {
- final ContextIdentifier contextIdentifier =
protocolHandler.openContext(serviceIdentifier);
- if (contextIdentifier == null) {
- throw new NullPointerException("contextIdentifier is
null");
+ final ClientIdentifier clientIdentifier =
protocolHandler.openClient(serviceIdentifier);
+ if (clientIdentifier == null) {
+ throw new NullPointerException("clientIdentifier is
null");
}
- clientContexts.put(contextIdentifier, new ClientContextPair<I,
O>(client, new ProtocolContextServerImpl<I, O>(contextIdentifier),
contextIdentifier));
- return new ProtocolContextServerImpl<I, O>(contextIdentifier);
+ clientContexts.put(clientIdentifier, new ClientContextPair<I,
O>(clientInitiator, new ProtocolClientResponderImpl<I, O>(clientIdentifier),
clientIdentifier));
+ return new ProtocolClientResponderImpl<I, O>(clientIdentifier);
} catch (RemotingException e) {
throw e;
} catch (IOException e) {
@@ -894,18 +894,18 @@
}
}
- private final class ProtocolContextClientImpl<I, O> implements ContextClient {
- private final ContextIdentifier contextIdentifier;
- private final ConcurrentMap<RequestIdentifier, RequestServer<I>>
requests = CollectionUtil.concurrentMap();
+ private final class ProtocolClientInitiatorImpl<I, O> implements
ClientInitiator {
+ private final ClientIdentifier clientIdentifier;
+ private final ConcurrentMap<RequestIdentifier, RequestResponder<I>>
requests = CollectionUtil.concurrentMap();
- public ProtocolContextClientImpl(final ContextIdentifier contextIdentifier) {
- this.contextIdentifier = contextIdentifier;
+ public ProtocolClientInitiatorImpl(final ClientIdentifier clientIdentifier) {
+ this.clientIdentifier = clientIdentifier;
}
public void handleClosing(boolean done) throws RemotingException {
try {
if (state.inHold(State.UP)) {
- protocolHandler.sendContextClosing(contextIdentifier, done);
+ protocolHandler.sendClientClosing(clientIdentifier, done);
}
} catch (RemotingException e) {
throw e;
@@ -914,22 +914,22 @@
}
}
- private RequestClient<O> addClient(RequestIdentifier identifier) {
- return new ProtocolRequestClientImpl<O>(contextIdentifier,
identifier);
+ private RequestInitiator<O> addClient(RequestIdentifier identifier) {
+ return new ProtocolRequestInitiatorImpl<O>(clientIdentifier,
identifier);
}
- private final class ProtocolRequestClientImpl<O> implements
RequestClient<O> {
- private final ContextIdentifier contextIdentifer;
+ private final class ProtocolRequestInitiatorImpl<O> implements
RequestInitiator<O> {
+ private final ClientIdentifier clientIdentifer;
private final RequestIdentifier requestIdentifer;
- public ProtocolRequestClientImpl(final ContextIdentifier contextIdentifer,
final RequestIdentifier requestIdentifer) {
- this.contextIdentifer = contextIdentifer;
+ public ProtocolRequestInitiatorImpl(final ClientIdentifier clientIdentifer,
final RequestIdentifier requestIdentifer) {
+ this.clientIdentifer = clientIdentifer;
this.requestIdentifer = requestIdentifer;
}
public void handleReply(final O reply) throws RemotingException {
try {
- protocolHandler.sendReply(contextIdentifer, requestIdentifer,
reply);
+ protocolHandler.sendReply(clientIdentifer, requestIdentifer, reply);
} catch (RemotingException e) {
throw e;
} catch (IOException e) {
@@ -941,7 +941,7 @@
public void handleException(final RemoteExecutionException cause) throws
RemotingException {
try {
- protocolHandler.sendException(contextIdentifer, requestIdentifer,
cause);
+ protocolHandler.sendException(clientIdentifer, requestIdentifer,
cause);
} catch (RemotingException e) {
throw e;
} catch (IOException e) {
@@ -953,7 +953,7 @@
public void handleCancelAcknowledge() throws RemotingException {
try {
- protocolHandler.sendCancelAcknowledge(contextIdentifer,
requestIdentifer);
+ protocolHandler.sendCancelAcknowledge(clientIdentifer,
requestIdentifer);
} catch (RemotingException e) {
throw e;
} catch (IOException e) {
@@ -965,22 +965,22 @@
}
}
- private final class ProtocolContextServerImpl<I, O> implements
ContextServer<I, O> {
- private final ContextIdentifier contextIdentifier;
- private final ConcurrentMap<RequestIdentifier, RequestClient<O>>
requests = CollectionUtil.concurrentMap();
+ private final class ProtocolClientResponderImpl<I, O> implements
ClientResponder<I, O> {
+ private final ClientIdentifier clientIdentifier;
+ private final ConcurrentMap<RequestIdentifier, RequestInitiator<O>>
requests = CollectionUtil.concurrentMap();
- public ProtocolContextServerImpl(final ContextIdentifier contextIdentifier) {
- this.contextIdentifier = contextIdentifier;
+ public ProtocolClientResponderImpl(final ClientIdentifier clientIdentifier) {
+ this.clientIdentifier = clientIdentifier;
}
- public RequestServer<I> createNewRequest(final RequestClient<O>
requestClient) throws RemotingException {
+ public RequestResponder<I> createNewRequest(final RequestInitiator<O>
requestInitiator) throws RemotingException {
try {
- final RequestIdentifier requestIdentifier =
protocolHandler.openRequest(contextIdentifier);
+ final RequestIdentifier requestIdentifier =
protocolHandler.openRequest(clientIdentifier);
if (requestIdentifier == null) {
throw new NullPointerException("requestIdentifier is
null");
}
- requests.put(requestIdentifier, requestClient);
- return new ProtocolRequestServerImpl(requestIdentifier);
+ requests.put(requestIdentifier, requestInitiator);
+ return new ProtocolRequestResponderImpl(requestIdentifier);
} catch (RemotingException e) {
throw e;
} catch (IOException e) {
@@ -990,7 +990,7 @@
public void handleClose(final boolean immediate, final boolean cancel) throws
RemotingException {
try {
- protocolHandler.sendContextClose(contextIdentifier, immediate, cancel,
false);
+ protocolHandler.sendClientClose(clientIdentifier, immediate, cancel,
false);
} catch (RemotingException e) {
throw e;
} catch (IOException e) {
@@ -998,16 +998,16 @@
}
}
- private final class ProtocolRequestServerImpl implements RequestServer<I>
{
+ private final class ProtocolRequestResponderImpl implements
RequestResponder<I> {
private final RequestIdentifier requestIdentifier;
- public ProtocolRequestServerImpl(final RequestIdentifier requestIdentifier)
{
+ public ProtocolRequestResponderImpl(final RequestIdentifier
requestIdentifier) {
this.requestIdentifier = requestIdentifier;
}
public void handleRequest(final I request, final Executor streamExecutor)
throws RemotingException {
try {
- protocolHandler.sendRequest(contextIdentifier, requestIdentifier,
request, streamExecutor);
+ protocolHandler.sendRequest(clientIdentifier, requestIdentifier,
request, streamExecutor);
} catch (RemotingException e) {
throw e;
} catch (IOException e) {
@@ -1017,7 +1017,7 @@
public void handleCancelRequest(final boolean mayInterrupt) throws
RemotingException {
try {
- protocolHandler.sendCancelRequest(contextIdentifier,
requestIdentifier, mayInterrupt);
+ protocolHandler.sendCancelRequest(clientIdentifier,
requestIdentifier, mayInterrupt);
} catch (RemotingException e) {
throw e;
} catch (IOException e) {
Copied:
remoting3/trunk/core/src/main/java/org/jboss/cx/remoting/core/ProtocolClientInitiator.java
(from rev 3985,
remoting3/trunk/core/src/main/java/org/jboss/cx/remoting/core/ProtocolContextClient.java)
===================================================================
---
remoting3/trunk/core/src/main/java/org/jboss/cx/remoting/core/ProtocolClientInitiator.java
(rev 0)
+++
remoting3/trunk/core/src/main/java/org/jboss/cx/remoting/core/ProtocolClientInitiator.java 2008-04-16
02:04:26 UTC (rev 3992)
@@ -0,0 +1,11 @@
+package org.jboss.cx.remoting.core;
+
+import org.jboss.cx.remoting.spi.protocol.RequestIdentifier;
+
+/**
+ *
+ */
+public interface ProtocolClientInitiator<I, O> extends ClientInitiator {
+ RequestInitiator<O> addRequest(RequestIdentifier requestIdentifier);
+
+}
Copied:
remoting3/trunk/core/src/main/java/org/jboss/cx/remoting/core/ProtocolClientResponder.java
(from rev 3985,
remoting3/trunk/core/src/main/java/org/jboss/cx/remoting/core/ProtocolContextServer.java)
===================================================================
---
remoting3/trunk/core/src/main/java/org/jboss/cx/remoting/core/ProtocolClientResponder.java
(rev 0)
+++
remoting3/trunk/core/src/main/java/org/jboss/cx/remoting/core/ProtocolClientResponder.java 2008-04-16
02:04:26 UTC (rev 3992)
@@ -0,0 +1,10 @@
+package org.jboss.cx.remoting.core;
+
+import org.jboss.cx.remoting.spi.protocol.RequestIdentifier;
+
+/**
+ *
+ */
+public interface ProtocolClientResponder<I, O> extends ClientResponder<I, O>
{
+ RequestInitiator<O> getRequestClient(RequestIdentifier requestIdentifier);
+}
Deleted:
remoting3/trunk/core/src/main/java/org/jboss/cx/remoting/core/ProtocolContextClient.java
===================================================================
---
remoting3/trunk/core/src/main/java/org/jboss/cx/remoting/core/ProtocolContextClient.java 2008-04-16
01:40:57 UTC (rev 3991)
+++
remoting3/trunk/core/src/main/java/org/jboss/cx/remoting/core/ProtocolContextClient.java 2008-04-16
02:04:26 UTC (rev 3992)
@@ -1,11 +0,0 @@
-package org.jboss.cx.remoting.core;
-
-import org.jboss.cx.remoting.spi.protocol.RequestIdentifier;
-
-/**
- *
- */
-public interface ProtocolContextClient<I, O> extends ContextClient {
- RequestClient<O> addRequest(RequestIdentifier requestIdentifier);
-
-}
Deleted:
remoting3/trunk/core/src/main/java/org/jboss/cx/remoting/core/ProtocolContextServer.java
===================================================================
---
remoting3/trunk/core/src/main/java/org/jboss/cx/remoting/core/ProtocolContextServer.java 2008-04-16
01:40:57 UTC (rev 3991)
+++
remoting3/trunk/core/src/main/java/org/jboss/cx/remoting/core/ProtocolContextServer.java 2008-04-16
02:04:26 UTC (rev 3992)
@@ -1,10 +0,0 @@
-package org.jboss.cx.remoting.core;
-
-import org.jboss.cx.remoting.spi.protocol.RequestIdentifier;
-
-/**
- *
- */
-public interface ProtocolContextServer<I, O> extends ContextServer<I, O> {
- RequestClient<O> getRequestClient(RequestIdentifier requestIdentifier);
-}
Modified:
remoting3/trunk/core/src/main/java/org/jboss/cx/remoting/core/RemoteClassLoader.java
===================================================================
---
remoting3/trunk/core/src/main/java/org/jboss/cx/remoting/core/RemoteClassLoader.java 2008-04-16
01:40:57 UTC (rev 3991)
+++
remoting3/trunk/core/src/main/java/org/jboss/cx/remoting/core/RemoteClassLoader.java 2008-04-16
02:04:26 UTC (rev 3992)
@@ -3,7 +3,7 @@
import java.io.IOException;
import java.io.InputStream;
import java.security.SecureClassLoader;
-import org.jboss.cx.remoting.Context;
+import org.jboss.cx.remoting.Client;
import org.jboss.cx.remoting.RemoteExecutionException;
import org.jboss.cx.remoting.RemotingException;
import org.jboss.cx.remoting.log.Logger;
@@ -18,11 +18,11 @@
public final class RemoteClassLoader extends SecureClassLoader {
private static final Logger log = Logger.getLogger(RemoteClassLoader.class);
- private final Context<ClassLoaderResourceRequest, ClassLoaderResourceReply>
loaderContext;
+ private final Client<ClassLoaderResourceRequest, ClassLoaderResourceReply>
loaderClient;
- public RemoteClassLoader(ClassLoader parent, final
Context<ClassLoaderResourceRequest, ClassLoaderResourceReply> loaderContext) {
+ public RemoteClassLoader(ClassLoader parent, final
Client<ClassLoaderResourceRequest, ClassLoaderResourceReply> loaderClient) {
super(parent);
- this.loaderContext = loaderContext;
+ this.loaderClient = loaderClient;
}
protected Class<?> findClass(String name) throws ClassNotFoundException {
@@ -35,7 +35,7 @@
// continue on...
}
try {
- final ClassLoaderResourceReply reply = loaderContext.invoke(new
ClassLoaderResourceRequest(name + ".class"));
+ final ClassLoaderResourceReply reply = loaderClient.invoke(new
ClassLoaderResourceRequest(name + ".class"));
final ObjectSource<RemoteResource> source = reply.getResources();
try {
if (! source.hasNext()) {
Deleted: remoting3/trunk/core/src/main/java/org/jboss/cx/remoting/core/RequestClient.java
===================================================================
---
remoting3/trunk/core/src/main/java/org/jboss/cx/remoting/core/RequestClient.java 2008-04-16
01:40:57 UTC (rev 3991)
+++
remoting3/trunk/core/src/main/java/org/jboss/cx/remoting/core/RequestClient.java 2008-04-16
02:04:26 UTC (rev 3992)
@@ -1,17 +0,0 @@
-package org.jboss.cx.remoting.core;
-
-import org.jboss.cx.remoting.RemoteExecutionException;
-import org.jboss.cx.remoting.RemotingException;
-
-/**
- *
- */
-public interface RequestClient<O> {
- // Outbound protocol messages
-
- void handleReply(final O reply) throws RemotingException;
-
- void handleException(final RemoteExecutionException cause) throws RemotingException;
-
- void handleCancelAcknowledge() throws RemotingException;
-}
Copied:
remoting3/trunk/core/src/main/java/org/jboss/cx/remoting/core/RequestInitiator.java (from
rev 3985,
remoting3/trunk/core/src/main/java/org/jboss/cx/remoting/core/RequestClient.java)
===================================================================
--- remoting3/trunk/core/src/main/java/org/jboss/cx/remoting/core/RequestInitiator.java
(rev 0)
+++
remoting3/trunk/core/src/main/java/org/jboss/cx/remoting/core/RequestInitiator.java 2008-04-16
02:04:26 UTC (rev 3992)
@@ -0,0 +1,17 @@
+package org.jboss.cx.remoting.core;
+
+import org.jboss.cx.remoting.RemoteExecutionException;
+import org.jboss.cx.remoting.RemotingException;
+
+/**
+ *
+ */
+public interface RequestInitiator<O> {
+ // Outbound protocol messages
+
+ void handleReply(final O reply) throws RemotingException;
+
+ void handleException(final RemoteExecutionException cause) throws RemotingException;
+
+ void handleCancelAcknowledge() throws RemotingException;
+}
Copied:
remoting3/trunk/core/src/main/java/org/jboss/cx/remoting/core/RequestResponder.java (from
rev 3985,
remoting3/trunk/core/src/main/java/org/jboss/cx/remoting/core/RequestServer.java)
===================================================================
--- remoting3/trunk/core/src/main/java/org/jboss/cx/remoting/core/RequestResponder.java
(rev 0)
+++
remoting3/trunk/core/src/main/java/org/jboss/cx/remoting/core/RequestResponder.java 2008-04-16
02:04:26 UTC (rev 3992)
@@ -0,0 +1,16 @@
+package org.jboss.cx.remoting.core;
+
+import java.util.concurrent.Executor;
+import org.jboss.cx.remoting.RemotingException;
+
+/**
+ *
+ */
+public interface RequestResponder<I> {
+
+ // Outbound protocol messages
+
+ void handleRequest(I request, final Executor streamExecutor) throws
RemotingException;
+
+ void handleCancelRequest(boolean mayInterrupt) throws RemotingException;
+}
Deleted: remoting3/trunk/core/src/main/java/org/jboss/cx/remoting/core/RequestServer.java
===================================================================
---
remoting3/trunk/core/src/main/java/org/jboss/cx/remoting/core/RequestServer.java 2008-04-16
01:40:57 UTC (rev 3991)
+++
remoting3/trunk/core/src/main/java/org/jboss/cx/remoting/core/RequestServer.java 2008-04-16
02:04:26 UTC (rev 3992)
@@ -1,16 +0,0 @@
-package org.jboss.cx.remoting.core;
-
-import java.util.concurrent.Executor;
-import org.jboss.cx.remoting.RemotingException;
-
-/**
- *
- */
-public interface RequestServer<I> {
-
- // Outbound protocol messages
-
- void handleRequest(I request, final Executor streamExecutor) throws
RemotingException;
-
- void handleCancelRequest(boolean mayInterrupt) throws RemotingException;
-}
Deleted: remoting3/trunk/core/src/main/java/org/jboss/cx/remoting/core/ServiceClient.java
===================================================================
---
remoting3/trunk/core/src/main/java/org/jboss/cx/remoting/core/ServiceClient.java 2008-04-16
01:40:57 UTC (rev 3991)
+++
remoting3/trunk/core/src/main/java/org/jboss/cx/remoting/core/ServiceClient.java 2008-04-16
02:04:26 UTC (rev 3992)
@@ -1,10 +0,0 @@
-package org.jboss.cx.remoting.core;
-
-import org.jboss.cx.remoting.RemotingException;
-
-/**
- *
- */
-public interface ServiceClient {
- void handleClosing() throws RemotingException;
-}
Copied:
remoting3/trunk/core/src/main/java/org/jboss/cx/remoting/core/ServiceInitiator.java (from
rev 3985,
remoting3/trunk/core/src/main/java/org/jboss/cx/remoting/core/ServiceClient.java)
===================================================================
--- remoting3/trunk/core/src/main/java/org/jboss/cx/remoting/core/ServiceInitiator.java
(rev 0)
+++
remoting3/trunk/core/src/main/java/org/jboss/cx/remoting/core/ServiceInitiator.java 2008-04-16
02:04:26 UTC (rev 3992)
@@ -0,0 +1,10 @@
+package org.jboss.cx.remoting.core;
+
+import org.jboss.cx.remoting.RemotingException;
+
+/**
+ *
+ */
+public interface ServiceInitiator {
+ void handleClosing() throws RemotingException;
+}
Copied:
remoting3/trunk/core/src/main/java/org/jboss/cx/remoting/core/ServiceResponder.java (from
rev 3985,
remoting3/trunk/core/src/main/java/org/jboss/cx/remoting/core/ServiceServer.java)
===================================================================
--- remoting3/trunk/core/src/main/java/org/jboss/cx/remoting/core/ServiceResponder.java
(rev 0)
+++
remoting3/trunk/core/src/main/java/org/jboss/cx/remoting/core/ServiceResponder.java 2008-04-16
02:04:26 UTC (rev 3992)
@@ -0,0 +1,12 @@
+package org.jboss.cx.remoting.core;
+
+import org.jboss.cx.remoting.RemotingException;
+
+/**
+ *
+ */
+public interface ServiceResponder<I, O> {
+ void handleClose() throws RemotingException;
+
+ ClientResponder<I, O> createNewClient(ClientInitiator clientInitiator) throws
RemotingException;
+}
Deleted: remoting3/trunk/core/src/main/java/org/jboss/cx/remoting/core/ServiceServer.java
===================================================================
---
remoting3/trunk/core/src/main/java/org/jboss/cx/remoting/core/ServiceServer.java 2008-04-16
01:40:57 UTC (rev 3991)
+++
remoting3/trunk/core/src/main/java/org/jboss/cx/remoting/core/ServiceServer.java 2008-04-16
02:04:26 UTC (rev 3992)
@@ -1,12 +0,0 @@
-package org.jboss.cx.remoting.core;
-
-import org.jboss.cx.remoting.RemotingException;
-
-/**
- *
- */
-public interface ServiceServer<I, O> {
- void handleClose() throws RemotingException;
-
- ContextServer<I, O> createNewContext(ContextClient client) throws
RemotingException;
-}
Modified:
remoting3/trunk/core/src/main/java/org/jboss/cx/remoting/core/protocol/LocalProtocolHandler.java
===================================================================
---
remoting3/trunk/core/src/main/java/org/jboss/cx/remoting/core/protocol/LocalProtocolHandler.java 2008-04-16
01:40:57 UTC (rev 3991)
+++
remoting3/trunk/core/src/main/java/org/jboss/cx/remoting/core/protocol/LocalProtocolHandler.java 2008-04-16
02:04:26 UTC (rev 3992)
@@ -4,12 +4,12 @@
import java.util.concurrent.Executor;
import org.jboss.cx.remoting.RemoteExecutionException;
import org.jboss.cx.remoting.spi.ObjectMessageOutput;
-import org.jboss.cx.remoting.spi.protocol.ContextIdentifier;
+import org.jboss.cx.remoting.spi.protocol.ClientIdentifier;
import org.jboss.cx.remoting.spi.protocol.ProtocolContext;
import org.jboss.cx.remoting.spi.protocol.ProtocolHandler;
import org.jboss.cx.remoting.spi.protocol.RequestIdentifier;
import org.jboss.cx.remoting.spi.protocol.ServiceIdentifier;
-import org.jboss.cx.remoting.spi.protocol.SimpleContextIdentifier;
+import org.jboss.cx.remoting.spi.protocol.SimpleClientIdentifier;
import org.jboss.cx.remoting.spi.protocol.SimpleRequestIdentifier;
import org.jboss.cx.remoting.spi.protocol.StreamIdentifier;
@@ -19,50 +19,50 @@
public final class LocalProtocolHandler implements ProtocolHandler {
private final ProtocolContext target;
private String remoteEndpointName;
- private static final ContextIdentifier ROOT_IDENTIFIER = new
SimpleContextIdentifier();
+ private static final ClientIdentifier ROOT_IDENTIFIER = new
SimpleClientIdentifier();
public LocalProtocolHandler(final ProtocolContext target, final String
remoteEndpointName) {
this.target = target;
this.remoteEndpointName = remoteEndpointName;
}
- public void sendReply(final ContextIdentifier remoteContextIdentifier, final
RequestIdentifier requestIdentifier, final Object reply) throws IOException {
- target.receiveReply(remoteContextIdentifier, requestIdentifier, reply);
+ public void sendReply(final ClientIdentifier remoteClientIdentifier, final
RequestIdentifier requestIdentifier, final Object reply) throws IOException {
+ target.receiveReply(remoteClientIdentifier, requestIdentifier, reply);
}
- public void sendException(final ContextIdentifier remoteContextIdentifier, final
RequestIdentifier requestIdentifier, final RemoteExecutionException exception) throws
IOException {
- target.receiveException(remoteContextIdentifier, requestIdentifier, exception);
+ public void sendException(final ClientIdentifier remoteClientIdentifier, final
RequestIdentifier requestIdentifier, final RemoteExecutionException exception) throws
IOException {
+ target.receiveException(remoteClientIdentifier, requestIdentifier, exception);
}
- public void sendCancelAcknowledge(final ContextIdentifier remoteContextIdentifier,
final RequestIdentifier requestIdentifier) throws IOException {
- target.receiveCancelAcknowledge(remoteContextIdentifier, requestIdentifier);
+ public void sendCancelAcknowledge(final ClientIdentifier remoteClientIdentifier,
final RequestIdentifier requestIdentifier) throws IOException {
+ target.receiveCancelAcknowledge(remoteClientIdentifier, requestIdentifier);
}
public void sendServiceClosing(final ServiceIdentifier remoteServiceIdentifier)
throws IOException {
target.receiveServiceClosing(remoteServiceIdentifier);
}
- public void sendContextClosing(final ContextIdentifier remoteContextIdentifier, final
boolean done) throws IOException {
- target.receiveContextClosing(remoteContextIdentifier, done);
+ public void sendClientClosing(final ClientIdentifier remoteClientIdentifier, final
boolean done) throws IOException {
+ target.receiveClientClosing(remoteClientIdentifier, done);
}
- public ContextIdentifier getLocalRootContextIdentifier() {
+ public ClientIdentifier getLocalRootClientIdentifier() {
return ROOT_IDENTIFIER;
}
- public ContextIdentifier getRemoteRootContextIdentifier() {
+ public ClientIdentifier getRemoteRootClientIdentifier() {
return ROOT_IDENTIFIER;
}
- public ContextIdentifier openContext(final ServiceIdentifier serviceIdentifier)
throws IOException {
+ public ClientIdentifier openClient(final ServiceIdentifier serviceIdentifier) throws
IOException {
return null;
}
- public void sendContextClose(final ContextIdentifier contextIdentifier, final boolean
immediate, final boolean cancel, final boolean interrupt) throws IOException {
- target.receiveContextClose(contextIdentifier, immediate, cancel, interrupt);
+ public void sendClientClose(final ClientIdentifier clientIdentifier, final boolean
immediate, final boolean cancel, final boolean interrupt) throws IOException {
+ target.receiveClientClose(clientIdentifier, immediate, cancel, interrupt);
}
- public RequestIdentifier openRequest(final ContextIdentifier contextIdentifier)
throws IOException {
+ public RequestIdentifier openRequest(final ClientIdentifier clientIdentifier) throws
IOException {
return new SimpleRequestIdentifier();
}
@@ -70,15 +70,15 @@
target.receiveServiceClose(serviceIdentifier);
}
- public void sendRequest(final ContextIdentifier contextIdentifier, final
RequestIdentifier requestIdentifier, final Object request, final Executor streamExecutor)
throws IOException {
- target.receiveRequest(contextIdentifier, requestIdentifier, request);
+ public void sendRequest(final ClientIdentifier clientIdentifier, final
RequestIdentifier requestIdentifier, final Object request, final Executor streamExecutor)
throws IOException {
+ target.receiveRequest(clientIdentifier, requestIdentifier, request);
}
- public void sendCancelRequest(final ContextIdentifier contextIdentifier, final
RequestIdentifier requestIdentifier, final boolean mayInterrupt) throws IOException {
- target.receiveCancelRequest(contextIdentifier, requestIdentifier, mayInterrupt);
+ public void sendCancelRequest(final ClientIdentifier clientIdentifier, final
RequestIdentifier requestIdentifier, final boolean mayInterrupt) throws IOException {
+ target.receiveCancelRequest(clientIdentifier, requestIdentifier, mayInterrupt);
}
- public ContextIdentifier openContext() throws IOException {
+ public ClientIdentifier openClient() throws IOException {
return null;
}
Modified:
remoting3/trunk/core/src/main/java/org/jboss/cx/remoting/core/service/ClassLoaderResourceListener.java
===================================================================
---
remoting3/trunk/core/src/main/java/org/jboss/cx/remoting/core/service/ClassLoaderResourceListener.java 2008-04-16
01:40:57 UTC (rev 3991)
+++
remoting3/trunk/core/src/main/java/org/jboss/cx/remoting/core/service/ClassLoaderResourceListener.java 2008-04-16
02:04:26 UTC (rev 3992)
@@ -5,11 +5,9 @@
import java.net.URLConnection;
import java.util.Enumeration;
import org.jboss.cx.remoting.AbstractRequestListener;
-import org.jboss.cx.remoting.ContextContext;
import org.jboss.cx.remoting.IOExceptionCarrier;
import org.jboss.cx.remoting.RemoteExecutionException;
import org.jboss.cx.remoting.RequestContext;
-import org.jboss.cx.remoting.ServiceContext;
import org.jboss.cx.remoting.service.ClassLoaderResourceReply;
import org.jboss.cx.remoting.service.ClassLoaderResourceRequest;
import org.jboss.cx.remoting.service.RemoteResource;
Modified:
remoting3/trunk/core/src/main/java/org/jboss/cx/remoting/core/service/ServiceLocatorListener.java
===================================================================
---
remoting3/trunk/core/src/main/java/org/jboss/cx/remoting/core/service/ServiceLocatorListener.java 2008-04-16
01:40:57 UTC (rev 3991)
+++
remoting3/trunk/core/src/main/java/org/jboss/cx/remoting/core/service/ServiceLocatorListener.java 2008-04-16
02:04:26 UTC (rev 3992)
@@ -4,8 +4,8 @@
import java.util.SortedMap;
import java.util.concurrent.ConcurrentMap;
import org.jboss.cx.remoting.AbstractRequestListener;
-import org.jboss.cx.remoting.Context;
-import org.jboss.cx.remoting.ContextSource;
+import org.jboss.cx.remoting.Client;
+import org.jboss.cx.remoting.ClientSource;
import org.jboss.cx.remoting.RemoteExecutionException;
import org.jboss.cx.remoting.RequestContext;
import org.jboss.cx.remoting.service.ServiceReply;
@@ -24,7 +24,7 @@
String getType();
// todo - add in whatever negotation to the request object (security?)
- <X, Y> Context<Void, ServiceReply<X, Y>> getServiceChannel();
+ <X, Y> Client<Void, ServiceReply<X, Y>> getServiceChannel();
}
private interface Peer {
@@ -32,7 +32,7 @@
int getCost();
- <X, Y> Context<ServiceRequest<X, Y>, ServiceReply<X, Y>>
getLocatorContext();
+ <X, Y> Client<ServiceRequest<X, Y>, ServiceReply<X, Y>>
getLocatorClient();
SortedMap<String, Service> getServicesByGroupName();
@@ -43,7 +43,7 @@
return CollectionUtil.synchronizedMap(CollectionUtil.<K, V>hashMap());
}
- private final ConcurrentMap<String, ConcurrentMap<String, ContextSource<?,
?>>> deployments = syncMap();
+ private final ConcurrentMap<String, ConcurrentMap<String, ClientSource<?,
?>>> deployments = syncMap();
public void handleRequest(final RequestContext<ServiceReply<I, O>>
requestContext, final ServiceRequest<I, O> request) throws RemoteExecutionException,
InterruptedException {
final URI uri = request.getUri();
Modified:
remoting3/trunk/http/src/main/java/org/jboss/cx/remoting/http/RemotingHttpSession.java
===================================================================
---
remoting3/trunk/http/src/main/java/org/jboss/cx/remoting/http/RemotingHttpSession.java 2008-04-16
01:40:57 UTC (rev 3991)
+++
remoting3/trunk/http/src/main/java/org/jboss/cx/remoting/http/RemotingHttpSession.java 2008-04-16
02:04:26 UTC (rev 3992)
@@ -13,7 +13,7 @@
import org.jboss.cx.remoting.http.spi.RemotingHttpSessionContext;
import org.jboss.cx.remoting.spi.ByteMessageOutput;
import org.jboss.cx.remoting.spi.ObjectMessageOutput;
-import org.jboss.cx.remoting.spi.protocol.ContextIdentifier;
+import org.jboss.cx.remoting.spi.protocol.ClientIdentifier;
import org.jboss.cx.remoting.spi.protocol.ProtocolContext;
import org.jboss.cx.remoting.spi.protocol.ProtocolHandler;
import org.jboss.cx.remoting.spi.protocol.RequestIdentifier;
@@ -116,50 +116,50 @@
private final class ProtocolHandlerImpl implements ProtocolHandler {
- public void sendReply(final ContextIdentifier remoteContextIdentifier, final
RequestIdentifier requestIdentifier, final Object reply) throws IOException {
+ public void sendReply(final ClientIdentifier remoteClientIdentifier, final
RequestIdentifier requestIdentifier, final Object reply) throws IOException {
}
- public void sendException(final ContextIdentifier remoteContextIdentifier, final
RequestIdentifier requestIdentifier, final RemoteExecutionException exception) throws
IOException {
+ public void sendException(final ClientIdentifier remoteClientIdentifier, final
RequestIdentifier requestIdentifier, final RemoteExecutionException exception) throws
IOException {
}
- public void sendCancelAcknowledge(final ContextIdentifier
remoteContextIdentifier, final RequestIdentifier requestIdentifier) throws IOException {
+ public void sendCancelAcknowledge(final ClientIdentifier remoteClientIdentifier,
final RequestIdentifier requestIdentifier) throws IOException {
}
public void sendServiceClosing(final ServiceIdentifier remoteServiceIdentifier)
throws IOException {
}
- public void sendContextClosing(final ContextIdentifier remoteContextIdentifier,
final boolean done) throws IOException {
+ public void sendClientClosing(final ClientIdentifier remoteClientIdentifier,
final boolean done) throws IOException {
}
- public ContextIdentifier getLocalRootContextIdentifier() {
+ public ClientIdentifier getLocalRootClientIdentifier() {
return null;
}
- public ContextIdentifier getRemoteRootContextIdentifier() {
+ public ClientIdentifier getRemoteRootClientIdentifier() {
return null;
}
- public ContextIdentifier openContext(final ServiceIdentifier serviceIdentifier)
throws IOException {
+ public ClientIdentifier openClient(final ServiceIdentifier serviceIdentifier)
throws IOException {
return null;
}
- public void sendContextClose(final ContextIdentifier contextIdentifier, final
boolean immediate, final boolean cancel, final boolean interrupt) throws IOException {
+ public void sendClientClose(final ClientIdentifier clientIdentifier, final
boolean immediate, final boolean cancel, final boolean interrupt) throws IOException {
}
- public RequestIdentifier openRequest(final ContextIdentifier contextIdentifier)
throws IOException {
+ public RequestIdentifier openRequest(final ClientIdentifier clientIdentifier)
throws IOException {
return null;
}
public void sendServiceClose(final ServiceIdentifier serviceIdentifier) throws
IOException {
}
- public void sendRequest(final ContextIdentifier contextIdentifier, final
RequestIdentifier requestIdentifier, final Object request, final Executor streamExecutor)
throws IOException {
+ public void sendRequest(final ClientIdentifier clientIdentifier, final
RequestIdentifier requestIdentifier, final Object request, final Executor streamExecutor)
throws IOException {
}
- public void sendCancelRequest(final ContextIdentifier contextIdentifier, final
RequestIdentifier requestIdentifier, final boolean mayInterrupt) throws IOException {
+ public void sendCancelRequest(final ClientIdentifier clientIdentifier, final
RequestIdentifier requestIdentifier, final boolean mayInterrupt) throws IOException {
}
- public ContextIdentifier openContext() throws IOException {
+ public ClientIdentifier openClient() throws IOException {
return null;
}
Modified: remoting3/trunk/http-mina-client/.project
===================================================================
--- remoting3/trunk/http-mina-client/.project 2008-04-16 01:40:57 UTC (rev 3991)
+++ remoting3/trunk/http-mina-client/.project 2008-04-16 02:04:26 UTC (rev 3992)
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
- <name>remoting3-http-mina-client</name>
+ <name>remoting3-http-mina-clientInitiator</name>
<comment></comment>
<projects>
</projects>
Modified:
remoting3/trunk/jrpp/src/main/java/org/jboss/cx/remoting/jrpp/JrppConnection.java
===================================================================
---
remoting3/trunk/jrpp/src/main/java/org/jboss/cx/remoting/jrpp/JrppConnection.java 2008-04-16
01:40:57 UTC (rev 3991)
+++
remoting3/trunk/jrpp/src/main/java/org/jboss/cx/remoting/jrpp/JrppConnection.java 2008-04-16
02:04:26 UTC (rev 3992)
@@ -20,7 +20,7 @@
import org.apache.mina.handler.multiton.SingleSessionIoHandler;
import org.jboss.cx.remoting.CommonKeys;
import org.jboss.cx.remoting.RemoteExecutionException;
-import org.jboss.cx.remoting.jrpp.id.JrppContextIdentifier;
+import org.jboss.cx.remoting.jrpp.id.JrppClientIdentifier;
import org.jboss.cx.remoting.jrpp.id.JrppRequestIdentifier;
import org.jboss.cx.remoting.jrpp.id.JrppServiceIdentifier;
import org.jboss.cx.remoting.jrpp.id.JrppStreamIdentifier;
@@ -29,7 +29,7 @@
import org.jboss.cx.remoting.log.Logger;
import org.jboss.cx.remoting.spi.ObjectMessageInput;
import org.jboss.cx.remoting.spi.ObjectMessageOutput;
-import org.jboss.cx.remoting.spi.protocol.ContextIdentifier;
+import org.jboss.cx.remoting.spi.protocol.ClientIdentifier;
import org.jboss.cx.remoting.spi.protocol.ProtocolContext;
import org.jboss.cx.remoting.spi.protocol.ProtocolHandler;
import org.jboss.cx.remoting.spi.protocol.RequestIdentifier;
@@ -84,11 +84,11 @@
private final AtomicInteger serviceIdSequence = new AtomicInteger(0);
private final AtomicInteger requestIdSequence = new AtomicInteger(0);
- private ContextIdentifier localRootContextIdentifier;
- private ContextIdentifier remoteRootContextIdentifier;
+ private ClientIdentifier localRootClientIdentifier;
+ private ClientIdentifier remoteRootClientIdentifier;
private final Set<StreamIdentifier> liveStreamSet =
CollectionUtil.synchronizedSet(new WeakHashSet<StreamIdentifier>());
- private final Set<ContextIdentifier> liveContextSet =
CollectionUtil.synchronizedSet(new WeakHashSet<ContextIdentifier>());
+ private final Set<ClientIdentifier> liveClientSet =
CollectionUtil.synchronizedSet(new WeakHashSet<ClientIdentifier>());
private final Set<RequestIdentifier> liveRequestSet =
CollectionUtil.synchronizedSet(new WeakHashSet<RequestIdentifier>());
private final Set<ServiceIdentifier> liveServiceSet =
CollectionUtil.synchronizedSet(new WeakHashSet<ServiceIdentifier>());
@@ -160,8 +160,8 @@
ioSession.setAttribute(JRPP_CONNECTION, this);
this.ioSession = ioSession;
client = true;
- remoteRootContextIdentifier = new JrppContextIdentifier(false, 0);
- localRootContextIdentifier = new JrppContextIdentifier(true, 0);
+ remoteRootClientIdentifier = new JrppClientIdentifier(false, 0);
+ localRootClientIdentifier = new JrppClientIdentifier(true, 0);
} finally {
state.releaseExclusive();
}
@@ -176,8 +176,8 @@
ioSession.setAttribute(JRPP_CONNECTION, this);
this.ioSession = ioSession;
client = false;
- remoteRootContextIdentifier = new JrppContextIdentifier(true, 0);
- localRootContextIdentifier = new JrppContextIdentifier(false, 0);
+ remoteRootClientIdentifier = new JrppClientIdentifier(true, 0);
+ localRootClientIdentifier = new JrppClientIdentifier(false, 0);
} finally {
state.releaseExclusive();
}
@@ -331,8 +331,8 @@
output.writeObject(serviceIdentifier);
}
- private void write(ObjectOutput output, ContextIdentifier contextIdentifier) throws
IOException {
- output.writeObject(contextIdentifier);
+ private void write(ObjectOutput output, ClientIdentifier clientIdentifier) throws
IOException {
+ output.writeObject(clientIdentifier);
}
private void write(ObjectOutput output, StreamIdentifier streamIdentifier) throws
IOException {
@@ -418,10 +418,10 @@
}
}
- private JrppContextIdentifier getNewContextIdentifier() {
+ private JrppClientIdentifier getNewContextIdentifier() {
for (;;) {
- final JrppContextIdentifier contextIdentifier = new
JrppContextIdentifier(client, contextIdSequence.getAndIncrement());
- if (liveContextSet.add(contextIdentifier)) {
+ final JrppClientIdentifier contextIdentifier = new
JrppClientIdentifier(client, contextIdSequence.getAndIncrement());
+ if (liveClientSet.add(contextIdentifier)) {
return contextIdentifier;
}
}
@@ -459,22 +459,22 @@
}
public final class RemotingProtocolHandler implements ProtocolHandler {
- public void sendContextClosing(final ContextIdentifier remoteContextIdentifier,
final boolean done) throws IOException {
+ public void sendClientClosing(final ClientIdentifier remoteClientIdentifier,
final boolean done) throws IOException {
// todo
}
- public ContextIdentifier openContext(ServiceIdentifier serviceIdentifier) throws
IOException {
- final ContextIdentifier contextIdentifier = getNewContextIdentifier();
+ public ClientIdentifier openClient(ServiceIdentifier serviceIdentifier) throws
IOException {
+ final ClientIdentifier clientIdentifier = getNewContextIdentifier();
final IoBuffer buffer = newBuffer(60, false);
final ObjectMessageOutput output = protocolContext.getMessageOutput(new
IoBufferByteMessageOutput(buffer, ioSession));
write(output, MessageType.OPEN_CONTEXT);
write(output, serviceIdentifier);
- write(output, contextIdentifier);
+ write(output, clientIdentifier);
output.commit();
- return contextIdentifier;
+ return clientIdentifier;
}
- public RequestIdentifier openRequest(ContextIdentifier contextIdentifier) throws
IOException {
+ public RequestIdentifier openRequest(ClientIdentifier clientIdentifier) throws
IOException {
return getNewRequestIdentifier();
}
@@ -508,14 +508,14 @@
output.commit();
}
- public void sendContextClose(ContextIdentifier contextIdentifier, final boolean
immediate, final boolean cancel, final boolean interrupt) throws IOException {
+ public void sendClientClose(ClientIdentifier clientIdentifier, final boolean
immediate, final boolean cancel, final boolean interrupt) throws IOException {
if (! state.in(State.UP)) {
return;
}
final IoBuffer buffer = newBuffer(300, false);
final ObjectMessageOutput output = protocolContext.getMessageOutput(new
IoBufferByteMessageOutput(buffer, ioSession));
write(output, MessageType.CLOSE_CONTEXT);
- write(output, contextIdentifier);
+ write(output, clientIdentifier);
output.commit();
}
@@ -533,9 +533,9 @@
}
}
- public void sendReply(ContextIdentifier remoteContextIdentifier,
RequestIdentifier requestIdentifier, Object reply) throws IOException {
- if (remoteContextIdentifier == null) {
- throw new NullPointerException("remoteContextIdentifier is
null");
+ public void sendReply(ClientIdentifier remoteClientIdentifier, RequestIdentifier
requestIdentifier, Object reply) throws IOException {
+ if (remoteClientIdentifier == null) {
+ throw new NullPointerException("remoteClientIdentifier is
null");
}
if (requestIdentifier == null) {
throw new NullPointerException("requestIdentifier is null");
@@ -543,15 +543,15 @@
final IoBuffer buffer = newBuffer(500, true);
final ObjectMessageOutput output = protocolContext.getMessageOutput(new
IoBufferByteMessageOutput(buffer, ioSession));
write(output, MessageType.REPLY);
- write(output, remoteContextIdentifier);
+ write(output, remoteClientIdentifier);
write(output, requestIdentifier);
output.writeObject(reply);
output.commit();
}
- public void sendException(ContextIdentifier remoteContextIdentifier,
RequestIdentifier requestIdentifier, RemoteExecutionException exception) throws
IOException {
- if (remoteContextIdentifier == null) {
- throw new NullPointerException("remoteContextIdentifier is
null");
+ public void sendException(ClientIdentifier remoteClientIdentifier,
RequestIdentifier requestIdentifier, RemoteExecutionException exception) throws
IOException {
+ if (remoteClientIdentifier == null) {
+ throw new NullPointerException("remoteClientIdentifier is
null");
}
if (requestIdentifier == null) {
throw new NullPointerException("requestIdentifier is null");
@@ -562,15 +562,15 @@
final IoBuffer buffer = newBuffer(500, true);
final ObjectMessageOutput output = protocolContext.getMessageOutput(new
IoBufferByteMessageOutput(buffer, ioSession));
write(output, MessageType.EXCEPTION);
- write(output, remoteContextIdentifier);
+ write(output, remoteClientIdentifier);
write(output, requestIdentifier);
output.writeObject(exception);
output.commit();
}
- public void sendRequest(ContextIdentifier contextIdentifier, RequestIdentifier
requestIdentifier, Object request, final Executor streamExecutor) throws IOException {
- if (contextIdentifier == null) {
- throw new NullPointerException("contextIdentifier is null");
+ public void sendRequest(ClientIdentifier clientIdentifier, RequestIdentifier
requestIdentifier, Object request, final Executor streamExecutor) throws IOException {
+ if (clientIdentifier == null) {
+ throw new NullPointerException("clientIdentifier is null");
}
if (requestIdentifier == null) {
throw new NullPointerException("requestIdentifier is null");
@@ -578,15 +578,15 @@
final IoBuffer buffer = newBuffer(500, true);
final ObjectMessageOutput output = protocolContext.getMessageOutput(new
IoBufferByteMessageOutput(buffer, ioSession), streamExecutor);
write(output, MessageType.REQUEST);
- write(output, contextIdentifier);
+ write(output, clientIdentifier);
write(output, requestIdentifier);
output.writeObject(request);
output.commit();
}
- public void sendCancelAcknowledge(ContextIdentifier remoteContextIdentifier,
RequestIdentifier requestIdentifier) throws IOException {
- if (remoteContextIdentifier == null) {
- throw new NullPointerException("remoteContextIdentifier is
null");
+ public void sendCancelAcknowledge(ClientIdentifier remoteClientIdentifier,
RequestIdentifier requestIdentifier) throws IOException {
+ if (remoteClientIdentifier == null) {
+ throw new NullPointerException("remoteClientIdentifier is
null");
}
if (requestIdentifier == null) {
throw new NullPointerException("requestIdentifier is null");
@@ -594,7 +594,7 @@
final IoBuffer buffer = newBuffer(60, false);
final ObjectMessageOutput output = protocolContext.getMessageOutput(new
IoBufferByteMessageOutput(buffer, ioSession));
write(output, MessageType.CANCEL_ACK);
- write(output, remoteContextIdentifier);
+ write(output, remoteClientIdentifier);
write(output, requestIdentifier);
output.commit();
}
@@ -610,17 +610,17 @@
output.commit();
}
- public ContextIdentifier getLocalRootContextIdentifier() {
- return localRootContextIdentifier;
+ public ClientIdentifier getLocalRootClientIdentifier() {
+ return localRootClientIdentifier;
}
- public ContextIdentifier getRemoteRootContextIdentifier() {
- return remoteRootContextIdentifier;
+ public ClientIdentifier getRemoteRootClientIdentifier() {
+ return remoteRootClientIdentifier;
}
- public void sendCancelRequest(ContextIdentifier contextIdentifier,
RequestIdentifier requestIdentifier, boolean mayInterrupt) throws IOException {
- if (contextIdentifier == null) {
- throw new NullPointerException("contextIdentifier is null");
+ public void sendCancelRequest(ClientIdentifier clientIdentifier,
RequestIdentifier requestIdentifier, boolean mayInterrupt) throws IOException {
+ if (clientIdentifier == null) {
+ throw new NullPointerException("clientIdentifier is null");
}
if (requestIdentifier == null) {
throw new NullPointerException("requestIdentifier is null");
@@ -628,13 +628,13 @@
final IoBuffer buffer = newBuffer(60, false);
final ObjectMessageOutput output = protocolContext.getMessageOutput(new
IoBufferByteMessageOutput(buffer, ioSession));
write(output, MessageType.CANCEL_REQ);
- write(output, contextIdentifier);
+ write(output, clientIdentifier);
write(output, requestIdentifier);
output.writeBoolean(mayInterrupt);
output.commit();
}
- public ContextIdentifier openContext() throws IOException {
+ public ClientIdentifier openClient() throws IOException {
return null;
}
@@ -907,26 +907,26 @@
switch (type) {
case OPEN_CONTEXT: {
final ServiceIdentifier serviceIdentifier =
(ServiceIdentifier) input.readObject();
- final ContextIdentifier contextIdentifier =
(ContextIdentifier) input.readObject();
- protocolContext.receiveOpenedContext(serviceIdentifier,
contextIdentifier);
+ final ClientIdentifier clientIdentifier = (ClientIdentifier)
input.readObject();
+ protocolContext.receiveOpenedContext(serviceIdentifier,
clientIdentifier);
return;
}
case CANCEL_ACK: {
- final ContextIdentifier contextIdentifier =
(ContextIdentifier) input.readObject();
+ final ClientIdentifier clientIdentifier = (ClientIdentifier)
input.readObject();
final RequestIdentifier requestIdentifier =
(RequestIdentifier) input.readObject();
- protocolContext.receiveCancelAcknowledge(contextIdentifier,
requestIdentifier);
+ protocolContext.receiveCancelAcknowledge(clientIdentifier,
requestIdentifier);
return;
}
case CANCEL_REQ: {
- final ContextIdentifier contextIdentifier =
(ContextIdentifier) input.readObject();
+ final ClientIdentifier clientIdentifier = (ClientIdentifier)
input.readObject();
final RequestIdentifier requestIdentifier =
(RequestIdentifier) input.readObject();
final boolean mayInterrupt = input.readBoolean();
- protocolContext.receiveCancelRequest(contextIdentifier,
requestIdentifier, mayInterrupt);
+ protocolContext.receiveCancelRequest(clientIdentifier,
requestIdentifier, mayInterrupt);
return;
}
case CLOSE_CONTEXT: {
- final ContextIdentifier contextIdentifier =
(ContextIdentifier) input.readObject();
- protocolContext.receiveContextClose(contextIdentifier, false,
false, false);
+ final ClientIdentifier clientIdentifier = (ClientIdentifier)
input.readObject();
+ protocolContext.receiveClientClose(clientIdentifier, false,
false, false);
return;
}
case CLOSE_SERVICE: {
@@ -940,27 +940,27 @@
return;
}
case EXCEPTION: {
- final ContextIdentifier contextIdentifier =
(ContextIdentifier) input.readObject();
+ final ClientIdentifier clientIdentifier = (ClientIdentifier)
input.readObject();
final RequestIdentifier requestIdentifier =
(RequestIdentifier) input.readObject();
final RemoteExecutionException exception =
(RemoteExecutionException) input.readObject();
- protocolContext.receiveException(contextIdentifier,
requestIdentifier, exception);
+ protocolContext.receiveException(clientIdentifier,
requestIdentifier, exception);
return;
}
case REPLY: {
- final ContextIdentifier contextIdentifier =
(ContextIdentifier) input.readObject();
+ final ClientIdentifier clientIdentifier = (ClientIdentifier)
input.readObject();
final RequestIdentifier requestIdentifier =
(RequestIdentifier) input.readObject();
final Object reply = input.readObject();
- protocolContext.receiveReply(contextIdentifier,
requestIdentifier, reply);
+ protocolContext.receiveReply(clientIdentifier,
requestIdentifier, reply);
return;
}
case REQUEST: {
- final ContextIdentifier contextIdentifier =
(ContextIdentifier) input.readObject();
+ final ClientIdentifier clientIdentifier = (ClientIdentifier)
input.readObject();
final RequestIdentifier requestIdentifier =
(RequestIdentifier) input.readObject();
final Object request = input.readObject();
if (trace) {
log.trace("Received request - body is %s",
request);
}
- protocolContext.receiveRequest(contextIdentifier,
requestIdentifier, request);
+ protocolContext.receiveRequest(clientIdentifier,
requestIdentifier, request);
return;
}
case SERVICE_TERMINATE: {
Copied:
remoting3/trunk/jrpp/src/main/java/org/jboss/cx/remoting/jrpp/id/JrppClientIdentifier.java
(from rev 3986,
remoting3/trunk/jrpp/src/main/java/org/jboss/cx/remoting/jrpp/id/JrppContextIdentifier.java)
===================================================================
---
remoting3/trunk/jrpp/src/main/java/org/jboss/cx/remoting/jrpp/id/JrppClientIdentifier.java
(rev 0)
+++
remoting3/trunk/jrpp/src/main/java/org/jboss/cx/remoting/jrpp/id/JrppClientIdentifier.java 2008-04-16
02:04:26 UTC (rev 3992)
@@ -0,0 +1,23 @@
+package org.jboss.cx.remoting.jrpp.id;
+
+import org.jboss.cx.remoting.spi.protocol.ClientIdentifier;
+
+/**
+ *
+ */
+@SuppressWarnings ({"EqualsAndHashcode"})
+public final class JrppClientIdentifier extends JrppSubChannelIdentifier implements
ClientIdentifier {
+
+ private static final long serialVersionUID = 1L;
+
+ public JrppClientIdentifier() {
+ }
+
+ public JrppClientIdentifier(final boolean client, final int id) {
+ super(client, id);
+ }
+
+ public boolean equals(Object obj) {
+ return obj instanceof JrppClientIdentifier && super.equals(obj);
+ }
+}
Deleted:
remoting3/trunk/jrpp/src/main/java/org/jboss/cx/remoting/jrpp/id/JrppContextIdentifier.java
===================================================================
---
remoting3/trunk/jrpp/src/main/java/org/jboss/cx/remoting/jrpp/id/JrppContextIdentifier.java 2008-04-16
01:40:57 UTC (rev 3991)
+++
remoting3/trunk/jrpp/src/main/java/org/jboss/cx/remoting/jrpp/id/JrppContextIdentifier.java 2008-04-16
02:04:26 UTC (rev 3992)
@@ -1,23 +0,0 @@
-package org.jboss.cx.remoting.jrpp.id;
-
-import org.jboss.cx.remoting.spi.protocol.ContextIdentifier;
-
-/**
- *
- */
-@SuppressWarnings ({"EqualsAndHashcode"})
-public final class JrppContextIdentifier extends JrppSubChannelIdentifier implements
ContextIdentifier {
-
- private static final long serialVersionUID = 1L;
-
- public JrppContextIdentifier() {
- }
-
- public JrppContextIdentifier(final boolean client, final int id) {
- super(client, id);
- }
-
- public boolean equals(Object obj) {
- return obj instanceof JrppContextIdentifier && super.equals(obj);
- }
-}
Modified:
remoting3/trunk/samples/src/main/java/org/jboss/cx/remoting/samples/simple/JrppBasicExampleMain.java
===================================================================
---
remoting3/trunk/samples/src/main/java/org/jboss/cx/remoting/samples/simple/JrppBasicExampleMain.java 2008-04-16
01:40:57 UTC (rev 3991)
+++
remoting3/trunk/samples/src/main/java/org/jboss/cx/remoting/samples/simple/JrppBasicExampleMain.java 2008-04-16
02:04:26 UTC (rev 3992)
@@ -5,7 +5,7 @@
import java.net.URI;
import java.net.URISyntaxException;
import java.security.Security;
-import org.jboss.cx.remoting.Context;
+import org.jboss.cx.remoting.Client;
import org.jboss.cx.remoting.Endpoint;
import org.jboss.cx.remoting.RemoteExecutionException;
import org.jboss.cx.remoting.Remoting;
@@ -26,13 +26,13 @@
Remoting.addJrppServer(endpoint, new InetSocketAddress(12345),
AttributeMap.EMPTY);
Session session = endpoint.openSession(new
URI("jrpp://localhost:12345"), AttributeMap.EMPTY);
try {
- final Context<String,String> context = session.getRootContext();
+ final Client<String,String> client = session.getRootContext();
try {
final String original = "The Secret Message\n";
- final String result = context.invoke(original);
+ final String result = client.invoke(original);
System.out.printf("The secret message \"%s\" became
\"%s\"!\n", original.trim(), result.trim());
} finally {
- context.close();
+ client.close();
}
} finally {
session.close();
Modified:
remoting3/trunk/samples/src/main/java/org/jboss/cx/remoting/samples/simple/JrppStreamExampleMain.java
===================================================================
---
remoting3/trunk/samples/src/main/java/org/jboss/cx/remoting/samples/simple/JrppStreamExampleMain.java 2008-04-16
01:40:57 UTC (rev 3991)
+++
remoting3/trunk/samples/src/main/java/org/jboss/cx/remoting/samples/simple/JrppStreamExampleMain.java 2008-04-16
02:04:26 UTC (rev 3992)
@@ -8,7 +8,7 @@
import java.net.URI;
import java.net.URISyntaxException;
import java.security.Security;
-import org.jboss.cx.remoting.Context;
+import org.jboss.cx.remoting.Client;
import org.jboss.cx.remoting.Endpoint;
import org.jboss.cx.remoting.RemoteExecutionException;
import org.jboss.cx.remoting.Remoting;
@@ -29,12 +29,12 @@
Remoting.addJrppServer(endpoint, new InetSocketAddress(12345),
AttributeMap.EMPTY);
Session session = endpoint.openSession(new
URI("jrpp://localhost:12345"), AttributeMap.EMPTY);
try {
- final Context<Reader,Reader> context = session.getRootContext();
+ final Client<Reader,Reader> client = session.getRootContext();
try {
final String original = "The Secret Message\n";
final StringReader originalReader = new StringReader(original);
try {
- final Reader reader = context.send(originalReader).get();
+ final Reader reader = client.send(originalReader).get();
try {
final BufferedReader bufferedReader = new
BufferedReader(reader);
try {
@@ -50,7 +50,7 @@
originalReader.close();
}
} finally {
- context.close();
+ client.close();
}
} finally {
session.close();
Modified:
remoting3/trunk/samples/src/main/java/org/jboss/cx/remoting/samples/simple/LocalBasicExampleMain.java
===================================================================
---
remoting3/trunk/samples/src/main/java/org/jboss/cx/remoting/samples/simple/LocalBasicExampleMain.java 2008-04-16
01:40:57 UTC (rev 3991)
+++
remoting3/trunk/samples/src/main/java/org/jboss/cx/remoting/samples/simple/LocalBasicExampleMain.java 2008-04-16
02:04:26 UTC (rev 3992)
@@ -2,7 +2,7 @@
import java.io.IOException;
import java.security.Security;
-import org.jboss.cx.remoting.Context;
+import org.jboss.cx.remoting.Client;
import org.jboss.cx.remoting.Endpoint;
import org.jboss.cx.remoting.RemoteExecutionException;
import org.jboss.cx.remoting.Remoting;
@@ -18,13 +18,13 @@
final StringRot13RequestListener listener = new StringRot13RequestListener();
final Endpoint endpoint = Remoting.createEndpoint("simple", listener);
try {
- final Context<String,String> context =
endpoint.createContext(listener);
+ final Client<String,String> client = endpoint.createContext(listener);
try {
final String original = "The Secret Message\n";
- final String result = context.invoke(original);
+ final String result = client.invoke(original);
System.out.printf("The secret message \"%s\" became
\"%s\"!\n", original.trim(), result.trim());
} finally {
- context.close();
+ client.close();
}
} finally {
endpoint.close();
Modified:
remoting3/trunk/samples/src/main/java/org/jboss/cx/remoting/samples/simple/LocalStreamExampleMain.java
===================================================================
---
remoting3/trunk/samples/src/main/java/org/jboss/cx/remoting/samples/simple/LocalStreamExampleMain.java 2008-04-16
01:40:57 UTC (rev 3991)
+++
remoting3/trunk/samples/src/main/java/org/jboss/cx/remoting/samples/simple/LocalStreamExampleMain.java 2008-04-16
02:04:26 UTC (rev 3992)
@@ -5,7 +5,7 @@
import java.io.Reader;
import java.io.StringReader;
import java.security.Security;
-import org.jboss.cx.remoting.Context;
+import org.jboss.cx.remoting.Client;
import org.jboss.cx.remoting.Endpoint;
import org.jboss.cx.remoting.RemoteExecutionException;
import org.jboss.cx.remoting.Remoting;
@@ -21,12 +21,12 @@
final StreamingRot13RequestListener listener = new
StreamingRot13RequestListener();
final Endpoint endpoint = Remoting.createEndpoint("simple", listener);
try {
- final Context<Reader,Reader> context =
endpoint.createContext(listener);
+ final Client<Reader,Reader> client = endpoint.createContext(listener);
try {
final String original = "The Secret Message\n";
final StringReader originalReader = new StringReader(original);
try {
- final Reader reader = context.send(originalReader).get();
+ final Reader reader = client.send(originalReader).get();
try {
final BufferedReader bufferedReader = new
BufferedReader(reader);
try {
@@ -42,7 +42,7 @@
originalReader.close();
}
} finally {
- context.close();
+ client.close();
}
} finally {
endpoint.close();
Modified: remoting3/trunk/standalone/src/main/java/org/jboss/cx/remoting/Remoting.java
===================================================================
---
remoting3/trunk/standalone/src/main/java/org/jboss/cx/remoting/Remoting.java 2008-04-16
01:40:57 UTC (rev 3991)
+++
remoting3/trunk/standalone/src/main/java/org/jboss/cx/remoting/Remoting.java 2008-04-16
02:04:26 UTC (rev 3992)
@@ -73,7 +73,7 @@
return null;
}
- public static <I, O> ContextSource<I, O>
createEndpointAndOpenService(String endpointName, URI remoteUri, String userName, char[]
password, Class<I> requestType, Class<O> replyType, String serviceType, String
serviceGroupName) throws RemotingException {
+ public static <I, O> ClientSource<I, O>
createEndpointAndOpenService(String endpointName, URI remoteUri, String userName, char[]
password, Class<I> requestType, Class<O> replyType, String serviceType, String
serviceGroupName) throws RemotingException {
return null;
}