avoid crash when Selector.close is called more than once on the same instance

This commit is contained in:
Joel Dice 2012-01-30 13:42:32 -07:00
parent 222b357089
commit 807f2a8d51

View File

@ -106,8 +106,11 @@ class SocketSelector extends Selector {
return selectedKeys.size();
}
public void close() {
natClose(state);
public synchronized void close() {
if (isOpen()) {
natClose(state);
state = 0;
}
}
private static native long natInit();