java.lang.IllegalStateException类的使用及代码示例

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

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

IllegalStateException介绍

[英]Thrown when an action is attempted at a time when the VM is not in the correct state.
[中]在VM未处于正确状态时尝试操作时引发。

代码示例

代码示例来源: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

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

代码示例来源:origin: square/okhttp

public Builder allEnabledCipherSuites() {
 if (!tls) throw new IllegalStateException("no cipher suites for cleartext connections");
 this.cipherSuites = null;
 return this;
}

代码示例来源:origin: square/okhttp

@Override protected Handshake handshake() {
 if (delegate.call == null) {
  throw new IllegalStateException("Connection has not yet been established");
 }
 return delegate.handshake;
}

代码示例来源:origin: square/okhttp

public void setServerSocketFactory(ServerSocketFactory serverSocketFactory) {
 if (executor != null) {
  throw new IllegalStateException(
    "setServerSocketFactory() must be called before start()");
 }
 this.serverSocketFactory = serverSocketFactory;
}

代码示例来源:origin: square/okhttp

@Override public Headers trailers() throws IOException {
 if (state != STATE_CLOSED) {
  throw new IllegalStateException("too early; can't read the trailers yet");
 }
 return trailers != null ? trailers : Util.EMPTY_HEADERS;
}

代码示例来源:origin: square/okhttp

public Builder allEnabledTlsVersions() {
 if (!tls) throw new IllegalStateException("no TLS versions for cleartext connections");
 this.tlsVersions = null;
 return this;
}

代码示例来源:origin: square/okhttp

/**
 * @deprecated since OkHttp 3.13 all TLS-connections are expected to support TLS extensions.
 *     In a future release setting this to true will be unnecessary and setting it to false will
 *     have no effect.
 */
public Builder supportsTlsExtensions(boolean supportsTlsExtensions) {
 if (!tls) throw new IllegalStateException("no TLS extensions for cleartext connections");
 this.supportsTlsExtensions = supportsTlsExtensions;
 return this;
}

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

相关文章