Page (long pageNumber) { if (myNeedToAbortSearch && pageNumber == PAGE_NUMBER_TO_STOP) { myStopRangeSearchAction.actionPerformed(ActionUtil.createEmptyEvent()); } //sleep(100); return new Page(EVERY_PAGE_TEXT, pageNumber, pageNumber == getPagesAmount() - 1); }