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