本文整理了Java中java.lang.IllegalStateException
类的一些代码示例,展示了IllegalStateException
类的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。IllegalStateException
类的具体详情如下:
包路径:java.lang.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!");
}
内容来源于网络,如有侵权,请联系作者删除!