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

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

本文整理了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

private ThreadSafeLazyLoadedIvoryTower() {
 // protect against instantiation via reflection
 if (instance == null) {
  instance = this;
 } else {
  throw new IllegalStateException("Already initialized.");
 }
}

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

/**
 * private constructor to prevent client from instantiating.
 */
private ThreadSafeDoubleCheckLocking() {
 // to prevent instantiating by Reflection call
 if (instance != null) {
  throw new IllegalStateException("Already initialized.");
 }
}

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

@Override
 public void onError(Throwable throwable) {
  throw new IllegalStateException("Should not occur");
 }
}

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

/** Utility class. */
private Exceptions() {
  throw new IllegalStateException("No instances!");
}
/**

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

@Override
  public void run() {
    throw new IllegalStateException();
  }
});

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

@Override
  public Integer apply(Integer a, Integer b) throws Exception {
    throw new IllegalStateException();
  }
})

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

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

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

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

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

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

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

@Override
public void onSubscribe(Subscription s) {
  if (once.compareAndSet(false, true)) {
    downstream.onSubscribe(this);
    SubscriptionHelper.deferredSetOnce(this.upstream, requested, s);
  } else {
    s.cancel();
    cancel();
    onError(new IllegalStateException("§2.12 violated: onSubscribe must be called at most once"));
  }
}

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

/**
 * We expect IllegalStateException to pass thru map.
 */
@Test(expected = IllegalStateException.class)
public void testErrorPassesThruMap2() {
  Observable.error(new IllegalStateException()).map(new Function<Object, Object>() {
    @Override
    public Object apply(Object i) {
      return i;
    }
  }).blockingSingle();
}

相关文章