Author: david.lloyd(a)jboss.com
Date: 2010-02-27 16:48:46 -0500 (Sat, 27 Feb 2010)
New Revision: 5764
Added:
remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/remote/InboundReplyInputHandler.java
remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/remote/InboundRequestInputHandler.java
remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/remote/OutboundReplyBufferWriter.java
remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/remote/OutboundRequestBufferWriter.java
Removed:
remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/remote/ReplyBufferWriter.java
remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/remote/ReplyInputHandler.java
remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/remote/RequestBufferWriter.java
remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/remote/RequestInputHandler.java
Modified:
remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/remote/InboundRequest.java
remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/remote/OutboundReplyHandler.java
remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/remote/OutboundRequestHandler.java
remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/remote/RemoteMessageHandler.java
Log:
More descriptive class names
Copied:
remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/remote/InboundReplyInputHandler.java
(from rev 5760,
remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/remote/ReplyInputHandler.java)
===================================================================
---
remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/remote/InboundReplyInputHandler.java
(rev 0)
+++
remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/remote/InboundReplyInputHandler.java 2010-02-27
21:48:46 UTC (rev 5764)
@@ -0,0 +1,55 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+
+package org.jboss.remoting3.remote;
+
+import java.io.IOException;
+import java.nio.ByteBuffer;
+import org.jboss.marshalling.NioByteInput;
+
+final class InboundReplyInputHandler implements NioByteInput.InputHandler {
+ private final int rid;
+ private final OutboundRequest outboundRequest;
+
+ InboundReplyInputHandler(final OutboundRequest outboundRequest, final int rid) {
+ this.outboundRequest = outboundRequest;
+ this.rid = rid;
+ }
+
+ public void acknowledge() throws IOException {
+ final RemoteConnectionHandler connectionHandler =
outboundRequest.getRemoteConnectionHandler();
+ final ByteBuffer buffer = connectionHandler.getBufferPool().allocate();
+ try {
+ buffer.putInt(RemoteConnectionHandler.LENGTH_PLACEHOLDER);
+ buffer.put(RemoteProtocol.REQUEST_ACK_CHUNK);
+ buffer.putInt(rid);
+ buffer.flip();
+ connectionHandler.sendBlocking(buffer);
+ connectionHandler.flushBlocking();
+ } finally {
+ connectionHandler.getBufferPool().free(buffer);
+ }
+ }
+
+ public void close() throws IOException {
+ }
+}
Modified:
remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/remote/InboundRequest.java
===================================================================
---
remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/remote/InboundRequest.java 2010-02-27
21:47:33 UTC (rev 5763)
+++
remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/remote/InboundRequest.java 2010-02-27
21:48:46 UTC (rev 5764)
@@ -38,7 +38,7 @@
InboundRequest(final RemoteConnectionHandler remoteConnectionHandler, final int rid)
{
this.remoteConnectionHandler = remoteConnectionHandler;
- byteInput = new NioByteInput(new RequestInputHandler(this, rid));
+ byteInput = new NioByteInput(new InboundRequestInputHandler(this, rid));
}
void ack() {
Copied:
remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/remote/InboundRequestInputHandler.java
(from rev 5760,
remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/remote/RequestInputHandler.java)
===================================================================
---
remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/remote/InboundRequestInputHandler.java
(rev 0)
+++
remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/remote/InboundRequestInputHandler.java 2010-02-27
21:48:46 UTC (rev 5764)
@@ -0,0 +1,58 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+
+package org.jboss.remoting3.remote;
+
+import java.io.IOException;
+import java.nio.ByteBuffer;
+import org.jboss.marshalling.NioByteInput;
+import org.jboss.xnio.Pool;
+
+final class InboundRequestInputHandler implements NioByteInput.InputHandler {
+ private final int rid;
+ private final InboundRequest inboundRequest;
+
+ public InboundRequestInputHandler(final InboundRequest inboundRequest, final int rid)
{
+ this.inboundRequest = inboundRequest;
+ this.rid = rid;
+ }
+
+ public void acknowledge() throws IOException {
+ final RemoteConnectionHandler connectionHandler =
inboundRequest.getRemoteConnectionHandler();
+ final Pool<ByteBuffer> bufferPool = connectionHandler.getBufferPool();
+ final ByteBuffer buffer = bufferPool.allocate();
+ try {
+ buffer.putInt(RemoteConnectionHandler.LENGTH_PLACEHOLDER);
+ buffer.put(RemoteProtocol.REQUEST_ACK_CHUNK);
+ buffer.putInt(rid);
+ buffer.flip();
+ connectionHandler.sendBlocking(buffer);
+ connectionHandler.flushBlocking();
+ } finally {
+ bufferPool.free(buffer);
+ }
+ }
+
+ public void close() throws IOException {
+ // todo: stream was closed, no action needed
+ }
+}
Copied:
remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/remote/OutboundReplyBufferWriter.java
(from rev 5760,
remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/remote/ReplyBufferWriter.java)
===================================================================
---
remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/remote/OutboundReplyBufferWriter.java
(rev 0)
+++
remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/remote/OutboundReplyBufferWriter.java 2010-02-27
21:48:46 UTC (rev 5764)
@@ -0,0 +1,82 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+
+package org.jboss.remoting3.remote;
+
+import java.io.IOException;
+import java.io.InterruptedIOException;
+import java.nio.ByteBuffer;
+import java.util.concurrent.atomic.AtomicBoolean;
+import org.jboss.marshalling.NioByteOutput;
+import org.jboss.xnio.Pool;
+
+final class OutboundReplyBufferWriter implements NioByteOutput.BufferWriter {
+
+ private final AtomicBoolean first = new AtomicBoolean(true);
+ private final int id;
+ private final boolean exception;
+ private final InboundRequest inboundRequest;
+
+ OutboundReplyBufferWriter(final InboundRequest inboundRequest, final int id, final
boolean exception) {
+ this.inboundRequest = inboundRequest;
+ this.id = id;
+ this.exception = exception;
+ }
+
+ public ByteBuffer getBuffer() {
+ final RemoteConnectionHandler connectionHandler =
inboundRequest.getRemoteConnectionHandler();
+ final Pool<ByteBuffer> bufferPool = connectionHandler.getBufferPool();
+ final ByteBuffer buffer = bufferPool.allocate();
+ buffer.putInt(RemoteConnectionHandler.LENGTH_PLACEHOLDER);
+ buffer.put(exception ? RemoteProtocol.REPLY_EXCEPTION : RemoteProtocol.REPLY);
+ buffer.putInt(id);
+ final boolean isFirst = first.getAndSet(false);
+ if (isFirst) {
+ buffer.put((byte) RemoteProtocol.MSG_FLAG_FIRST);
+ } else {
+ buffer.put((byte)0);
+ }
+ return buffer;
+ }
+
+ public void accept(final ByteBuffer buffer, final boolean eof) throws IOException {
+ final RemoteConnectionHandler connectionHandler =
inboundRequest.getRemoteConnectionHandler();
+ try {
+ inboundRequest.acquire();
+ } catch (InterruptedException e) {
+ Thread.currentThread().interrupt();
+ throw new InterruptedIOException();
+ }
+ try {
+ if (eof) {
+ buffer.put(7, (byte) (buffer.get(3) | RemoteProtocol.MSG_FLAG_LAST));
+ }
+ connectionHandler.sendBlocking(buffer);
+ } finally {
+ connectionHandler.getBufferPool().free(buffer);
+ }
+ }
+
+ public void flush() throws IOException {
+ inboundRequest.getRemoteConnectionHandler().flushBlocking();
+ }
+}
Modified:
remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/remote/OutboundReplyHandler.java
===================================================================
---
remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/remote/OutboundReplyHandler.java 2010-02-27
21:47:33 UTC (rev 5763)
+++
remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/remote/OutboundReplyHandler.java 2010-02-27
21:48:46 UTC (rev 5764)
@@ -45,7 +45,7 @@
if (! done.getAndSet(true)) {
final RemoteConnectionHandler connectionHandler =
inboundRequest.getRemoteConnectionHandler();
final Marshaller marshaller =
connectionHandler.getMarshallerFactory().createMarshaller(connectionHandler.getMarshallingConfiguration());
- marshaller.start(new NioByteOutput(new ReplyBufferWriter(inboundRequest, rid,
false)));
+ marshaller.start(new NioByteOutput(new
OutboundReplyBufferWriter(inboundRequest, rid, false)));
marshaller.writeObject(reply);
marshaller.finish();
}
@@ -57,7 +57,7 @@
boolean ok = false;
try {
final Marshaller marshaller =
connectionHandler.getMarshallerFactory().createMarshaller(connectionHandler.getMarshallingConfiguration());
- marshaller.start(new NioByteOutput(new ReplyBufferWriter(inboundRequest,
rid, true)));
+ marshaller.start(new NioByteOutput(new
OutboundReplyBufferWriter(inboundRequest, rid, true)));
marshaller.writeObject(exception);
marshaller.finish();
ok = true;
Copied:
remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/remote/OutboundRequestBufferWriter.java
(from rev 5760,
remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/remote/RequestBufferWriter.java)
===================================================================
---
remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/remote/OutboundRequestBufferWriter.java
(rev 0)
+++
remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/remote/OutboundRequestBufferWriter.java 2010-02-27
21:48:46 UTC (rev 5764)
@@ -0,0 +1,84 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+
+package org.jboss.remoting3.remote;
+
+import java.io.IOException;
+import java.io.InterruptedIOException;
+import java.nio.ByteBuffer;
+import java.util.concurrent.atomic.AtomicBoolean;
+import org.jboss.marshalling.NioByteOutput;
+
+final class OutboundRequestBufferWriter implements NioByteOutput.BufferWriter {
+
+ private final AtomicBoolean first = new AtomicBoolean(true);
+ private final int rid;
+ private final OutboundRequest outboundRequest;
+
+ OutboundRequestBufferWriter(final OutboundRequest outboundRequest, final int rid) {
+ this.outboundRequest = outboundRequest;
+ this.rid = rid;
+ }
+
+ public ByteBuffer getBuffer() {
+ final ByteBuffer buffer =
outboundRequest.getRemoteConnectionHandler().getBufferPool().allocate();
+ buffer.putInt(RemoteConnectionHandler.LENGTH_PLACEHOLDER);
+ buffer.put(RemoteProtocol.REQUEST);
+ buffer.putInt(rid);
+ final boolean isFirst = first.getAndSet(false);
+ if (isFirst) {
+ buffer.put((byte) RemoteProtocol.MSG_FLAG_FIRST);
+ buffer.putInt(outboundRequest.getClientId());
+ } else {
+ buffer.put((byte)0);
+ }
+ RemoteConnectionHandler.log.trace("Allocated buffer %s for %s", buffer,
this);
+ return buffer;
+ }
+
+ public void accept(final ByteBuffer buffer, final boolean eof) throws IOException {
+ final OutboundRequest outboundRequest = this.outboundRequest;
+ try {
+ outboundRequest.acquire();
+ } catch (InterruptedException e) {
+ Thread.currentThread().interrupt();
+ throw new InterruptedIOException();
+ }
+ final RemoteConnectionHandler remoteConnectionHandler =
outboundRequest.getRemoteConnectionHandler();
+ try {
+ if (eof) {
+ buffer.put(7, (byte) (buffer.get(3) | RemoteProtocol.MSG_FLAG_LAST));
+ synchronized (outboundRequest) {
+ outboundRequest.setState(OutboundRequest.State.REPLY_WAIT);
+ }
+ }
+ RemoteConnectionHandler.log.trace("Sending buffer %s for %s",
buffer, this);
+ remoteConnectionHandler.sendBlocking(buffer);
+ } finally {
+ remoteConnectionHandler.getBufferPool().free(buffer);
+ }
+ }
+
+ public void flush() throws IOException {
+ outboundRequest.getRemoteConnectionHandler().flushBlocking();
+ }
+}
Modified:
remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/remote/OutboundRequestHandler.java
===================================================================
---
remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/remote/OutboundRequestHandler.java 2010-02-27
21:47:33 UTC (rev 5763)
+++
remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/remote/OutboundRequestHandler.java 2010-02-27
21:48:46 UTC (rev 5764)
@@ -55,7 +55,7 @@
while (outboundRequests.containsKey(rid = random.nextInt()));
outboundRequests.put(rid, outboundRequest);
}
- final NioByteOutput byteOutput = new NioByteOutput(new
RequestBufferWriter(outboundRequest, rid));
+ final NioByteOutput byteOutput = new NioByteOutput(new
OutboundRequestBufferWriter(outboundRequest, rid));
try {
RemoteConnectionHandler.log.trace("Starting sending request %s",
request);
final Marshaller marshaller =
connectionHandler.getMarshallerFactory().createMarshaller(connectionHandler.getMarshallingConfiguration());
Modified:
remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/remote/RemoteMessageHandler.java
===================================================================
---
remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/remote/RemoteMessageHandler.java 2010-02-27
21:47:33 UTC (rev 5763)
+++
remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/remote/RemoteMessageHandler.java 2010-02-27
21:48:46 UTC (rev 5764)
@@ -221,7 +221,7 @@
synchronized (outboundRequest) {
if ((flags & RemoteProtocol.MSG_FLAG_FIRST) != 0) {
// todo - check for duplicate
- outboundRequest.setByteInput(byteInput = new NioByteInput(new
ReplyInputHandler(outboundRequest, rid)));
+ outboundRequest.setByteInput(byteInput = new NioByteInput(new
InboundReplyInputHandler(outboundRequest, rid)));
connectionHandler.getConnectionContext().getConnectionProviderContext().getExecutor().execute(new
InboundReplyTask(connectionHandler, outboundRequest));
} else {
byteInput = outboundRequest.getByteInput();
@@ -262,7 +262,7 @@
synchronized (outboundRequest) {
if ((flags & RemoteProtocol.MSG_FLAG_FIRST) != 0) {
// todo - check for duplicate
- outboundRequest.setByteInput(byteInput = new NioByteInput(new
ReplyInputHandler(outboundRequest, rid)));
+ outboundRequest.setByteInput(byteInput = new NioByteInput(new
InboundReplyInputHandler(outboundRequest, rid)));
connectionHandler.getConnectionContext().getConnectionProviderContext().getExecutor().execute(new
InboundReplyExceptionTask(connectionHandler, outboundRequest));
} else {
byteInput = outboundRequest.getByteInput();
Deleted:
remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/remote/ReplyBufferWriter.java
===================================================================
---
remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/remote/ReplyBufferWriter.java 2010-02-27
21:47:33 UTC (rev 5763)
+++
remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/remote/ReplyBufferWriter.java 2010-02-27
21:48:46 UTC (rev 5764)
@@ -1,82 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2010, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
- */
-
-package org.jboss.remoting3.remote;
-
-import java.io.IOException;
-import java.io.InterruptedIOException;
-import java.nio.ByteBuffer;
-import java.util.concurrent.atomic.AtomicBoolean;
-import org.jboss.marshalling.NioByteOutput;
-import org.jboss.xnio.Pool;
-
-final class ReplyBufferWriter implements NioByteOutput.BufferWriter {
-
- private final AtomicBoolean first = new AtomicBoolean(true);
- private final int id;
- private final boolean exception;
- private final InboundRequest inboundRequest;
-
- ReplyBufferWriter(final InboundRequest inboundRequest, final int id, final boolean
exception) {
- this.inboundRequest = inboundRequest;
- this.id = id;
- this.exception = exception;
- }
-
- public ByteBuffer getBuffer() {
- final RemoteConnectionHandler connectionHandler =
inboundRequest.getRemoteConnectionHandler();
- final Pool<ByteBuffer> bufferPool = connectionHandler.getBufferPool();
- final ByteBuffer buffer = bufferPool.allocate();
- buffer.putInt(RemoteConnectionHandler.LENGTH_PLACEHOLDER);
- buffer.put(exception ? RemoteProtocol.REPLY_EXCEPTION : RemoteProtocol.REPLY);
- buffer.putInt(id);
- final boolean isFirst = first.getAndSet(false);
- if (isFirst) {
- buffer.put((byte) RemoteProtocol.MSG_FLAG_FIRST);
- } else {
- buffer.put((byte)0);
- }
- return buffer;
- }
-
- public void accept(final ByteBuffer buffer, final boolean eof) throws IOException {
- final RemoteConnectionHandler connectionHandler =
inboundRequest.getRemoteConnectionHandler();
- try {
- inboundRequest.acquire();
- } catch (InterruptedException e) {
- Thread.currentThread().interrupt();
- throw new InterruptedIOException();
- }
- try {
- if (eof) {
- buffer.put(7, (byte) (buffer.get(3) | RemoteProtocol.MSG_FLAG_LAST));
- }
- connectionHandler.sendBlocking(buffer);
- } finally {
- connectionHandler.getBufferPool().free(buffer);
- }
- }
-
- public void flush() throws IOException {
- inboundRequest.getRemoteConnectionHandler().flushBlocking();
- }
-}
Deleted:
remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/remote/ReplyInputHandler.java
===================================================================
---
remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/remote/ReplyInputHandler.java 2010-02-27
21:47:33 UTC (rev 5763)
+++
remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/remote/ReplyInputHandler.java 2010-02-27
21:48:46 UTC (rev 5764)
@@ -1,55 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2010, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
- */
-
-package org.jboss.remoting3.remote;
-
-import java.io.IOException;
-import java.nio.ByteBuffer;
-import org.jboss.marshalling.NioByteInput;
-
-final class ReplyInputHandler implements NioByteInput.InputHandler {
- private final int rid;
- private final OutboundRequest outboundRequest;
-
- ReplyInputHandler(final OutboundRequest outboundRequest, final int rid) {
- this.outboundRequest = outboundRequest;
- this.rid = rid;
- }
-
- public void acknowledge() throws IOException {
- final RemoteConnectionHandler connectionHandler =
outboundRequest.getRemoteConnectionHandler();
- final ByteBuffer buffer = connectionHandler.getBufferPool().allocate();
- try {
- buffer.putInt(RemoteConnectionHandler.LENGTH_PLACEHOLDER);
- buffer.put(RemoteProtocol.REQUEST_ACK_CHUNK);
- buffer.putInt(rid);
- buffer.flip();
- connectionHandler.sendBlocking(buffer);
- connectionHandler.flushBlocking();
- } finally {
- connectionHandler.getBufferPool().free(buffer);
- }
- }
-
- public void close() throws IOException {
- }
-}
Deleted:
remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/remote/RequestBufferWriter.java
===================================================================
---
remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/remote/RequestBufferWriter.java 2010-02-27
21:47:33 UTC (rev 5763)
+++
remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/remote/RequestBufferWriter.java 2010-02-27
21:48:46 UTC (rev 5764)
@@ -1,84 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2010, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
- */
-
-package org.jboss.remoting3.remote;
-
-import java.io.IOException;
-import java.io.InterruptedIOException;
-import java.nio.ByteBuffer;
-import java.util.concurrent.atomic.AtomicBoolean;
-import org.jboss.marshalling.NioByteOutput;
-
-final class RequestBufferWriter implements NioByteOutput.BufferWriter {
-
- private final AtomicBoolean first = new AtomicBoolean(true);
- private final int rid;
- private final OutboundRequest outboundRequest;
-
- RequestBufferWriter(final OutboundRequest outboundRequest, final int rid) {
- this.outboundRequest = outboundRequest;
- this.rid = rid;
- }
-
- public ByteBuffer getBuffer() {
- final ByteBuffer buffer =
outboundRequest.getRemoteConnectionHandler().getBufferPool().allocate();
- buffer.putInt(RemoteConnectionHandler.LENGTH_PLACEHOLDER);
- buffer.put(RemoteProtocol.REQUEST);
- buffer.putInt(rid);
- final boolean isFirst = first.getAndSet(false);
- if (isFirst) {
- buffer.put((byte) RemoteProtocol.MSG_FLAG_FIRST);
- buffer.putInt(outboundRequest.getClientId());
- } else {
- buffer.put((byte)0);
- }
- RemoteConnectionHandler.log.trace("Allocated buffer %s for %s", buffer,
this);
- return buffer;
- }
-
- public void accept(final ByteBuffer buffer, final boolean eof) throws IOException {
- final OutboundRequest outboundRequest = this.outboundRequest;
- try {
- outboundRequest.acquire();
- } catch (InterruptedException e) {
- Thread.currentThread().interrupt();
- throw new InterruptedIOException();
- }
- final RemoteConnectionHandler remoteConnectionHandler =
outboundRequest.getRemoteConnectionHandler();
- try {
- if (eof) {
- buffer.put(7, (byte) (buffer.get(3) | RemoteProtocol.MSG_FLAG_LAST));
- synchronized (outboundRequest) {
- outboundRequest.setState(OutboundRequest.State.REPLY_WAIT);
- }
- }
- RemoteConnectionHandler.log.trace("Sending buffer %s for %s",
buffer, this);
- remoteConnectionHandler.sendBlocking(buffer);
- } finally {
- remoteConnectionHandler.getBufferPool().free(buffer);
- }
- }
-
- public void flush() throws IOException {
- outboundRequest.getRemoteConnectionHandler().flushBlocking();
- }
-}
Deleted:
remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/remote/RequestInputHandler.java
===================================================================
---
remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/remote/RequestInputHandler.java 2010-02-27
21:47:33 UTC (rev 5763)
+++
remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/remote/RequestInputHandler.java 2010-02-27
21:48:46 UTC (rev 5764)
@@ -1,58 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2010, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
- */
-
-package org.jboss.remoting3.remote;
-
-import java.io.IOException;
-import java.nio.ByteBuffer;
-import org.jboss.marshalling.NioByteInput;
-import org.jboss.xnio.Pool;
-
-final class RequestInputHandler implements NioByteInput.InputHandler {
- private final int rid;
- private final InboundRequest inboundRequest;
-
- public RequestInputHandler(final InboundRequest inboundRequest, final int rid) {
- this.inboundRequest = inboundRequest;
- this.rid = rid;
- }
-
- public void acknowledge() throws IOException {
- final RemoteConnectionHandler connectionHandler =
inboundRequest.getRemoteConnectionHandler();
- final Pool<ByteBuffer> bufferPool = connectionHandler.getBufferPool();
- final ByteBuffer buffer = bufferPool.allocate();
- try {
- buffer.putInt(RemoteConnectionHandler.LENGTH_PLACEHOLDER);
- buffer.put(RemoteProtocol.REQUEST_ACK_CHUNK);
- buffer.putInt(rid);
- buffer.flip();
- connectionHandler.sendBlocking(buffer);
- connectionHandler.flushBlocking();
- } finally {
- bufferPool.free(buffer);
- }
- }
-
- public void close() throws IOException {
- // todo: stream was closed, no action needed
- }
-}