本文整理汇总了Java中sun.net.ResourceManager.afterUdpClose方法的典型用法代码示例。如果您正苦于以下问题:Java ResourceManager.afterUdpClose方法的具体用法?Java ResourceManager.afterUdpClose怎么用?Java ResourceManager.afterUdpClose使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类sun.net.ResourceManager
的用法示例。
在下文中一共展示了ResourceManager.afterUdpClose方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: implCloseSelectableChannel
import sun.net.ResourceManager; //导入方法依赖的package包/类
protected void implCloseSelectableChannel() throws IOException {
synchronized (stateLock) {
if (state != ST_KILLED)
nd.preClose(fd);
ResourceManager.afterUdpClose();
// if member of mulitcast group then invalidate all keys
if (registry != null)
registry.invalidateAll();
long th;
if ((th = readerThread) != 0)
NativeThread.signal(th);
if ((th = writerThread) != 0)
NativeThread.signal(th);
if (!isRegistered())
kill();
}
}
示例2: DatagramChannelImpl
import sun.net.ResourceManager; //导入方法依赖的package包/类
public DatagramChannelImpl(SelectorProvider sp)
throws IOException
{
super(sp);
ResourceManager.beforeUdpCreate();
try {
this.family = Net.isIPv6Available() ?
StandardProtocolFamily.INET6 : StandardProtocolFamily.INET;
this.fd = Net.socket(family, false);
this.fdVal = IOUtil.fdVal(fd);
this.state = ST_UNCONNECTED;
} catch (IOException ioe) {
ResourceManager.afterUdpClose();
throw ioe;
}
}
示例3: create
import sun.net.ResourceManager; //导入方法依赖的package包/类
/**
* Creates a socket with a boolean that specifies whether this
* is a stream socket (true) or an unconnected UDP socket (false).
*/
protected synchronized void create(boolean stream) throws IOException {
this.stream = stream;
if (!stream) {
ResourceManager.beforeUdpCreate();
// only create the fd after we know we will be able to create the socket
fd = new FileDescriptor();
try {
socketCreate(false);
} catch (IOException ioe) {
ResourceManager.afterUdpClose();
fd = null;
throw ioe;
}
} else {
fd = new FileDescriptor();
socketCreate(true);
}
if (socket != null)
socket.setCreated();
if (serverSocket != null)
serverSocket.setCreated();
}
示例4: create
import sun.net.ResourceManager; //导入方法依赖的package包/类
/**
* Creates a socket with a boolean that specifies whether this
* is a stream socket (true) or an unconnected UDP socket (false).
*/
protected synchronized void create(boolean stream) throws IOException {
fd = new FileDescriptor();
this.stream = stream;
if (!stream) {
ResourceManager.beforeUdpCreate();
try {
socketCreate(false);
} catch (IOException ioe) {
ResourceManager.afterUdpClose();
fd = null;
throw ioe;
}
} else {
socketCreate(true);
}
if (socket != null)
socket.setCreated();
if (serverSocket != null)
serverSocket.setCreated();
}
示例5: close
import sun.net.ResourceManager; //导入方法依赖的package包/类
protected void close() {
if (fd != null || fd1 != null) {
datagramSocketClose();
ResourceManager.afterUdpClose();
fd = null;
fd1 = null;
}
}
示例6: close
import sun.net.ResourceManager; //导入方法依赖的package包/类
/**
* Closes the socket.
*/
@Override
protected void close() throws IOException {
synchronized(fdLock) {
if (fd != null || fd1 != null) {
if (!stream) {
ResourceManager.afterUdpClose();
}
if (fdUseCount == 0) {
if (closePending) {
return;
}
closePending = true;
socketClose();
fd = null;
fd1 = null;
return;
} else {
/*
* If a thread has acquired the fd and a close
* isn't pending then use a deferred close.
* Also decrement fdUseCount to signal the last
* thread that releases the fd to close it.
*/
if (!closePending) {
closePending = true;
fdUseCount--;
socketClose();
}
}
}
}
}
示例7: create
import sun.net.ResourceManager; //导入方法依赖的package包/类
/**
* Creates a datagram socket
*/
protected synchronized void create() throws SocketException {
ResourceManager.beforeUdpCreate();
fd = new FileDescriptor();
try {
datagramSocketCreate();
} catch (SocketException ioe) {
ResourceManager.afterUdpClose();
fd = null;
throw ioe;
}
}
示例8: close
import sun.net.ResourceManager; //导入方法依赖的package包/类
/**
* Close the socket.
*/
protected void close() {
if (fd != null) {
datagramSocketClose();
ResourceManager.afterUdpClose();
fd = null;
}
}
示例9: create
import sun.net.ResourceManager; //导入方法依赖的package包/类
/**
* Creates a datagram socket
*/
protected synchronized void create() throws SocketException {
fd = new FileDescriptor();
ResourceManager.beforeUdpCreate();
try {
datagramSocketCreate();
} catch (SocketException ioe) {
ResourceManager.afterUdpClose();
fd = null;
throw ioe;
}
}
示例10: close
import sun.net.ResourceManager; //导入方法依赖的package包/类
/**
* Closes the socket.
*/
protected void close() throws IOException {
synchronized(fdLock) {
if (fd != null) {
if (!stream) {
ResourceManager.afterUdpClose();
}
if (fdUseCount == 0) {
if (closePending) {
return;
}
closePending = true;
/*
* We close the FileDescriptor in two-steps - first the
* "pre-close" which closes the socket but doesn't
* release the underlying file descriptor. This operation
* may be lengthy due to untransmitted data and a long
* linger interval. Once the pre-close is done we do the
* actual socket to release the fd.
*/
try {
socketPreClose();
} finally {
socketClose();
}
fd = null;
return;
} else {
/*
* If a thread has acquired the fd and a close
* isn't pending then use a deferred close.
* Also decrement fdUseCount to signal the last
* thread that releases the fd to close it.
*/
if (!closePending) {
closePending = true;
fdUseCount--;
socketPreClose();
}
}
}
}
}