Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Fix deadlock condition between incoming message and the underlying st…

…ream
  • Loading branch information...
commit 64e65c28a9dd874938e1221c4efef86d23c00437 1 parent aa870aa
@dmlloyd dmlloyd authored
Showing with 7 additions and 7 deletions.
  1. +7 −7 src/main/java/org/jboss/remoting3/remote/InboundMessage.java
View
14 src/main/java/org/jboss/remoting3/remote/InboundMessage.java
@@ -57,7 +57,7 @@ public boolean equals(final InboundMessage argument, final int index) {
this.inboundWindow = inboundWindow;
}
- BufferPipeInputStream inputStream = new BufferPipeInputStream(new BufferPipeInputStream.InputHandler() {
+ final BufferPipeInputStream inputStream = new BufferPipeInputStream(new BufferPipeInputStream.InputHandler() {
public void acknowledge(final Pooled<ByteBuffer> acked) throws IOException {
int consumed = acked.getResource().position();
openInboundWindow(consumed);
@@ -77,7 +77,7 @@ public void close() throws IOException {
}
});
- MessageInputStream messageInputStream = new MessageInputStream() {
+ final MessageInputStream messageInputStream = new MessageInputStream() {
public int read() throws IOException {
return inputStream.read();
}
@@ -95,7 +95,7 @@ public int available() throws IOException {
}
public void close() throws IOException {
- synchronized (InboundMessage.this) {
+ synchronized (inputStream) {
if (cancelled) {
throw new MessageCancelledException();
}
@@ -124,13 +124,13 @@ void sendAsyncClose() throws IOException {
void openInboundWindow(int consumed) {
- synchronized (this) {
+ synchronized (inputStream) {
inboundWindow += consumed;
}
}
void closeInboundWindow(int produced) {
- synchronized (this) {
+ synchronized (inputStream) {
if ((inboundWindow -= produced) < 0) {
channel.getRemoteConnection().handleException(new IOException("Input overrun"));
}
@@ -139,7 +139,7 @@ void closeInboundWindow(int produced) {
void handleIncoming(Pooled<ByteBuffer> pooledBuffer) {
boolean eof;
- synchronized (this) {
+ synchronized (inputStream) {
if (closed) {
// ignore
pooledBuffer.free();
@@ -177,7 +177,7 @@ void handleIncoming(Pooled<ByteBuffer> pooledBuffer) {
}
void cancel() {
- synchronized (this) {
+ synchronized (inputStream) {
if (closed) {
return;
}
Please sign in to comment.
Something went wrong with that request. Please try again.