@Override public void updateThrown(Throwable t, String update, Object... args) { throw Jvm.rethrow(t); } }
@Override public void queryThrown(Throwable t, String query, Object... args) { throw Jvm.rethrow(t); }
@Override public void onMessage(final Message message) { a1[0] = message; try { handler.invoke(proxy, m1, a1); } catch (Throwable throwable) { Jvm.rethrow(throwable); } } }
@Override public long lastIndexAppended() { if (lastIndex != Long.MIN_VALUE) return lastIndex; if (lastPosition == Long.MIN_VALUE || wire == null) { throw new IllegalStateException("nothing has been appended, so there is no last index"); } try { long sequenceNumber = store.sequenceForPosition(this, lastPosition, true); long index = queue.rollCycle().toIndex(lastCycle, sequenceNumber); lastIndex(index); return index; } catch (Exception e) { throw Jvm.rethrow(e); } }
/** * pretouch() has to be run on the same thread, as the thread that created the appender. * If you want to use pretouch() in another thread, you must first create or have an appender that * was created on this thread, and then use this appender to call the pretouch() */ @Override public void pretouch() { if (queue.isClosed()) throw new RuntimeException("Queue Closed"); try { if (pretoucher == null) pretoucher = new Pretoucher(queue()); pretoucher.execute(); } catch (Throwable e) { Jvm.warn().on(getClass(), e); Jvm.rethrow(e); } }
boolean checkWritePositionHeaderNumber() { if (wire == null || wire.headerNumber() == Long.MIN_VALUE) return true; try { long pos = position; long seq1 = queue.rollCycle().toSequenceNumber(wire.headerNumber() + 1) - 1; long seq2 = store.sequenceForPosition(this, pos, true); if (seq1 != seq2) { // System.out.println(queue.dump()); String message = "~~~~~~~~~~~~~~ " + "thread: " + Thread.currentThread().getName() + " pos: " + pos + " header: " + wire.headerNumber() + " seq1: " + seq1 + " seq2: " + seq2; //System.err.println(message); new AssertionError(message).printStackTrace(); throw new AssertionError(message); } } catch (Exception e) { Jvm.fatal().on(getClass(), e); throw Jvm.rethrow(e); } return true; }
throw Jvm.rethrow(e);
static long sizeFor(long capacity, int numReaders) { try { //noinspection AccessStaticViaInstance final Method sizeFor = Class.forName( "software.chronicle.enterprise.queue.ChronicleRingBuffer").getMethod("sizeFor", long.class, int.class); return (long) sizeFor.invoke(null, capacity, numReaders); } catch (Exception e) { LOG.error("This is a a commercial feature, please contact " + "sales@higherfrequencytrading.com to unlock this feature."); throw Jvm.rethrow(e); } }
private Stream<Path> getFiles() { try { return Files .walk(dirPath) .filter(p -> !Files.isDirectory(p)) .filter(this::isVisible); } catch (IOException e) { throw Jvm.rethrow(e); } }
public static Object readResolve(@NotNull Object o) { Method readResove = READ_RESOLVE.get(o.getClass()); if (readResove == null) return o; try { return readResove.invoke(o); } catch (IllegalAccessException e) { throw Jvm.rethrow(e); } catch (InvocationTargetException e) { throw Jvm.rethrow(e.getCause()); } }
static <I, R, T extends Throwable> Function<I, R> asFunction(@NotNull ThrowingFunction<I, R, T> function) { return in -> { try { return function.apply(in); } catch (Throwable t) { throw Jvm.rethrow(t); } }; }
static <I, T extends Throwable> Consumer<I> asConsumer(@NotNull ThrowingConsumer<I, T> function) { return in -> { try { function.accept(in); } catch (Throwable t) { throw Jvm.rethrow(t); } }; }
static <I, J, T extends Throwable> BiConsumer<I, J> asConsumer(@NotNull ThrowingBiConsumer<I, J, T> function) { return (in, i2) -> { try { function.accept(in, i2); } catch (Throwable t) { throw Jvm.rethrow(t); } }; }
static <I, J, T extends Throwable, R> BiFunction<I, J, R> asBiFunction(@NotNull ThrowingBiFunction<I, J, R, T> function) { return (in, i2) -> { try { return function.apply(in, i2); } catch (Throwable t) { throw Jvm.rethrow(t); } }; }
void read(Object o, BytesIn read) { try { setValue(o, read); } catch (IllegalAccessException iae) { throw new AssertionError(iae); } catch (IORuntimeException e) { throw Jvm.rethrow(e); } }
static <I, J, T extends Throwable, R> BiFunction<I, J, R> asBiFunction(@NotNull ThrowingBiFunction<I, J, R, T> function) { return (in, i2) -> { try { return function.apply(in, i2); } catch (Throwable t) { throw Jvm.rethrow(t); } }; }
static <I, J, T extends Throwable> BiConsumer<I, J> asConsumer(@NotNull ThrowingBiConsumer<I, J, T> function) { return (in, i2) -> { try { function.accept(in, i2); } catch (Throwable t) { throw Jvm.rethrow(t); } }; }
@NotNull public static QueueView create(@NotNull RequestContext context, @NotNull Asset asset) { try { return new ChronicleQueueView<>(context, asset); } catch (IOException e) { throw Jvm.rethrow(e); } }
private static RuntimeException tryDeregisterWaitAndRethrow(long address, Throwable throwable) { try { deregisterWait(address); } catch (Throwable t) { throwable.addSuppressed(t); } throw Jvm.rethrow(throwable); }
@ForceInline public static void parseUtf8(@org.jetbrains.annotations.NotNull @NotNull StreamingDataInput bytes, @org.jetbrains.annotations.NotNull @NotNull Appendable builder, @org.jetbrains.annotations.NotNull @NotNull StopCharsTester tester) throws IllegalArgumentException, BufferUnderflowException, IORuntimeException { AppendableUtil.setLength(builder, 0); try { AppendableUtil.readUtf8AndAppend(bytes, builder, tester); } catch (IOException e) { throw Jvm.rethrow(e); } }