Author: david.lloyd(a)jboss.com
Date: 2010-02-27 15:42:22 -0500 (Sat, 27 Feb 2010)
New Revision: 5762
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/InboundRequestTask.java
remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/remote/RemoteMessageHandler.java
Log:
Fix NPE on inbound task request creation
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-26
23:47:13 UTC (rev 5761)
+++
remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/remote/InboundRequest.java 2010-02-27
20:42:22 UTC (rev 5762)
@@ -32,12 +32,13 @@
private Cancellable cancellable;
private OutboundReplyHandler replyHandler;
- private NioByteInput byteInput;
+ private final NioByteInput byteInput;
private final RemoteConnectionHandler remoteConnectionHandler;
private State state = State.RECEIVING;
- InboundRequest(final RemoteConnectionHandler remoteConnectionHandler) {
+ InboundRequest(final RemoteConnectionHandler remoteConnectionHandler, final int rid)
{
this.remoteConnectionHandler = remoteConnectionHandler;
+ byteInput = new NioByteInput(new RequestInputHandler(this, rid));
}
void ack() {
@@ -56,10 +57,6 @@
flowSemaphore.acquire();
}
- void setByteInput(final NioByteInput byteInput) {
- this.byteInput = byteInput;
- }
-
void setReplyHandler(final OutboundReplyHandler replyHandler) {
this.replyHandler = replyHandler;
}
Modified:
remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/remote/InboundRequestTask.java
===================================================================
---
remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/remote/InboundRequestTask.java 2010-02-26
23:47:13 UTC (rev 5761)
+++
remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/remote/InboundRequestTask.java 2010-02-27
20:42:22 UTC (rev 5762)
@@ -23,7 +23,6 @@
package org.jboss.remoting3.remote;
import java.io.IOException;
-import org.jboss.marshalling.NioByteInput;
import org.jboss.marshalling.Unmarshaller;
import org.jboss.marshalling.util.IntKeyMap;
import org.jboss.remoting3.RemoteRequestException;
@@ -47,7 +46,6 @@
final OutboundReplyHandler replyHandler;
final InboundRequest inboundRequest = this.inboundRequest;
synchronized (inboundRequest) {
- inboundRequest.setByteInput(new NioByteInput(new
RequestInputHandler(inboundRequest, rid)));
inboundRequest.setReplyHandler(replyHandler = new
OutboundReplyHandler(inboundRequest, rid));
}
final Object request;
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-26
23:47:13 UTC (rev 5761)
+++
remoting3/trunk/jboss-remoting/src/main/java/org/jboss/remoting3/remote/RemoteMessageHandler.java 2010-02-27
20:42:22 UTC (rev 5762)
@@ -145,14 +145,17 @@
final InboundRequest inboundRequest;
final NioByteInput byteInput;
final IntKeyMap<InboundRequest> inboundRequests =
connectionHandler.getInboundRequests();
+ final int cid;
+ boolean start = false;
synchronized (inboundRequests) {
if ((flags & RemoteProtocol.MSG_FLAG_FIRST) != 0) {
- final int cid = buffer.getInt();
- inboundRequest = new InboundRequest(connectionHandler);
+ cid = buffer.getInt();
+ inboundRequest = new InboundRequest(connectionHandler, 0);
+ start = true;
// todo - check for duplicate
inboundRequests.put(rid, inboundRequest);
-
connectionHandler.getConnectionContext().getConnectionProviderContext().getExecutor().execute(new
InboundRequestTask(connectionHandler, inboundRequest, rid, cid));
} else {
+ cid = 0;
inboundRequest = inboundRequests.get(rid);
}
if (inboundRequest == null) {
@@ -160,6 +163,9 @@
}
}
synchronized (inboundRequest) {
+ if (start) {
+
connectionHandler.getConnectionContext().getConnectionProviderContext().getExecutor().execute(new
InboundRequestTask(connectionHandler, inboundRequest, rid, cid));
+ }
byteInput = inboundRequest.getByteInput();
}
byteInput.push(buffer);
Show replies by date