< prev index next >

src/java.base/share/classes/java/lang/StackStreamFactory.java

Print this page




 667         Class<?> findCaller() {
 668             walk();
 669             return caller;
 670         }
 671 
 672         @Override
 673         protected Integer consumeFrames() {
 674             checkState(OPEN);
 675             int n = 0;
 676             Class<?>[] frames = new Class<?>[2];
 677             // skip the API calling this getCallerClass method
 678             // 0: StackWalker::getCallerClass
 679             // 1: caller-sensitive method
 680             // 2: caller class
 681             while (n < 2 && (caller = nextFrame()) != null) {
 682                 if (isMethodHandleFrame(caller)) { continue; }
 683                 if (isReflectionFrame(caller)) { continue; }
 684                 frames[n++] = caller;
 685             }
 686             if (frames[1] == null) {
 687                 throw new IllegalStateException("no caller frame");
 688             }
 689             return n;
 690         }
 691 
 692         @Override
 693         protected void initFrameBuffer() {
 694             this.frameBuffer = new ClassBuffer(getNextBatchSize());
 695         }
 696 
 697         @Override
 698         protected int batchSize(int lastBatchFrameCount) {
 699             return MIN_BATCH_SIZE;
 700         }
 701 
 702         @Override
 703         protected int getNextBatchSize() {
 704             return MIN_BATCH_SIZE;
 705         }
 706     }
 707 




 667         Class<?> findCaller() {
 668             walk();
 669             return caller;
 670         }
 671 
 672         @Override
 673         protected Integer consumeFrames() {
 674             checkState(OPEN);
 675             int n = 0;
 676             Class<?>[] frames = new Class<?>[2];
 677             // skip the API calling this getCallerClass method
 678             // 0: StackWalker::getCallerClass
 679             // 1: caller-sensitive method
 680             // 2: caller class
 681             while (n < 2 && (caller = nextFrame()) != null) {
 682                 if (isMethodHandleFrame(caller)) { continue; }
 683                 if (isReflectionFrame(caller)) { continue; }
 684                 frames[n++] = caller;
 685             }
 686             if (frames[1] == null) {
 687                 throw new IllegalCallerException("no caller frame");
 688             }
 689             return n;
 690         }
 691 
 692         @Override
 693         protected void initFrameBuffer() {
 694             this.frameBuffer = new ClassBuffer(getNextBatchSize());
 695         }
 696 
 697         @Override
 698         protected int batchSize(int lastBatchFrameCount) {
 699             return MIN_BATCH_SIZE;
 700         }
 701 
 702         @Override
 703         protected int getNextBatchSize() {
 704             return MIN_BATCH_SIZE;
 705         }
 706     }
 707 


< prev index next >