net.openhft.chronicle.core.Jvm.rethrow()方法的使用及代码示例

x33g5p2x  于2022-01-22 转载在 其他  
字(6.1k)|赞(0)|评价(0)|浏览(120)

本文整理了Java中net.openhft.chronicle.core.Jvm.rethrow()方法的一些代码示例,展示了Jvm.rethrow()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Jvm.rethrow()方法的具体详情如下:
包路径:net.openhft.chronicle.core.Jvm
类名称:Jvm
方法名:rethrow

Jvm.rethrow介绍

[英]Cast a CheckedException as an unchecked one.
[中]将CheckedException强制转换为未经检查的异常。

代码示例

代码示例来源:origin: OpenHFT/Chronicle-Queue

@Override
  public void updateThrown(Throwable t, String update, Object... args) {
    throw Jvm.rethrow(t);
  }
}

代码示例来源:origin: OpenHFT/Chronicle-Queue

@Override
public void queryThrown(Throwable t, String query, Object... args) {
  throw Jvm.rethrow(t);
}

代码示例来源:origin: OpenHFT/Chronicle-Queue

@Override
  public void onMessage(final Message message) {
    a1[0] = message;
    try {
      handler.invoke(proxy, m1, a1);
    } catch (Throwable throwable) {
      Jvm.rethrow(throwable);
    }
  }
}

代码示例来源:origin: OpenHFT/Chronicle-Queue

@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);
  }
}

代码示例来源:origin: OpenHFT/Chronicle-Queue

/**
 * 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);
  }
}

代码示例来源:origin: OpenHFT/Chronicle-Queue

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;
    }

代码示例来源:origin: OpenHFT/Chronicle-Queue

throw Jvm.rethrow(e);

代码示例来源:origin: net.openhft/chronicle-bytes

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);
  }
}

代码示例来源:origin: net.openhft/chronicle-engine

private Stream<Path> getFiles() {
  try {
    return Files
        .walk(dirPath)
        .filter(p -> !Files.isDirectory(p))
        .filter(this::isVisible);
  } catch (IOException e) {
    throw Jvm.rethrow(e);
  }
}

代码示例来源:origin: OpenHFT/Chronicle-Core

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());
  }
}

代码示例来源:origin: net.openhft/chronicle-core

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);
    }
  };
}

代码示例来源:origin: net.openhft/chronicle-core

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);
    }
  };
}

代码示例来源:origin: OpenHFT/Chronicle-Core

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);
    }
  };
}

代码示例来源:origin: OpenHFT/Chronicle-Core

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);
    }
  };
}

代码示例来源:origin: net.openhft/chronicle-bytes

void read(Object o, BytesIn read) {
  try {
    setValue(o, read);
  } catch (IllegalAccessException iae) {
    throw new AssertionError(iae);
  } catch (IORuntimeException e) {
    throw Jvm.rethrow(e);
  }
}

代码示例来源:origin: net.openhft/chronicle-core

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);
    }
  };
}

代码示例来源:origin: net.openhft/chronicle-core

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);
    }
  };
}

代码示例来源:origin: net.openhft/chronicle-engine

@NotNull
public static QueueView create(@NotNull RequestContext context, @NotNull Asset asset) {
  try {
    return new ChronicleQueueView<>(context, asset);
  } catch (IOException e) {
    throw Jvm.rethrow(e);
  }
}

代码示例来源:origin: net.openhft/chronicle-map

private static RuntimeException tryDeregisterWaitAndRethrow(long address, Throwable throwable) {
  try {
    deregisterWait(address);
  } catch (Throwable t) {
    throwable.addSuppressed(t);
  }
  throw Jvm.rethrow(throwable);
}

代码示例来源:origin: net.openhft/chronicle-bytes

@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);
  }
}

相关文章