@@ -67,21 +67,15 @@ public final class JettyDataBuffer implements PooledDataBuffer {
67
67
this .chunk = null ;
68
68
}
69
69
70
+
70
71
@ Override
71
72
public boolean isAllocated () {
72
73
return this .refCount .get () > 0 ;
73
74
}
74
75
75
76
@ Override
76
77
public PooledDataBuffer retain () {
77
- int result = this .refCount .updateAndGet (c -> {
78
- if (c != 0 ) {
79
- return c + 1 ;
80
- }
81
- else {
82
- return 0 ;
83
- }
84
- });
78
+ int result = this .refCount .updateAndGet (c -> (c != 0 ? c + 1 : 0 ));
85
79
if (result != 0 && this .chunk != null ) {
86
80
this .chunk .retain ();
87
81
}
@@ -107,7 +101,7 @@ public boolean release() {
107
101
return this .chunk .release ();
108
102
}
109
103
else {
110
- return result == 0 ;
104
+ return ( result == 0 ) ;
111
105
}
112
106
}
113
107
@@ -116,6 +110,7 @@ public DataBufferFactory factory() {
116
110
return this .bufferFactory ;
117
111
}
118
112
113
+
119
114
// delegation
120
115
121
116
@ Override
@@ -305,15 +300,16 @@ public String toString(int index, int length, Charset charset) {
305
300
return this .delegate .toString (index , length , charset );
306
301
}
307
302
303
+
308
304
@ Override
309
- public int hashCode () {
310
- return this .delegate .hashCode ();
305
+ public boolean equals (Object other ) {
306
+ return (this == other || (other instanceof JettyDataBuffer otherBuffer &&
307
+ this .delegate .equals (otherBuffer .delegate )));
311
308
}
312
309
313
310
@ Override
314
- public boolean equals (Object o ) {
315
- return this == o || (o instanceof JettyDataBuffer other &&
316
- this .delegate .equals (other .delegate ));
311
+ public int hashCode () {
312
+ return this .delegate .hashCode ();
317
313
}
318
314
319
315
@ Override
@@ -322,13 +318,13 @@ public String toString() {
322
318
readPosition (), writePosition (), capacity ());
323
319
}
324
320
321
+
325
322
private static final class JettyByteBufferIterator implements ByteBufferIterator {
326
323
327
324
private final ByteBufferIterator delegate ;
328
325
329
326
private final Content .Chunk chunk ;
330
327
331
-
332
328
public JettyByteBufferIterator (ByteBufferIterator delegate , Content .Chunk chunk ) {
333
329
Assert .notNull (delegate , "Delegate must not be null" );
334
330
Assert .notNull (chunk , "Chunk must not be null" );
@@ -338,7 +334,6 @@ public JettyByteBufferIterator(ByteBufferIterator delegate, Content.Chunk chunk)
338
334
this .chunk .retain ();
339
335
}
340
336
341
-
342
337
@ Override
343
338
public void close () {
344
339
this .delegate .close ();
0 commit comments