* Slight code clean up

* Raised the default cancelled key clean up interval from 128 to 256
This commit is contained in:
Trustin Lee 2009-11-02 09:21:41 +00:00
parent b105461383
commit cdf1474059
2 changed files with 4 additions and 2 deletions

View File

@ -361,7 +361,7 @@ class NioDatagramWorker implements Runnable {
}
private boolean cleanUpCancelledKeys() throws IOException {
if (cancelledKeys >= 128) { // FIXME hardcoded value
if (cancelledKeys >= NioWorker.CLEANUP_INTERVAL) {
cancelledKeys = 0;
selector.selectNow();
return true;

View File

@ -65,6 +65,8 @@ class NioWorker implements Runnable {
private static final int CONSTRAINT_LEVEL = NioProviderMetadata.CONSTRAINT_LEVEL;
static final int CLEANUP_INTERVAL = 256; // XXX Hard-coded value, but won't need customization.
private final int bossId;
private final int id;
private final Executor executor;
@ -292,7 +294,7 @@ class NioWorker implements Runnable {
}
private boolean cleanUpCancelledKeys() throws IOException {
if (cancelledKeys >= 128) { // FIXME hardcoded value
if (cancelledKeys >= CLEANUP_INTERVAL) {
cancelledKeys = 0;
selector.selectNow();
return true;