Skip to content

Commit

Permalink
Remove ineffective JettyByteBufferIterator from WebSocket adapter
Browse files Browse the repository at this point in the history
In JettyWebSocketHandlerAdapter, JettyByteBufferIterator does not actually add extra behavior (in contrast to JettyClientHttpConnector).
  • Loading branch information
jhoeller committed Nov 13, 2024
1 parent 62eb21f commit 14b9865
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 36 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2002-2023 the original author or authors.
* Copyright 2002-2024 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -153,7 +153,6 @@ private static final class JettyDataBuffer implements PooledDataBuffer {

private final AtomicInteger refCount = new AtomicInteger(1);


public JettyDataBuffer(DataBuffer delegate, Content.Chunk chunk) {
Assert.notNull(delegate, "Delegate must not be null");
Assert.notNull(chunk, "Chunk must not be null");
Expand Down Expand Up @@ -390,7 +389,6 @@ private static final class JettyByteBufferIterator implements ByteBufferIterator

private final Content.Chunk chunk;


public JettyByteBufferIterator(ByteBufferIterator delegate, Content.Chunk chunk) {
Assert.notNull(delegate, "Delegate must not be null");
Assert.notNull(chunk, "Chunk must not be null");
Expand All @@ -400,7 +398,6 @@ public JettyByteBufferIterator(ByteBufferIterator delegate, Content.Chunk chunk)
this.chunk.retain();
}


@Override
public void close() {
this.delegate.close();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -306,48 +306,18 @@ public void toByteBuffer(int srcPos, ByteBuffer dest, int destPos, int length) {

@Override
public ByteBufferIterator readableByteBuffers() {
ByteBufferIterator delegateIterator = this.delegate.readableByteBuffers();
return new JettyByteBufferIterator(delegateIterator);
return this.delegate.readableByteBuffers();
}

@Override
public ByteBufferIterator writableByteBuffers() {
ByteBufferIterator delegateIterator = this.delegate.writableByteBuffers();
return new JettyByteBufferIterator(delegateIterator);
return this.delegate.writableByteBuffers();
}

@Override
public String toString(int index, int length, Charset charset) {
return this.delegate.toString(index, length, charset);
}


private static class JettyByteBufferIterator implements ByteBufferIterator {

private final ByteBufferIterator delegate;


JettyByteBufferIterator(ByteBufferIterator delegate) {
Assert.notNull(delegate, "Delegate must not be null");

this.delegate = delegate;
}

@Override
public void close() {
this.delegate.close();
}

@Override
public boolean hasNext() {
return this.delegate.hasNext();
}

@Override
public ByteBuffer next() {
return this.delegate.next();
}
}
}

}

0 comments on commit 14b9865

Please sign in to comment.