Skip to content

Commit 14b9865

Browse files
committed
Remove ineffective JettyByteBufferIterator from WebSocket adapter
In JettyWebSocketHandlerAdapter, JettyByteBufferIterator does not actually add extra behavior (in contrast to JettyClientHttpConnector).
1 parent 62eb21f commit 14b9865

File tree

2 files changed

+3
-36
lines changed

2 files changed

+3
-36
lines changed

spring-web/src/main/java/org/springframework/http/client/reactive/JettyClientHttpConnector.java

+1-4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2023 the original author or authors.
2+
* Copyright 2002-2024 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -153,7 +153,6 @@ private static final class JettyDataBuffer implements PooledDataBuffer {
153153

154154
private final AtomicInteger refCount = new AtomicInteger(1);
155155

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

391390
private final Content.Chunk chunk;
392391

393-
394392
public JettyByteBufferIterator(ByteBufferIterator delegate, Content.Chunk chunk) {
395393
Assert.notNull(delegate, "Delegate must not be null");
396394
Assert.notNull(chunk, "Chunk must not be null");
@@ -400,7 +398,6 @@ public JettyByteBufferIterator(ByteBufferIterator delegate, Content.Chunk chunk)
400398
this.chunk.retain();
401399
}
402400

403-
404401
@Override
405402
public void close() {
406403
this.delegate.close();

spring-webflux/src/main/java/org/springframework/web/reactive/socket/adapter/JettyWebSocketHandlerAdapter.java

+2-32
Original file line numberDiff line numberDiff line change
@@ -306,48 +306,18 @@ public void toByteBuffer(int srcPos, ByteBuffer dest, int destPos, int length) {
306306

307307
@Override
308308
public ByteBufferIterator readableByteBuffers() {
309-
ByteBufferIterator delegateIterator = this.delegate.readableByteBuffers();
310-
return new JettyByteBufferIterator(delegateIterator);
309+
return this.delegate.readableByteBuffers();
311310
}
312311

313312
@Override
314313
public ByteBufferIterator writableByteBuffers() {
315-
ByteBufferIterator delegateIterator = this.delegate.writableByteBuffers();
316-
return new JettyByteBufferIterator(delegateIterator);
314+
return this.delegate.writableByteBuffers();
317315
}
318316

319317
@Override
320318
public String toString(int index, int length, Charset charset) {
321319
return this.delegate.toString(index, length, charset);
322320
}
323-
324-
325-
private static class JettyByteBufferIterator implements ByteBufferIterator {
326-
327-
private final ByteBufferIterator delegate;
328-
329-
330-
JettyByteBufferIterator(ByteBufferIterator delegate) {
331-
Assert.notNull(delegate, "Delegate must not be null");
332-
333-
this.delegate = delegate;
334-
}
335-
336-
@Override
337-
public void close() {
338-
this.delegate.close();
339-
}
340-
341-
@Override
342-
public boolean hasNext() {
343-
return this.delegate.hasNext();
344-
}
345-
346-
@Override
347-
public ByteBuffer next() {
348-
return this.delegate.next();
349-
}
350-
}
351321
}
352322

353323
}

0 commit comments

Comments
 (0)