View Javadoc
1   /*
2    * Copyright 2013 The Netty Project
3    *
4    * The Netty Project licenses this file to you under the Apache License,
5    * version 2.0 (the "License"); you may not use this file except in compliance
6    * with the License. You may obtain a copy of the License at:
7    *
8    *   http://www.apache.org/licenses/LICENSE-2.0
9    *
10   * Unless required by applicable law or agreed to in writing, software
11   * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12   * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13   * License for the specific language governing permissions and limitations
14   * under the License.
15   */
16  
17  package io.netty.buffer;
18  
19  import io.netty.util.ByteProcessor;
20  import io.netty.util.ResourceLeakDetector;
21  import io.netty.util.ResourceLeakTracker;
22  import io.netty.util.internal.SystemPropertyUtil;
23  import io.netty.util.internal.logging.InternalLogger;
24  import io.netty.util.internal.logging.InternalLoggerFactory;
25  
26  import java.io.IOException;
27  import java.io.InputStream;
28  import java.io.OutputStream;
29  import java.nio.ByteBuffer;
30  import java.nio.ByteOrder;
31  import java.nio.channels.FileChannel;
32  import java.nio.channels.GatheringByteChannel;
33  import java.nio.channels.ScatteringByteChannel;
34  import java.nio.charset.Charset;
35  
36  final class AdvancedLeakAwareByteBuf extends SimpleLeakAwareByteBuf {
37  
38      private static final String PROP_ACQUIRE_AND_RELEASE_ONLY = "io.netty.leakDetection.acquireAndReleaseOnly";
39      private static final boolean ACQUIRE_AND_RELEASE_ONLY;
40  
41      private static final InternalLogger logger = InternalLoggerFactory.getInstance(AdvancedLeakAwareByteBuf.class);
42  
43      static {
44          ACQUIRE_AND_RELEASE_ONLY = SystemPropertyUtil.getBoolean(PROP_ACQUIRE_AND_RELEASE_ONLY, false);
45  
46          if (logger.isDebugEnabled()) {
47              logger.debug("-D{}: {}", PROP_ACQUIRE_AND_RELEASE_ONLY, ACQUIRE_AND_RELEASE_ONLY);
48          }
49  
50          ResourceLeakDetector.addExclusions(
51                  AdvancedLeakAwareByteBuf.class, "touch", "recordLeakNonRefCountingOperation");
52      }
53  
54      AdvancedLeakAwareByteBuf(ByteBuf buf, ResourceLeakTracker<ByteBuf> leak) {
55          super(buf, leak);
56      }
57  
58      AdvancedLeakAwareByteBuf(ByteBuf wrapped, ByteBuf trackedByteBuf, ResourceLeakTracker<ByteBuf> leak) {
59          super(wrapped, trackedByteBuf, leak);
60      }
61  
62      static void recordLeakNonRefCountingOperation(ResourceLeakTracker<ByteBuf> leak) {
63          if (!ACQUIRE_AND_RELEASE_ONLY) {
64              leak.record();
65          }
66      }
67  
68      @Override
69      public ByteBuf order(ByteOrder endianness) {
70          recordLeakNonRefCountingOperation(leak);
71          return super.order(endianness);
72      }
73  
74      @Override
75      public ByteBuf slice() {
76          recordLeakNonRefCountingOperation(leak);
77          return super.slice();
78      }
79  
80      @Override
81      public ByteBuf slice(int index, int length) {
82          recordLeakNonRefCountingOperation(leak);
83          return super.slice(index, length);
84      }
85  
86      @Override
87      public ByteBuf retainedSlice() {
88          recordLeakNonRefCountingOperation(leak);
89          return super.retainedSlice();
90      }
91  
92      @Override
93      public ByteBuf retainedSlice(int index, int length) {
94          recordLeakNonRefCountingOperation(leak);
95          return super.retainedSlice(index, length);
96      }
97  
98      @Override
99      public ByteBuf retainedDuplicate() {
100         recordLeakNonRefCountingOperation(leak);
101         return super.retainedDuplicate();
102     }
103 
104     @Override
105     public ByteBuf readRetainedSlice(int length) {
106         recordLeakNonRefCountingOperation(leak);
107         return super.readRetainedSlice(length);
108     }
109 
110     @Override
111     public ByteBuf duplicate() {
112         recordLeakNonRefCountingOperation(leak);
113         return super.duplicate();
114     }
115 
116     @Override
117     public ByteBuf readSlice(int length) {
118         recordLeakNonRefCountingOperation(leak);
119         return super.readSlice(length);
120     }
121 
122     @Override
123     public ByteBuf discardReadBytes() {
124         recordLeakNonRefCountingOperation(leak);
125         return super.discardReadBytes();
126     }
127 
128     @Override
129     public ByteBuf discardSomeReadBytes() {
130         recordLeakNonRefCountingOperation(leak);
131         return super.discardSomeReadBytes();
132     }
133 
134     @Override
135     public ByteBuf ensureWritable(int minWritableBytes) {
136         recordLeakNonRefCountingOperation(leak);
137         return super.ensureWritable(minWritableBytes);
138     }
139 
140     @Override
141     public int ensureWritable(int minWritableBytes, boolean force) {
142         recordLeakNonRefCountingOperation(leak);
143         return super.ensureWritable(minWritableBytes, force);
144     }
145 
146     @Override
147     public boolean getBoolean(int index) {
148         recordLeakNonRefCountingOperation(leak);
149         return super.getBoolean(index);
150     }
151 
152     @Override
153     public byte getByte(int index) {
154         recordLeakNonRefCountingOperation(leak);
155         return super.getByte(index);
156     }
157 
158     @Override
159     public short getUnsignedByte(int index) {
160         recordLeakNonRefCountingOperation(leak);
161         return super.getUnsignedByte(index);
162     }
163 
164     @Override
165     public short getShort(int index) {
166         recordLeakNonRefCountingOperation(leak);
167         return super.getShort(index);
168     }
169 
170     @Override
171     public int getUnsignedShort(int index) {
172         recordLeakNonRefCountingOperation(leak);
173         return super.getUnsignedShort(index);
174     }
175 
176     @Override
177     public int getMedium(int index) {
178         recordLeakNonRefCountingOperation(leak);
179         return super.getMedium(index);
180     }
181 
182     @Override
183     public int getUnsignedMedium(int index) {
184         recordLeakNonRefCountingOperation(leak);
185         return super.getUnsignedMedium(index);
186     }
187 
188     @Override
189     public int getInt(int index) {
190         recordLeakNonRefCountingOperation(leak);
191         return super.getInt(index);
192     }
193 
194     @Override
195     public long getUnsignedInt(int index) {
196         recordLeakNonRefCountingOperation(leak);
197         return super.getUnsignedInt(index);
198     }
199 
200     @Override
201     public long getLong(int index) {
202         recordLeakNonRefCountingOperation(leak);
203         return super.getLong(index);
204     }
205 
206     @Override
207     public char getChar(int index) {
208         recordLeakNonRefCountingOperation(leak);
209         return super.getChar(index);
210     }
211 
212     @Override
213     public float getFloat(int index) {
214         recordLeakNonRefCountingOperation(leak);
215         return super.getFloat(index);
216     }
217 
218     @Override
219     public double getDouble(int index) {
220         recordLeakNonRefCountingOperation(leak);
221         return super.getDouble(index);
222     }
223 
224     @Override
225     public ByteBuf getBytes(int index, ByteBuf dst) {
226         recordLeakNonRefCountingOperation(leak);
227         return super.getBytes(index, dst);
228     }
229 
230     @Override
231     public ByteBuf getBytes(int index, ByteBuf dst, int length) {
232         recordLeakNonRefCountingOperation(leak);
233         return super.getBytes(index, dst, length);
234     }
235 
236     @Override
237     public ByteBuf getBytes(int index, ByteBuf dst, int dstIndex, int length) {
238         recordLeakNonRefCountingOperation(leak);
239         return super.getBytes(index, dst, dstIndex, length);
240     }
241 
242     @Override
243     public ByteBuf getBytes(int index, byte[] dst) {
244         recordLeakNonRefCountingOperation(leak);
245         return super.getBytes(index, dst);
246     }
247 
248     @Override
249     public ByteBuf getBytes(int index, byte[] dst, int dstIndex, int length) {
250         recordLeakNonRefCountingOperation(leak);
251         return super.getBytes(index, dst, dstIndex, length);
252     }
253 
254     @Override
255     public ByteBuf getBytes(int index, ByteBuffer dst) {
256         recordLeakNonRefCountingOperation(leak);
257         return super.getBytes(index, dst);
258     }
259 
260     @Override
261     public ByteBuf getBytes(int index, OutputStream out, int length) throws IOException {
262         recordLeakNonRefCountingOperation(leak);
263         return super.getBytes(index, out, length);
264     }
265 
266     @Override
267     public int getBytes(int index, GatheringByteChannel out, int length) throws IOException {
268         recordLeakNonRefCountingOperation(leak);
269         return super.getBytes(index, out, length);
270     }
271 
272     @Override
273     public CharSequence getCharSequence(int index, int length, Charset charset) {
274         recordLeakNonRefCountingOperation(leak);
275         return super.getCharSequence(index, length, charset);
276     }
277 
278     @Override
279     public ByteBuf setBoolean(int index, boolean value) {
280         recordLeakNonRefCountingOperation(leak);
281         return super.setBoolean(index, value);
282     }
283 
284     @Override
285     public ByteBuf setByte(int index, int value) {
286         recordLeakNonRefCountingOperation(leak);
287         return super.setByte(index, value);
288     }
289 
290     @Override
291     public ByteBuf setShort(int index, int value) {
292         recordLeakNonRefCountingOperation(leak);
293         return super.setShort(index, value);
294     }
295 
296     @Override
297     public ByteBuf setMedium(int index, int value) {
298         recordLeakNonRefCountingOperation(leak);
299         return super.setMedium(index, value);
300     }
301 
302     @Override
303     public ByteBuf setInt(int index, int value) {
304         recordLeakNonRefCountingOperation(leak);
305         return super.setInt(index, value);
306     }
307 
308     @Override
309     public ByteBuf setLong(int index, long value) {
310         recordLeakNonRefCountingOperation(leak);
311         return super.setLong(index, value);
312     }
313 
314     @Override
315     public ByteBuf setChar(int index, int value) {
316         recordLeakNonRefCountingOperation(leak);
317         return super.setChar(index, value);
318     }
319 
320     @Override
321     public ByteBuf setFloat(int index, float value) {
322         recordLeakNonRefCountingOperation(leak);
323         return super.setFloat(index, value);
324     }
325 
326     @Override
327     public ByteBuf setDouble(int index, double value) {
328         recordLeakNonRefCountingOperation(leak);
329         return super.setDouble(index, value);
330     }
331 
332     @Override
333     public ByteBuf setBytes(int index, ByteBuf src) {
334         recordLeakNonRefCountingOperation(leak);
335         return super.setBytes(index, src);
336     }
337 
338     @Override
339     public ByteBuf setBytes(int index, ByteBuf src, int length) {
340         recordLeakNonRefCountingOperation(leak);
341         return super.setBytes(index, src, length);
342     }
343 
344     @Override
345     public ByteBuf setBytes(int index, ByteBuf src, int srcIndex, int length) {
346         recordLeakNonRefCountingOperation(leak);
347         return super.setBytes(index, src, srcIndex, length);
348     }
349 
350     @Override
351     public ByteBuf setBytes(int index, byte[] src) {
352         recordLeakNonRefCountingOperation(leak);
353         return super.setBytes(index, src);
354     }
355 
356     @Override
357     public ByteBuf setBytes(int index, byte[] src, int srcIndex, int length) {
358         recordLeakNonRefCountingOperation(leak);
359         return super.setBytes(index, src, srcIndex, length);
360     }
361 
362     @Override
363     public ByteBuf setBytes(int index, ByteBuffer src) {
364         recordLeakNonRefCountingOperation(leak);
365         return super.setBytes(index, src);
366     }
367 
368     @Override
369     public int setBytes(int index, InputStream in, int length) throws IOException {
370         recordLeakNonRefCountingOperation(leak);
371         return super.setBytes(index, in, length);
372     }
373 
374     @Override
375     public int setBytes(int index, ScatteringByteChannel in, int length) throws IOException {
376         recordLeakNonRefCountingOperation(leak);
377         return super.setBytes(index, in, length);
378     }
379 
380     @Override
381     public ByteBuf setZero(int index, int length) {
382         recordLeakNonRefCountingOperation(leak);
383         return super.setZero(index, length);
384     }
385 
386     @Override
387     public int setCharSequence(int index, CharSequence sequence, Charset charset) {
388         recordLeakNonRefCountingOperation(leak);
389         return super.setCharSequence(index, sequence, charset);
390     }
391 
392     @Override
393     public boolean readBoolean() {
394         recordLeakNonRefCountingOperation(leak);
395         return super.readBoolean();
396     }
397 
398     @Override
399     public byte readByte() {
400         recordLeakNonRefCountingOperation(leak);
401         return super.readByte();
402     }
403 
404     @Override
405     public short readUnsignedByte() {
406         recordLeakNonRefCountingOperation(leak);
407         return super.readUnsignedByte();
408     }
409 
410     @Override
411     public short readShort() {
412         recordLeakNonRefCountingOperation(leak);
413         return super.readShort();
414     }
415 
416     @Override
417     public int readUnsignedShort() {
418         recordLeakNonRefCountingOperation(leak);
419         return super.readUnsignedShort();
420     }
421 
422     @Override
423     public int readMedium() {
424         recordLeakNonRefCountingOperation(leak);
425         return super.readMedium();
426     }
427 
428     @Override
429     public int readUnsignedMedium() {
430         recordLeakNonRefCountingOperation(leak);
431         return super.readUnsignedMedium();
432     }
433 
434     @Override
435     public int readInt() {
436         recordLeakNonRefCountingOperation(leak);
437         return super.readInt();
438     }
439 
440     @Override
441     public long readUnsignedInt() {
442         recordLeakNonRefCountingOperation(leak);
443         return super.readUnsignedInt();
444     }
445 
446     @Override
447     public long readLong() {
448         recordLeakNonRefCountingOperation(leak);
449         return super.readLong();
450     }
451 
452     @Override
453     public char readChar() {
454         recordLeakNonRefCountingOperation(leak);
455         return super.readChar();
456     }
457 
458     @Override
459     public float readFloat() {
460         recordLeakNonRefCountingOperation(leak);
461         return super.readFloat();
462     }
463 
464     @Override
465     public double readDouble() {
466         recordLeakNonRefCountingOperation(leak);
467         return super.readDouble();
468     }
469 
470     @Override
471     public ByteBuf readBytes(int length) {
472         recordLeakNonRefCountingOperation(leak);
473         return super.readBytes(length);
474     }
475 
476     @Override
477     public ByteBuf readBytes(ByteBuf dst) {
478         recordLeakNonRefCountingOperation(leak);
479         return super.readBytes(dst);
480     }
481 
482     @Override
483     public ByteBuf readBytes(ByteBuf dst, int length) {
484         recordLeakNonRefCountingOperation(leak);
485         return super.readBytes(dst, length);
486     }
487 
488     @Override
489     public ByteBuf readBytes(ByteBuf dst, int dstIndex, int length) {
490         recordLeakNonRefCountingOperation(leak);
491         return super.readBytes(dst, dstIndex, length);
492     }
493 
494     @Override
495     public ByteBuf readBytes(byte[] dst) {
496         recordLeakNonRefCountingOperation(leak);
497         return super.readBytes(dst);
498     }
499 
500     @Override
501     public ByteBuf readBytes(byte[] dst, int dstIndex, int length) {
502         recordLeakNonRefCountingOperation(leak);
503         return super.readBytes(dst, dstIndex, length);
504     }
505 
506     @Override
507     public ByteBuf readBytes(ByteBuffer dst) {
508         recordLeakNonRefCountingOperation(leak);
509         return super.readBytes(dst);
510     }
511 
512     @Override
513     public ByteBuf readBytes(OutputStream out, int length) throws IOException {
514         recordLeakNonRefCountingOperation(leak);
515         return super.readBytes(out, length);
516     }
517 
518     @Override
519     public int readBytes(GatheringByteChannel out, int length) throws IOException {
520         recordLeakNonRefCountingOperation(leak);
521         return super.readBytes(out, length);
522     }
523 
524     @Override
525     public CharSequence readCharSequence(int length, Charset charset) {
526         recordLeakNonRefCountingOperation(leak);
527         return super.readCharSequence(length, charset);
528     }
529 
530     @Override
531     public ByteBuf skipBytes(int length) {
532         recordLeakNonRefCountingOperation(leak);
533         return super.skipBytes(length);
534     }
535 
536     @Override
537     public ByteBuf writeBoolean(boolean value) {
538         recordLeakNonRefCountingOperation(leak);
539         return super.writeBoolean(value);
540     }
541 
542     @Override
543     public ByteBuf writeByte(int value) {
544         recordLeakNonRefCountingOperation(leak);
545         return super.writeByte(value);
546     }
547 
548     @Override
549     public ByteBuf writeShort(int value) {
550         recordLeakNonRefCountingOperation(leak);
551         return super.writeShort(value);
552     }
553 
554     @Override
555     public ByteBuf writeMedium(int value) {
556         recordLeakNonRefCountingOperation(leak);
557         return super.writeMedium(value);
558     }
559 
560     @Override
561     public ByteBuf writeInt(int value) {
562         recordLeakNonRefCountingOperation(leak);
563         return super.writeInt(value);
564     }
565 
566     @Override
567     public ByteBuf writeLong(long value) {
568         recordLeakNonRefCountingOperation(leak);
569         return super.writeLong(value);
570     }
571 
572     @Override
573     public ByteBuf writeChar(int value) {
574         recordLeakNonRefCountingOperation(leak);
575         return super.writeChar(value);
576     }
577 
578     @Override
579     public ByteBuf writeFloat(float value) {
580         recordLeakNonRefCountingOperation(leak);
581         return super.writeFloat(value);
582     }
583 
584     @Override
585     public ByteBuf writeDouble(double value) {
586         recordLeakNonRefCountingOperation(leak);
587         return super.writeDouble(value);
588     }
589 
590     @Override
591     public ByteBuf writeBytes(ByteBuf src) {
592         recordLeakNonRefCountingOperation(leak);
593         return super.writeBytes(src);
594     }
595 
596     @Override
597     public ByteBuf writeBytes(ByteBuf src, int length) {
598         recordLeakNonRefCountingOperation(leak);
599         return super.writeBytes(src, length);
600     }
601 
602     @Override
603     public ByteBuf writeBytes(ByteBuf src, int srcIndex, int length) {
604         recordLeakNonRefCountingOperation(leak);
605         return super.writeBytes(src, srcIndex, length);
606     }
607 
608     @Override
609     public ByteBuf writeBytes(byte[] src) {
610         recordLeakNonRefCountingOperation(leak);
611         return super.writeBytes(src);
612     }
613 
614     @Override
615     public ByteBuf writeBytes(byte[] src, int srcIndex, int length) {
616         recordLeakNonRefCountingOperation(leak);
617         return super.writeBytes(src, srcIndex, length);
618     }
619 
620     @Override
621     public ByteBuf writeBytes(ByteBuffer src) {
622         recordLeakNonRefCountingOperation(leak);
623         return super.writeBytes(src);
624     }
625 
626     @Override
627     public int writeBytes(InputStream in, int length) throws IOException {
628         recordLeakNonRefCountingOperation(leak);
629         return super.writeBytes(in, length);
630     }
631 
632     @Override
633     public int writeBytes(ScatteringByteChannel in, int length) throws IOException {
634         recordLeakNonRefCountingOperation(leak);
635         return super.writeBytes(in, length);
636     }
637 
638     @Override
639     public ByteBuf writeZero(int length) {
640         recordLeakNonRefCountingOperation(leak);
641         return super.writeZero(length);
642     }
643 
644     @Override
645     public int indexOf(int fromIndex, int toIndex, byte value) {
646         recordLeakNonRefCountingOperation(leak);
647         return super.indexOf(fromIndex, toIndex, value);
648     }
649 
650     @Override
651     public int bytesBefore(byte value) {
652         recordLeakNonRefCountingOperation(leak);
653         return super.bytesBefore(value);
654     }
655 
656     @Override
657     public int bytesBefore(int length, byte value) {
658         recordLeakNonRefCountingOperation(leak);
659         return super.bytesBefore(length, value);
660     }
661 
662     @Override
663     public int bytesBefore(int index, int length, byte value) {
664         recordLeakNonRefCountingOperation(leak);
665         return super.bytesBefore(index, length, value);
666     }
667 
668     @Override
669     public int forEachByte(ByteProcessor processor) {
670         recordLeakNonRefCountingOperation(leak);
671         return super.forEachByte(processor);
672     }
673 
674     @Override
675     public int forEachByte(int index, int length, ByteProcessor processor) {
676         recordLeakNonRefCountingOperation(leak);
677         return super.forEachByte(index, length, processor);
678     }
679 
680     @Override
681     public int forEachByteDesc(ByteProcessor processor) {
682         recordLeakNonRefCountingOperation(leak);
683         return super.forEachByteDesc(processor);
684     }
685 
686     @Override
687     public int forEachByteDesc(int index, int length, ByteProcessor processor) {
688         recordLeakNonRefCountingOperation(leak);
689         return super.forEachByteDesc(index, length, processor);
690     }
691 
692     @Override
693     public ByteBuf copy() {
694         recordLeakNonRefCountingOperation(leak);
695         return super.copy();
696     }
697 
698     @Override
699     public ByteBuf copy(int index, int length) {
700         recordLeakNonRefCountingOperation(leak);
701         return super.copy(index, length);
702     }
703 
704     @Override
705     public int nioBufferCount() {
706         recordLeakNonRefCountingOperation(leak);
707         return super.nioBufferCount();
708     }
709 
710     @Override
711     public ByteBuffer nioBuffer() {
712         recordLeakNonRefCountingOperation(leak);
713         return super.nioBuffer();
714     }
715 
716     @Override
717     public ByteBuffer nioBuffer(int index, int length) {
718         recordLeakNonRefCountingOperation(leak);
719         return super.nioBuffer(index, length);
720     }
721 
722     @Override
723     public ByteBuffer[] nioBuffers() {
724         recordLeakNonRefCountingOperation(leak);
725         return super.nioBuffers();
726     }
727 
728     @Override
729     public ByteBuffer[] nioBuffers(int index, int length) {
730         recordLeakNonRefCountingOperation(leak);
731         return super.nioBuffers(index, length);
732     }
733 
734     @Override
735     public ByteBuffer internalNioBuffer(int index, int length) {
736         recordLeakNonRefCountingOperation(leak);
737         return super.internalNioBuffer(index, length);
738     }
739 
740     @Override
741     public String toString(Charset charset) {
742         recordLeakNonRefCountingOperation(leak);
743         return super.toString(charset);
744     }
745 
746     @Override
747     public String toString(int index, int length, Charset charset) {
748         recordLeakNonRefCountingOperation(leak);
749         return super.toString(index, length, charset);
750     }
751 
752     @Override
753     public ByteBuf capacity(int newCapacity) {
754         recordLeakNonRefCountingOperation(leak);
755         return super.capacity(newCapacity);
756     }
757 
758     @Override
759     public short getShortLE(int index) {
760         recordLeakNonRefCountingOperation(leak);
761         return super.getShortLE(index);
762     }
763 
764     @Override
765     public int getUnsignedShortLE(int index) {
766         recordLeakNonRefCountingOperation(leak);
767         return super.getUnsignedShortLE(index);
768     }
769 
770     @Override
771     public int getMediumLE(int index) {
772         recordLeakNonRefCountingOperation(leak);
773         return super.getMediumLE(index);
774     }
775 
776     @Override
777     public int getUnsignedMediumLE(int index) {
778         recordLeakNonRefCountingOperation(leak);
779         return super.getUnsignedMediumLE(index);
780     }
781 
782     @Override
783     public int getIntLE(int index) {
784         recordLeakNonRefCountingOperation(leak);
785         return super.getIntLE(index);
786     }
787 
788     @Override
789     public long getUnsignedIntLE(int index) {
790         recordLeakNonRefCountingOperation(leak);
791         return super.getUnsignedIntLE(index);
792     }
793 
794     @Override
795     public long getLongLE(int index) {
796         recordLeakNonRefCountingOperation(leak);
797         return super.getLongLE(index);
798     }
799 
800     @Override
801     public ByteBuf setShortLE(int index, int value) {
802         recordLeakNonRefCountingOperation(leak);
803         return super.setShortLE(index, value);
804     }
805 
806     @Override
807     public ByteBuf setIntLE(int index, int value) {
808         recordLeakNonRefCountingOperation(leak);
809         return super.setIntLE(index, value);
810     }
811 
812     @Override
813     public ByteBuf setMediumLE(int index, int value) {
814         recordLeakNonRefCountingOperation(leak);
815         return super.setMediumLE(index, value);
816     }
817 
818     @Override
819     public ByteBuf setLongLE(int index, long value) {
820         recordLeakNonRefCountingOperation(leak);
821         return super.setLongLE(index, value);
822     }
823 
824     @Override
825     public short readShortLE() {
826         recordLeakNonRefCountingOperation(leak);
827         return super.readShortLE();
828     }
829 
830     @Override
831     public int readUnsignedShortLE() {
832         recordLeakNonRefCountingOperation(leak);
833         return super.readUnsignedShortLE();
834     }
835 
836     @Override
837     public int readMediumLE() {
838         recordLeakNonRefCountingOperation(leak);
839         return super.readMediumLE();
840     }
841 
842     @Override
843     public int readUnsignedMediumLE() {
844         recordLeakNonRefCountingOperation(leak);
845         return super.readUnsignedMediumLE();
846     }
847 
848     @Override
849     public int readIntLE() {
850         recordLeakNonRefCountingOperation(leak);
851         return super.readIntLE();
852     }
853 
854     @Override
855     public long readUnsignedIntLE() {
856         recordLeakNonRefCountingOperation(leak);
857         return super.readUnsignedIntLE();
858     }
859 
860     @Override
861     public long readLongLE() {
862         recordLeakNonRefCountingOperation(leak);
863         return super.readLongLE();
864     }
865 
866     @Override
867     public ByteBuf writeShortLE(int value) {
868         recordLeakNonRefCountingOperation(leak);
869         return super.writeShortLE(value);
870     }
871 
872     @Override
873     public ByteBuf writeMediumLE(int value) {
874         recordLeakNonRefCountingOperation(leak);
875         return super.writeMediumLE(value);
876     }
877 
878     @Override
879     public ByteBuf writeIntLE(int value) {
880         recordLeakNonRefCountingOperation(leak);
881         return super.writeIntLE(value);
882     }
883 
884     @Override
885     public ByteBuf writeLongLE(long value) {
886         recordLeakNonRefCountingOperation(leak);
887         return super.writeLongLE(value);
888     }
889 
890     @Override
891     public int writeCharSequence(CharSequence sequence, Charset charset) {
892         recordLeakNonRefCountingOperation(leak);
893         return super.writeCharSequence(sequence, charset);
894     }
895 
896     @Override
897     public int getBytes(int index, FileChannel out, long position, int length) throws IOException {
898         recordLeakNonRefCountingOperation(leak);
899         return super.getBytes(index, out, position, length);
900     }
901 
902     @Override
903     public int setBytes(int index, FileChannel in, long position, int length) throws IOException {
904         recordLeakNonRefCountingOperation(leak);
905         return super.setBytes(index, in, position, length);
906     }
907 
908     @Override
909     public int readBytes(FileChannel out, long position, int length) throws IOException {
910         recordLeakNonRefCountingOperation(leak);
911         return super.readBytes(out, position, length);
912     }
913 
914     @Override
915     public int writeBytes(FileChannel in, long position, int length) throws IOException {
916         recordLeakNonRefCountingOperation(leak);
917         return super.writeBytes(in, position, length);
918     }
919 
920     @Override
921     public ByteBuf asReadOnly() {
922         recordLeakNonRefCountingOperation(leak);
923         return super.asReadOnly();
924     }
925 
926     @Override
927     public ByteBuf retain() {
928         leak.record();
929         return super.retain();
930     }
931 
932     @Override
933     public ByteBuf retain(int increment) {
934         leak.record();
935         return super.retain(increment);
936     }
937 
938     @Override
939     public boolean release() {
940         leak.record();
941         return super.release();
942     }
943 
944     @Override
945     public boolean release(int decrement) {
946         leak.record();
947         return super.release(decrement);
948     }
949 
950     @Override
951     public ByteBuf touch() {
952         leak.record();
953         return this;
954     }
955 
956     @Override
957     public ByteBuf touch(Object hint) {
958         leak.record(hint);
959         return this;
960     }
961 
962     @Override
963     protected AdvancedLeakAwareByteBuf newLeakAwareByteBuf(
964             ByteBuf buf, ByteBuf trackedByteBuf, ResourceLeakTracker<ByteBuf> leakTracker) {
965         return new AdvancedLeakAwareByteBuf(buf, trackedByteBuf, leakTracker);
966     }
967 }