Author: david.lloyd(a)jboss.com
Date: 2008-10-22 20:10:17 -0400 (Wed, 22 Oct 2008)
New Revision: 4611
Modified:
remoting3/trunk/api/src/main/java/org/jboss/remoting/Client.java
remoting3/trunk/api/src/main/java/org/jboss/remoting/spi/remote/RequestHandler.java
remoting3/trunk/api/src/main/java/org/jboss/remoting/spi/wrapper/ClientWrapper.java
remoting3/trunk/core/src/main/java/org/jboss/remoting/core/ClientImpl.java
remoting3/trunk/core/src/main/java/org/jboss/remoting/core/LocalRequestHandler.java
remoting3/trunk/protocol/basic/src/main/java/org/jboss/remoting/protocol/basic/BasicRequestHandler.java
remoting3/trunk/protocol/basic/src/main/java/org/jboss/remoting/protocol/basic/BasicServerRequestConsumer.java
remoting3/trunk/protocol/multiplex/src/main/java/org/jboss/remoting/protocol/multiplex/MessageType.java
remoting3/trunk/protocol/multiplex/src/main/java/org/jboss/remoting/protocol/multiplex/MultiplexHandler.java
Log:
Remove one-way request type... for now
Modified: remoting3/trunk/api/src/main/java/org/jboss/remoting/Client.java
===================================================================
--- remoting3/trunk/api/src/main/java/org/jboss/remoting/Client.java 2008-10-23 00:04:24
UTC (rev 4610)
+++ remoting3/trunk/api/src/main/java/org/jboss/remoting/Client.java 2008-10-23 00:10:17
UTC (rev 4611)
@@ -85,19 +85,6 @@
IoFuture<O> send(I request) throws IOException;
/**
- * 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 IOException if the request could not be sent
- */
- void sendOneWay(I request) throws IOException;
-
- /**
* Get the attribute map. This map holds metadata about the current clinet.
*
* @return the attribute map
Modified:
remoting3/trunk/api/src/main/java/org/jboss/remoting/spi/remote/RequestHandler.java
===================================================================
---
remoting3/trunk/api/src/main/java/org/jboss/remoting/spi/remote/RequestHandler.java 2008-10-23
00:04:24 UTC (rev 4610)
+++
remoting3/trunk/api/src/main/java/org/jboss/remoting/spi/remote/RequestHandler.java 2008-10-23
00:10:17 UTC (rev 4611)
@@ -34,14 +34,6 @@
public interface RequestHandler extends HandleableCloseable<RequestHandler> {
/**
- * Receive a one-way request from a remote system. This method is intended to be
called by protocol handlers. No
- * reply will be sent back to the client.
- *
- * @param request the request
- */
- void receiveRequest(Object request);
-
- /**
* Receive a request from a remote system. This method is intended to be called by
protocol handlers. If the
* request cannot be accepted for some reason, the
* {@link ReplyHandler#handleException(java.io.IOException)}
Modified:
remoting3/trunk/api/src/main/java/org/jboss/remoting/spi/wrapper/ClientWrapper.java
===================================================================
---
remoting3/trunk/api/src/main/java/org/jboss/remoting/spi/wrapper/ClientWrapper.java 2008-10-23
00:04:24 UTC (rev 4610)
+++
remoting3/trunk/api/src/main/java/org/jboss/remoting/spi/wrapper/ClientWrapper.java 2008-10-23
00:10:17 UTC (rev 4611)
@@ -59,13 +59,6 @@
/**
* {@inheritDoc} This implementation calls the same method on the delegate object.
*/
- public void sendOneWay(final I request) throws IOException {
- delegate.sendOneWay(request);
- }
-
- /**
- * {@inheritDoc} This implementation calls the same method on the delegate object.
- */
public ConcurrentMap<Object, Object> getAttributes() {
return delegate.getAttributes();
}
Modified: remoting3/trunk/core/src/main/java/org/jboss/remoting/core/ClientImpl.java
===================================================================
--- remoting3/trunk/core/src/main/java/org/jboss/remoting/core/ClientImpl.java 2008-10-23
00:04:24 UTC (rev 4610)
+++ remoting3/trunk/core/src/main/java/org/jboss/remoting/core/ClientImpl.java 2008-10-23
00:10:17 UTC (rev 4611)
@@ -87,13 +87,6 @@
return futureReply;
}
- public void sendOneWay(final I request) throws IOException {
- if (! isOpen()) {
- throw new IOException("Client is not open");
- }
- handle.getResource().receiveRequest(request);
- }
-
public String toString() {
return "client instance <" + Integer.toString(hashCode()) +
">";
}
Modified:
remoting3/trunk/core/src/main/java/org/jboss/remoting/core/LocalRequestHandler.java
===================================================================
---
remoting3/trunk/core/src/main/java/org/jboss/remoting/core/LocalRequestHandler.java 2008-10-23
00:04:24 UTC (rev 4610)
+++
remoting3/trunk/core/src/main/java/org/jboss/remoting/core/LocalRequestHandler.java 2008-10-23
00:10:17 UTC (rev 4611)
@@ -58,20 +58,6 @@
this(executor, requestListener, new ClientContextImpl(executor));
}
- public void receiveRequest(final Object request) {
- final RequestContextImpl<O> context = new
RequestContextImpl<O>(clientContext);
- context.execute(new Runnable() {
- @SuppressWarnings({ "unchecked" })
- public void run() {
- try {
- requestListener.handleRequest(context, (I) request);
- } catch (Throwable t) {
- log.error(t, "Unexpected exception in request listener");
- }
- }
- });
- }
-
public RemoteRequestContext receiveRequest(final Object request, final ReplyHandler
replyHandler) {
final RequestContextImpl<O> context = new
RequestContextImpl<O>(replyHandler, clientContext);
context.execute(new Runnable() {
Modified:
remoting3/trunk/protocol/basic/src/main/java/org/jboss/remoting/protocol/basic/BasicRequestHandler.java
===================================================================
---
remoting3/trunk/protocol/basic/src/main/java/org/jboss/remoting/protocol/basic/BasicRequestHandler.java 2008-10-23
00:04:24 UTC (rev 4610)
+++
remoting3/trunk/protocol/basic/src/main/java/org/jboss/remoting/protocol/basic/BasicRequestHandler.java 2008-10-23
00:10:17 UTC (rev 4611)
@@ -59,20 +59,6 @@
requestSequence = new AtomicInteger();
}
- public void receiveRequest(final Object request) {
- reqLock.lock();
- try {
- marshaller.write(1);
- marshaller.writeObject(request);
- marshaller.flush();
- } catch (IOException e) {
- log.error(e, "Error receiving request");
- IoUtils.safeClose(this);
- } finally {
- reqLock.unlock();
- }
- }
-
public RemoteRequestContext receiveRequest(final Object request, final ReplyHandler
replyHandler) {
reqLock.lock();
try {
Modified:
remoting3/trunk/protocol/basic/src/main/java/org/jboss/remoting/protocol/basic/BasicServerRequestConsumer.java
===================================================================
---
remoting3/trunk/protocol/basic/src/main/java/org/jboss/remoting/protocol/basic/BasicServerRequestConsumer.java 2008-10-23
00:04:24 UTC (rev 4610)
+++
remoting3/trunk/protocol/basic/src/main/java/org/jboss/remoting/protocol/basic/BasicServerRequestConsumer.java 2008-10-23
00:10:17 UTC (rev 4611)
@@ -64,12 +64,6 @@
// done.
return;
}
- case 1: {
- // one-way request
- final Object request = unmarshaller.readObject();
- requestHandler.receiveRequest(request);
- break;
- }
case 2: {
// two-way request
final int requestId = requestSequence++;
Modified:
remoting3/trunk/protocol/multiplex/src/main/java/org/jboss/remoting/protocol/multiplex/MessageType.java
===================================================================
---
remoting3/trunk/protocol/multiplex/src/main/java/org/jboss/remoting/protocol/multiplex/MessageType.java 2008-10-23
00:04:24 UTC (rev 4610)
+++
remoting3/trunk/protocol/multiplex/src/main/java/org/jboss/remoting/protocol/multiplex/MessageType.java 2008-10-23
00:10:17 UTC (rev 4611)
@@ -28,7 +28,6 @@
public enum MessageType {
// One-way request, no return value may be sent
- REQUEST_ONEWAY(1),
// Two-way request, return value is expected
REQUEST(2),
// Reply
@@ -72,7 +71,6 @@
*/
public static MessageType getMessageType(final int id) {
switch (id) {
- case 1: return REQUEST_ONEWAY;
case 2: return REQUEST;
case 3: return REPLY;
case 4: return CANCEL_REQUEST;
Modified:
remoting3/trunk/protocol/multiplex/src/main/java/org/jboss/remoting/protocol/multiplex/MultiplexHandler.java
===================================================================
---
remoting3/trunk/protocol/multiplex/src/main/java/org/jboss/remoting/protocol/multiplex/MultiplexHandler.java 2008-10-23
00:04:24 UTC (rev 4610)
+++
remoting3/trunk/protocol/multiplex/src/main/java/org/jboss/remoting/protocol/multiplex/MultiplexHandler.java 2008-10-23
00:10:17 UTC (rev 4611)
@@ -49,8 +49,6 @@
import org.jboss.remoting.SimpleCloseable;
import org.jboss.remoting.RemoteExecutionException;
import org.jboss.remoting.IndeterminateOutcomeException;
-import org.jboss.remoting.ReplyException;
-import org.jboss.remoting.RemoteReplyException;
import org.jboss.marshalling.MarshallerFactory;
import org.jboss.marshalling.Unmarshaller;
import org.jboss.marshalling.ByteOutput;
@@ -169,40 +167,6 @@
}
log.trace("Received message %s, type %s", buffer, msgType);
switch (msgType) {
- case REQUEST_ONEWAY: {
- final int clientId = buffer.getInt();
- final Handle<RequestHandler> handle =
forwardedClients.get(clientId);
- if (handle == null) {
- log.trace("Request on invalid client ID %d",
Integer.valueOf(clientId));
- return;
- }
- final Object payload;
- try {
- final Unmarshaller unmarshaller =
marshallerFactory.createUnmarshaller(marshallingConfiguration);
- try {
- unmarshaller.start(Marshalling.createByteInput(buffer));
- try {
- payload = unmarshaller.readObject();
- unmarshaller.finish();
- } catch (ClassNotFoundException e) {
- log.trace("Class not found in one-way request for
client ID %d", Integer.valueOf(clientId));
- break;
- }
- } finally {
- IoUtils.safeClose(unmarshaller);
- }
- } catch (IOException ex) {
- log.error(ex, "Failed to unmarshal a one-way
request");
- break;
- }
- final RequestHandler requestHandler = handle.getResource();
- try {
- requestHandler.receiveRequest(payload);
- } catch (Throwable t) {
- log.error(t, "One-way request handler unexpectedly threw an
exception");
- }
- break;
- }
case REQUEST: {
final int clientId = buffer.getInt();
final Handle<RequestHandler> handle =
forwardedClients.get(clientId);
@@ -630,40 +594,6 @@
});
}
- public void receiveRequest(final Object request) {
- log.trace("Sending outbound one-way request of type %s", request ==
null ? "null" : request.getClass());
- try {
- final List<ByteBuffer> bufferList;
- final Marshaller marshaller =
marshallerFactory.createMarshaller(marshallingConfiguration);
- try {
- bufferList = new ArrayList<ByteBuffer>();
- final ByteOutput output = createByteOutput(allocator, bufferList);
- try {
- marshaller.write(MessageType.REQUEST_ONEWAY.getId());
- marshaller.writeInt(identifier);
- marshaller.writeObject(request);
- marshaller.close();
- output.close();
- } finally {
- IoUtils.safeClose(output);
- }
- } finally {
- IoUtils.safeClose(marshaller);
- }
- try {
- registerWriter(channel, new SimpleWriteHandler(allocator,
bufferList));
- } catch (InterruptedException e) {
- log.trace(e, "receiveRequest was interrupted");
- Thread.currentThread().interrupt();
- return;
- }
- } catch (Throwable t) {
- // ignore
- log.trace(t, "receiveRequest failed with an exception");
- return;
- }
- }
-
public RemoteRequestContext receiveRequest(final Object request, final
ReplyHandler handler) {
log.trace("Sending outbound request of type %s", request == null ?
"null" : request.getClass());
try {