类java.nio.channels.ConnectionPendingException源码实例Demo

下面列出了怎么用java.nio.channels.ConnectionPendingException的API类实例代码及写法,或者点击链接到github查看源代码。

源代码1 项目: netty-4.1.22   文件: Errors.java
static void throwConnectException(String method, NativeConnectException refusedCause, int err)
        throws IOException {
    if (err == refusedCause.expectedErr()) {
        throw refusedCause;
    }
    if (err == ERROR_EALREADY_NEGATIVE) {
        throw new ConnectionPendingException();
    }
    if (err == ERROR_ENETUNREACH_NEGATIVE) {
        throw new NoRouteToHostException();
    }
    if (err == ERROR_EISCONN_NEGATIVE) {
        throw new AlreadyConnectedException();
    }
    if (err == ERRNO_ENOENT_NEGATIVE) {
        throw new FileNotFoundException();
    }
    throw new ConnectException(method + "(..) failed: " + ERRORS[-err]);
}
 
源代码2 项目: dragonwell8_jdk   文件: SctpChannelImpl.java
private void ensureOpenAndUnconnected() throws IOException {
    synchronized (stateLock) {
        if (!isOpen())
            throw new ClosedChannelException();
        if (isConnected())
            throw new AlreadyConnectedException();
        if (state == ChannelState.PENDING)
            throw new ConnectionPendingException();
    }
}
 
源代码3 项目: netty-4.1.22   文件: ProxyHandler.java
@Override
public final void connect(
        ChannelHandlerContext ctx, SocketAddress remoteAddress, SocketAddress localAddress,
        ChannelPromise promise) throws Exception {

    if (destinationAddress != null) {
        promise.setFailure(new ConnectionPendingException());
        return;
    }

    destinationAddress = remoteAddress;
    ctx.connect(proxyAddress, localAddress, promise);
}
 
源代码4 项目: TencentKona-8   文件: SctpChannelImpl.java
private void ensureOpenAndUnconnected() throws IOException {
    synchronized (stateLock) {
        if (!isOpen())
            throw new ClosedChannelException();
        if (isConnected())
            throw new AlreadyConnectedException();
        if (state == ChannelState.PENDING)
            throw new ConnectionPendingException();
    }
}
 
源代码5 项目: jdk8u60   文件: SctpChannelImpl.java
private void ensureOpenAndUnconnected() throws IOException {
    synchronized (stateLock) {
        if (!isOpen())
            throw new ClosedChannelException();
        if (isConnected())
            throw new AlreadyConnectedException();
        if (state == ChannelState.PENDING)
            throw new ConnectionPendingException();
    }
}
 
源代码6 项目: quarkus   文件: VirtualChannel.java
@Override
public void connect(final SocketAddress remoteAddress,
        SocketAddress localAddress, final ChannelPromise promise) {
    if (!promise.setUncancellable() || !ensureOpen(promise)) {
        return;
    }

    if (state == State.CONNECTED) {
        Exception cause = new AlreadyConnectedException();
        safeSetFailure(promise, cause);
        pipeline().fireExceptionCaught(cause);
        return;
    }

    if (connectPromise != null) {
        throw new ConnectionPendingException();
    }

    connectPromise = promise;

    if (state != State.BOUND) {
        // Not bound yet and no localAddress specified - get one.
        if (localAddress == null) {
            localAddress = new VirtualAddress(VirtualChannel.this);
        }
    }

    if (localAddress != null) {
        try {
            doBind(localAddress);
        } catch (Throwable t) {
            safeSetFailure(promise, t);
            close(voidPromise());
            return;
        }
    }

}
 
源代码7 项目: openjdk-jdk8u   文件: SctpChannelImpl.java
private void ensureOpenAndUnconnected() throws IOException {
    synchronized (stateLock) {
        if (!isOpen())
            throw new ClosedChannelException();
        if (isConnected())
            throw new AlreadyConnectedException();
        if (state == ChannelState.PENDING)
            throw new ConnectionPendingException();
    }
}
 
源代码8 项目: openjdk-jdk8u-backup   文件: SctpChannelImpl.java
private void ensureOpenAndUnconnected() throws IOException {
    synchronized (stateLock) {
        if (!isOpen())
            throw new ClosedChannelException();
        if (isConnected())
            throw new AlreadyConnectedException();
        if (state == ChannelState.PENDING)
            throw new ConnectionPendingException();
    }
}
 
源代码9 项目: Bytecoder   文件: SocketChannelImpl.java
@Override
public SocketChannel bind(SocketAddress local) throws IOException {
    readLock.lock();
    try {
        writeLock.lock();
        try {
            synchronized (stateLock) {
                ensureOpen();
                if (state == ST_CONNECTIONPENDING)
                    throw new ConnectionPendingException();
                if (localAddress != null)
                    throw new AlreadyBoundException();
                InetSocketAddress isa = (local == null) ?
                    new InetSocketAddress(0) : Net.checkAddress(local);
                SecurityManager sm = System.getSecurityManager();
                if (sm != null) {
                    sm.checkListen(isa.getPort());
                }
                NetHooks.beforeTcpBind(fd, isa.getAddress(), isa.getPort());
                Net.bind(fd, isa.getAddress(), isa.getPort());
                localAddress = Net.localAddress(fd);
            }
        } finally {
            writeLock.unlock();
        }
    } finally {
        readLock.unlock();
    }
    return this;
}
 
源代码10 项目: openjdk-jdk9   文件: SctpChannelImpl.java
private void ensureOpenAndUnconnected() throws IOException {
    synchronized (stateLock) {
        if (!isOpen())
            throw new ClosedChannelException();
        if (isConnected())
            throw new AlreadyConnectedException();
        if (state == ChannelState.PENDING)
            throw new ConnectionPendingException();
    }
}
 
源代码11 项目: jdk8u-jdk   文件: SctpChannelImpl.java
private void ensureOpenAndUnconnected() throws IOException {
    synchronized (stateLock) {
        if (!isOpen())
            throw new ClosedChannelException();
        if (isConnected())
            throw new AlreadyConnectedException();
        if (state == ChannelState.PENDING)
            throw new ConnectionPendingException();
    }
}
 
源代码12 项目: hottub   文件: SctpChannelImpl.java
private void ensureOpenAndUnconnected() throws IOException {
    synchronized (stateLock) {
        if (!isOpen())
            throw new ClosedChannelException();
        if (isConnected())
            throw new AlreadyConnectedException();
        if (state == ChannelState.PENDING)
            throw new ConnectionPendingException();
    }
}
 
源代码13 项目: openjdk-8-source   文件: SctpChannelImpl.java
private void ensureOpenAndUnconnected() throws IOException {
    synchronized (stateLock) {
        if (!isOpen())
            throw new ClosedChannelException();
        if (isConnected())
            throw new AlreadyConnectedException();
        if (state == ChannelState.PENDING)
            throw new ConnectionPendingException();
    }
}
 
源代码14 项目: openjdk-8   文件: SctpChannelImpl.java
private void ensureOpenAndUnconnected() throws IOException {
    synchronized (stateLock) {
        if (!isOpen())
            throw new ClosedChannelException();
        if (isConnected())
            throw new AlreadyConnectedException();
        if (state == ChannelState.PENDING)
            throw new ConnectionPendingException();
    }
}
 
源代码15 项目: jdk8u_jdk   文件: SctpChannelImpl.java
private void ensureOpenAndUnconnected() throws IOException {
    synchronized (stateLock) {
        if (!isOpen())
            throw new ClosedChannelException();
        if (isConnected())
            throw new AlreadyConnectedException();
        if (state == ChannelState.PENDING)
            throw new ConnectionPendingException();
    }
}
 
源代码16 项目: jdk8u-jdk   文件: SctpChannelImpl.java
private void ensureOpenAndUnconnected() throws IOException {
    synchronized (stateLock) {
        if (!isOpen())
            throw new ClosedChannelException();
        if (isConnected())
            throw new AlreadyConnectedException();
        if (state == ChannelState.PENDING)
            throw new ConnectionPendingException();
    }
}
 
源代码17 项目: jdk8u-dev-jdk   文件: SctpChannelImpl.java
private void ensureOpenAndUnconnected() throws IOException {
    synchronized (stateLock) {
        if (!isOpen())
            throw new ClosedChannelException();
        if (isConnected())
            throw new AlreadyConnectedException();
        if (state == ChannelState.PENDING)
            throw new ConnectionPendingException();
    }
}
 
源代码18 项目: j2objc   文件: ConnectionPendingExceptionTest.java
/**
 * @tests {@link java.nio.channels.ConnectionPendingException#ConnectionPendingException()}
 */
public void test_Constructor() {
    ConnectionPendingException e = new ConnectionPendingException();
    assertNull(e.getMessage());
    assertNull(e.getLocalizedMessage());
    assertNull(e.getCause());
}
 
源代码19 项目: j2objc   文件: ConnectionPendingExceptionTest.java
/**
 * @tests serialization/deserialization compatibility.
 */
public void testSerializationSelf() throws Exception {

    SerializationTest.verifySelf(new ConnectionPendingException());
}
 
源代码20 项目: j2objc   文件: ConnectionPendingExceptionTest.java
/**
 * @tests serialization/deserialization compatibility with RI.
 */
public void testSerializationCompatibility() throws Exception {

    SerializationTest.verifyGolden(this, new ConnectionPendingException());
}
 
 类所在包
 同包方法