Backend API. Server-side code: this runs in a Codename One backend, not in the app on the device.
public final class Reactor
- Object
- Reactor
Readiness notification over epoll (Linux) or kqueue (macOS/BSD).
Level-triggered: the poller hands a ready descriptor to a worker and forgets about it until the worker gives it back. Edge-triggered would require draining every descriptor to EAGAIN on each wake-up, which is the opposite of that.
Fields
public static final int READ = 1 | |
public static final int WRITE = 2 | |
public static final int ONESHOT = 4 | Deliver an event for this descriptor ONCE and then disarm it, until modify re-arms it. |
Methods
Inherited methods
Field details
READ
public static final int READ = 1WRITE
public static final int WRITE = 2ONESHOT
public static final int ONESHOT = 4Deliver an event for this descriptor ONCE and then disarm it, until
modify re-arms it.
This is what lets the worker threads poll the same set directly rather than a reactor thread dispatching to them: the kernel guarantees exactly one waiter is handed a given descriptor, so two workers cannot land on one connection. Without it a level-triggered set reports the same descriptor ready to every waiter at once.
Method details
create
public static Reactor create()
throws IOExceptionThrows
add
public void add(int fd, int events)
throws IOExceptionThrows
modify
public void modify(int fd, int events)
throws IOExceptionThrows
remove
public void remove(int fd)await
public int await(int[] readyFds, int timeoutMillis)
throws IOExceptionThrows
close
public void close()