72
73 /**
74 * Maps a file descriptor to an index from 0 to {@code toIndex}.
75 * @implSpec The default implementation is good for Unix file descriptors.
76 */
77 int fdValToIndex(int fdVal, int toIndex) {
78 return fdVal & (toIndex - 1);
79 }
80
81 /**
82 * Creates a Poller for POLLIN polling.
83 * @param subPoller true to create a sub-poller
84 */
85 abstract Poller readPoller(boolean subPoller) throws IOException;
86
87 /**
88 * Creates a Poller for POLLOUT polling.
89 * @param subPoller true to create a sub-poller
90 */
91 abstract Poller writePoller(boolean subPoller) throws IOException;
92 }
|
72
73 /**
74 * Maps a file descriptor to an index from 0 to {@code toIndex}.
75 * @implSpec The default implementation is good for Unix file descriptors.
76 */
77 int fdValToIndex(int fdVal, int toIndex) {
78 return fdVal & (toIndex - 1);
79 }
80
81 /**
82 * Creates a Poller for POLLIN polling.
83 * @param subPoller true to create a sub-poller
84 */
85 abstract Poller readPoller(boolean subPoller) throws IOException;
86
87 /**
88 * Creates a Poller for POLLOUT polling.
89 * @param subPoller true to create a sub-poller
90 */
91 abstract Poller writePoller(boolean subPoller) throws IOException;
92
93 /**
94 * Returns true if read pollers support read ops in addition to POLLIN polling.
95 * @implSpec The default implementation returns false.
96 */
97 boolean supportReadOps() {
98 return false;
99 }
100
101 /**
102 * Returns true if write pollers support write ops in addition to POLLOUT polling.
103 * @implSpec The default implementation returns false.
104 */
105 boolean supportWriteOps() {
106 return false;
107 }
108 }
|