mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-27 06:45:07 +02:00
8200257: (se) More Selector cleanup
Reviewed-by: bpb
This commit is contained in:
parent
8a1bee438c
commit
34c94079ed
20 changed files with 457 additions and 548 deletions
|
@ -445,10 +445,9 @@ class ServerSocketChannelImpl
|
|||
/**
|
||||
* Translates native poll revent set into a ready operation set
|
||||
*/
|
||||
public boolean translateReadyOps(int ops, int initialOps,
|
||||
SelectionKeyImpl sk) {
|
||||
int intOps = sk.nioInterestOps(); // Do this just once, it synchronizes
|
||||
int oldOps = sk.nioReadyOps();
|
||||
public boolean translateReadyOps(int ops, int initialOps, SelectionKeyImpl ski) {
|
||||
int intOps = ski.nioInterestOps();
|
||||
int oldOps = ski.nioReadyOps();
|
||||
int newOps = initialOps;
|
||||
|
||||
if ((ops & Net.POLLNVAL) != 0) {
|
||||
|
@ -460,7 +459,7 @@ class ServerSocketChannelImpl
|
|||
|
||||
if ((ops & (Net.POLLERR | Net.POLLHUP)) != 0) {
|
||||
newOps = intOps;
|
||||
sk.nioReadyOps(newOps);
|
||||
ski.nioReadyOps(newOps);
|
||||
return (newOps & ~oldOps) != 0;
|
||||
}
|
||||
|
||||
|
@ -468,29 +467,26 @@ class ServerSocketChannelImpl
|
|||
((intOps & SelectionKey.OP_ACCEPT) != 0))
|
||||
newOps |= SelectionKey.OP_ACCEPT;
|
||||
|
||||
sk.nioReadyOps(newOps);
|
||||
ski.nioReadyOps(newOps);
|
||||
return (newOps & ~oldOps) != 0;
|
||||
}
|
||||
|
||||
public boolean translateAndUpdateReadyOps(int ops, SelectionKeyImpl sk) {
|
||||
return translateReadyOps(ops, sk.nioReadyOps(), sk);
|
||||
public boolean translateAndUpdateReadyOps(int ops, SelectionKeyImpl ski) {
|
||||
return translateReadyOps(ops, ski.nioReadyOps(), ski);
|
||||
}
|
||||
|
||||
public boolean translateAndSetReadyOps(int ops, SelectionKeyImpl sk) {
|
||||
return translateReadyOps(ops, 0, sk);
|
||||
public boolean translateAndSetReadyOps(int ops, SelectionKeyImpl ski) {
|
||||
return translateReadyOps(ops, 0, ski);
|
||||
}
|
||||
|
||||
/**
|
||||
* Translates an interest operation set into a native poll event set
|
||||
*/
|
||||
public void translateAndSetInterestOps(int ops, SelectionKeyImpl sk) {
|
||||
public int translateInterestOps(int ops) {
|
||||
int newOps = 0;
|
||||
|
||||
// Translate ops
|
||||
if ((ops & SelectionKey.OP_ACCEPT) != 0)
|
||||
newOps |= Net.POLLIN;
|
||||
// Place ops into pollfd array
|
||||
sk.selector.putEventOps(sk, newOps);
|
||||
return newOps;
|
||||
}
|
||||
|
||||
public FileDescriptor getFD() {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue