java.nio.channels.AlreadyBoundException Java Examples

The following examples show how to use java.nio.channels.AlreadyBoundException. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: DatagramChannelImpl.java    From Bytecoder with Apache License 2.0 6 votes vote down vote up
@Override
public DatagramChannel bind(SocketAddress local) throws IOException {
    readLock.lock();
    try {
        writeLock.lock();
        try {
            synchronized (stateLock) {
                ensureOpen();
                if (localAddress != null)
                    throw new AlreadyBoundException();
                bindInternal(local);
            }
        } finally {
            writeLock.unlock();
        }
    } finally {
        readLock.unlock();
    }
    return this;
}
 
Example #2
Source File: ServerSocketChannelImpl.java    From Bytecoder with Apache License 2.0 6 votes vote down vote up
@Override
public ServerSocketChannel bind(SocketAddress local, int backlog) throws IOException {
    synchronized (stateLock) {
        ensureOpen();
        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());
        Net.listen(fd, backlog < 1 ? 50 : backlog);
        localAddress = Net.localAddress(fd);
    }
    return this;
}
 
Example #3
Source File: SocketChannelImpl.java    From Bytecoder with Apache License 2.0 5 votes vote down vote up
@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;
}
 
Example #4
Source File: SctpNet.java    From dragonwell8_jdk with GNU General Public License v2.0 4 votes vote down vote up
static boolean throwAlreadyBoundException() throws IOException {
    throw new AlreadyBoundException();
}
 
Example #5
Source File: SctpNet.java    From TencentKona-8 with GNU General Public License v2.0 4 votes vote down vote up
static boolean throwAlreadyBoundException() throws IOException {
    throw new AlreadyBoundException();
}
 
Example #6
Source File: SctpNet.java    From jdk8u60 with GNU General Public License v2.0 4 votes vote down vote up
static boolean throwAlreadyBoundException() throws IOException {
    throw new AlreadyBoundException();
}
 
Example #7
Source File: SctpNet.java    From openjdk-jdk8u with GNU General Public License v2.0 4 votes vote down vote up
static boolean throwAlreadyBoundException() throws IOException {
    throw new AlreadyBoundException();
}
 
Example #8
Source File: SctpNet.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 4 votes vote down vote up
static boolean throwAlreadyBoundException() throws IOException {
    throw new AlreadyBoundException();
}
 
Example #9
Source File: SctpNet.java    From openjdk-jdk9 with GNU General Public License v2.0 4 votes vote down vote up
static boolean throwAlreadyBoundException() throws IOException {
    throw new AlreadyBoundException();
}
 
Example #10
Source File: SctpNet.java    From jdk8u-jdk with GNU General Public License v2.0 4 votes vote down vote up
static boolean throwAlreadyBoundException() throws IOException {
    throw new AlreadyBoundException();
}
 
Example #11
Source File: SctpNet.java    From hottub with GNU General Public License v2.0 4 votes vote down vote up
static boolean throwAlreadyBoundException() throws IOException {
    throw new AlreadyBoundException();
}
 
Example #12
Source File: SctpNet.java    From openjdk-8-source with GNU General Public License v2.0 4 votes vote down vote up
static boolean throwAlreadyBoundException() throws IOException {
    throw new AlreadyBoundException();
}
 
Example #13
Source File: SctpNet.java    From openjdk-8 with GNU General Public License v2.0 4 votes vote down vote up
static boolean throwAlreadyBoundException() throws IOException {
    throw new AlreadyBoundException();
}
 
Example #14
Source File: SctpNet.java    From jdk8u_jdk with GNU General Public License v2.0 4 votes vote down vote up
static boolean throwAlreadyBoundException() throws IOException {
    throw new AlreadyBoundException();
}
 
Example #15
Source File: SctpNet.java    From jdk8u-jdk with GNU General Public License v2.0 4 votes vote down vote up
static boolean throwAlreadyBoundException() throws IOException {
    throw new AlreadyBoundException();
}
 
Example #16
Source File: SctpNet.java    From jdk8u-dev-jdk with GNU General Public License v2.0 4 votes vote down vote up
static boolean throwAlreadyBoundException() throws IOException {
    throw new AlreadyBoundException();
}