/** * {@inheritDoc} */ @Override public boolean read() { this.result = this.executorService.scheduleAtFixedRate(new TimestampEventTask(this.numberImpulses), this.initialDelay, this.period, TimeUnit.NANOSECONDS); try { if (this.numberImpulses == INFINITE_EMITS) { this.result.get(); } else { this.impulseEmitLatch.await(); } } catch (final ExecutionException ex) { this.terminate(true); throw new RuntimeException(ex.getCause()); // NOPMD (throw RunTimeException) } catch (final InterruptedException ignore) { // NOPMD (ignore exception) // ignore this one } catch (final CancellationException ignore) { // NOPMD (ignore exception) // ignore this one, too } this.terminate(false); return true; }
/** * {@inheritDoc} */ @Override public boolean read() { this.result = this.executorService.scheduleAtFixedRate(new TimestampEventTask(this.numberImpulses), this.initialDelay, this.period, TimeUnit.NANOSECONDS); try { if (this.numberImpulses == INFINITE_EMITS) { this.result.get(); } else { this.impulseEmitLatch.await(); } } catch (final ExecutionException ex) { this.terminate(true); throw new RuntimeException(ex.getCause()); // NOPMD (throw RunTimeException) } catch (final InterruptedException ignore) { // NOPMD (ignore exception) // ignore this one } catch (final CancellationException ignore) { // NOPMD (ignore exception) // ignore this one, too } this.terminate(false); return true; }