@Override protected final void doClose() throws IOException { super.doClose(); lineReader.close(); } }
@Override protected final void doStop() { super.doStop(); inputFinishFlag.set(true); Loggers.MSG.info( "Read task finish: scattered {} lines from the input file \"{}\"", lineCount, srcFileName); }
@Override protected final void invokeTimed(final long startTimeNanos) { if(invocationLock.tryLock()) { try { invokeTimedExclusively(startTimeNanos); } finally { invocationLock.unlock(); } } }
private void startIfNotStarted() { if (!isStarted()) { super.start(); Loggers.MSG.debug("Started the metrics manager fiber"); } }
@Override public boolean await(final long timeout, final TimeUnit timeUnit) throws IllegalStateException, InterruptedException { if(isShutdown()) { final long invokeTimeMillis = System.currentTimeMillis(); final long timeOutMillis = timeUnit.toMillis(timeout); while(timeOutMillis > System.currentTimeMillis() - invokeTimeMillis) { if(itemsBuff.isEmpty()) { return true; } LockSupport.parkNanos(1); } return false; } else { return super.await(timeout, timeUnit); } }
@Override protected final void doClose() throws IOException { super.doClose(); lines.clear(); linesByteBuff.close(); linesWriter.close(); } }