java.lang.IllegalStateException.<init>()方法的使用及代码示例

x33g5p2x  于2022-01-16 转载在 其他  
字(6.5k)|赞(0)|评价(0)|浏览(196)

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

IllegalStateException.<init>介绍

[英]Constructs a new IllegalStateException that includes the current stack trace.
[中]构造包含当前堆栈跟踪的新IllegalStateException。

代码示例

代码示例来源:origin: iluwatar/java-design-patterns

  1. private ThreadSafeLazyLoadedIvoryTower() {
  2. // protect against instantiation via reflection
  3. if (instance == null) {
  4. instance = this;
  5. } else {
  6. throw new IllegalStateException("Already initialized.");
  7. }
  8. }

代码示例来源:origin: iluwatar/java-design-patterns

  1. /**
  2. * private constructor to prevent client from instantiating.
  3. */
  4. private ThreadSafeDoubleCheckLocking() {
  5. // to prevent instantiating by Reflection call
  6. if (instance != null) {
  7. throw new IllegalStateException("Already initialized.");
  8. }
  9. }

代码示例来源:origin: iluwatar/java-design-patterns

  1. @Override
  2. public void onError(Throwable throwable) {
  3. throw new IllegalStateException("Should not occur");
  4. }
  5. }

代码示例来源:origin: ReactiveX/RxJava

  1. /** Utility class. */
  2. private Exceptions() {
  3. throw new IllegalStateException("No instances!");
  4. }
  5. /**

代码示例来源:origin: ReactiveX/RxJava

  1. /** Helper class, no instances. */
  2. private RxJavaPlugins() {
  3. throw new IllegalStateException("No instances!");
  4. }
  5. }

代码示例来源:origin: ReactiveX/RxJava

  1. /**
  2. * Sets the specific hook function.
  3. * @param handler the hook function to set, null allowed, but the function may not return null
  4. */
  5. public static void setInitIoSchedulerHandler(@Nullable Function<? super Callable<Scheduler>, ? extends Scheduler> handler) {
  6. if (lockdown) {
  7. throw new IllegalStateException("Plugins can't be changed anymore");
  8. }
  9. onInitIoHandler = handler;
  10. }

代码示例来源:origin: ReactiveX/RxJava

  1. /**
  2. * Sets the specific hook function.
  3. * @param handler the hook function to set, null allowed, but the function may not return null
  4. */
  5. public static void setInitNewThreadSchedulerHandler(@Nullable Function<? super Callable<Scheduler>, ? extends Scheduler> handler) {
  6. if (lockdown) {
  7. throw new IllegalStateException("Plugins can't be changed anymore");
  8. }
  9. onInitNewThreadHandler = handler;
  10. }

代码示例来源:origin: ReactiveX/RxJava

  1. /**
  2. * Sets the specific hook function.
  3. * @param handler the hook function to set, null allowed, but the function may not return null
  4. */
  5. public static void setInitSingleSchedulerHandler(@Nullable Function<? super Callable<Scheduler>, ? extends Scheduler> handler) {
  6. if (lockdown) {
  7. throw new IllegalStateException("Plugins can't be changed anymore");
  8. }
  9. onInitSingleHandler = handler;
  10. }

代码示例来源:origin: ReactiveX/RxJava

  1. /**
  2. * Sets the specific hook function.
  3. * @param onObservableSubscribe the hook function to set, null allowed
  4. */
  5. @SuppressWarnings("rawtypes")
  6. public static void setOnObservableSubscribe(
  7. @Nullable BiFunction<? super Observable, ? super Observer, ? extends Observer> onObservableSubscribe) {
  8. if (lockdown) {
  9. throw new IllegalStateException("Plugins can't be changed anymore");
  10. }
  11. RxJavaPlugins.onObservableSubscribe = onObservableSubscribe;
  12. }

代码示例来源:origin: ReactiveX/RxJava

  1. /**
  2. * Sets the specific hook function.
  3. * @param handler the hook function to set, null allowed
  4. */
  5. public static void setErrorHandler(@Nullable Consumer<? super Throwable> handler) {
  6. if (lockdown) {
  7. throw new IllegalStateException("Plugins can't be changed anymore");
  8. }
  9. errorHandler = handler;
  10. }

代码示例来源:origin: ReactiveX/RxJava

  1. /**
  2. * Sets the specific hook function.
  3. * @param onFlowableSubscribe the hook function to set, null allowed
  4. */
  5. @SuppressWarnings("rawtypes")
  6. public static void setOnFlowableSubscribe(@Nullable BiFunction<? super Flowable, ? super Subscriber, ? extends Subscriber> onFlowableSubscribe) {
  7. if (lockdown) {
  8. throw new IllegalStateException("Plugins can't be changed anymore");
  9. }
  10. RxJavaPlugins.onFlowableSubscribe = onFlowableSubscribe;
  11. }

代码示例来源:origin: ReactiveX/RxJava

  1. /**
  2. * Sets the specific hook function.
  3. * @param onSingleAssembly the hook function to set, null allowed
  4. */
  5. @SuppressWarnings("rawtypes")
  6. public static void setOnSingleAssembly(@Nullable Function<? super Single, ? extends Single> onSingleAssembly) {
  7. if (lockdown) {
  8. throw new IllegalStateException("Plugins can't be changed anymore");
  9. }
  10. RxJavaPlugins.onSingleAssembly = onSingleAssembly;
  11. }

代码示例来源:origin: ReactiveX/RxJava

  1. /**
  2. * Sets the specific hook function.
  3. * @param onSingleSubscribe the hook function to set, null allowed
  4. */
  5. @SuppressWarnings("rawtypes")
  6. public static void setOnSingleSubscribe(@Nullable BiFunction<? super Single, ? super SingleObserver, ? extends SingleObserver> onSingleSubscribe) {
  7. if (lockdown) {
  8. throw new IllegalStateException("Plugins can't be changed anymore");
  9. }
  10. RxJavaPlugins.onSingleSubscribe = onSingleSubscribe;
  11. }

代码示例来源:origin: ReactiveX/RxJava

  1. @Override
  2. public void run() {
  3. throw new IllegalStateException();
  4. }
  5. });

代码示例来源:origin: ReactiveX/RxJava

  1. @Override
  2. public Integer apply(Integer a, Integer b) throws Exception {
  3. throw new IllegalStateException();
  4. }
  5. })

代码示例来源:origin: ReactiveX/RxJava

  1. /**
  2. * Sets the specific hook function.
  3. * @param handler the hook function to set, null allowed, but the function may not return null
  4. */
  5. public static void setInitComputationSchedulerHandler(@Nullable Function<? super Callable<Scheduler>, ? extends Scheduler> handler) {
  6. if (lockdown) {
  7. throw new IllegalStateException("Plugins can't be changed anymore");
  8. }
  9. onInitComputationHandler = handler;
  10. }

代码示例来源:origin: ReactiveX/RxJava

  1. /**
  2. * Sets the specific hook function.
  3. * @param handler the hook function to set, null allowed
  4. */
  5. public static void setIoSchedulerHandler(@Nullable Function<? super Scheduler, ? extends Scheduler> handler) {
  6. if (lockdown) {
  7. throw new IllegalStateException("Plugins can't be changed anymore");
  8. }
  9. onIoHandler = handler;
  10. }

代码示例来源:origin: ReactiveX/RxJava

  1. /**
  2. * Sets the specific hook function.
  3. * @param onMaybeSubscribe the hook function to set, null allowed
  4. */
  5. @SuppressWarnings("rawtypes")
  6. public static void setOnMaybeSubscribe(@Nullable BiFunction<? super Maybe, MaybeObserver, ? extends MaybeObserver> onMaybeSubscribe) {
  7. if (lockdown) {
  8. throw new IllegalStateException("Plugins can't be changed anymore");
  9. }
  10. RxJavaPlugins.onMaybeSubscribe = onMaybeSubscribe;
  11. }

代码示例来源:origin: ReactiveX/RxJava

  1. @Override
  2. public void onSubscribe(Subscription s) {
  3. if (once.compareAndSet(false, true)) {
  4. downstream.onSubscribe(this);
  5. SubscriptionHelper.deferredSetOnce(this.upstream, requested, s);
  6. } else {
  7. s.cancel();
  8. cancel();
  9. onError(new IllegalStateException("§2.12 violated: onSubscribe must be called at most once"));
  10. }
  11. }

代码示例来源:origin: ReactiveX/RxJava

  1. /**
  2. * We expect IllegalStateException to pass thru map.
  3. */
  4. @Test(expected = IllegalStateException.class)
  5. public void testErrorPassesThruMap2() {
  6. Observable.error(new IllegalStateException()).map(new Function<Object, Object>() {
  7. @Override
  8. public Object apply(Object i) {
  9. return i;
  10. }
  11. }).blockingSingle();
  12. }

相关文章