# io.github.libtmux.control.EventSubscription.EventSubscription

- **Module:** io.github.libtmux.control.EventSubscription
- **Package:** io.github.libtmux:libtmux
- **Language:** Java
- **Kind:** class
- **Source:** https://github.com/libtmux/libtmux-java/blob/c3517519ee799428a809ce6deb1708c8be289cd1/libtmux/src/main/java/io/github/libtmux/control/EventSubscription.java#L25
- **Page:** https://libtmux.org/reference/java/io-github-libtmux-control-eventsubscription-eventsubscription/

Pulls events volunteered by one control client.

<p>Each subscription owns a fixed-capacity buffer. When that buffer is full, the next event
replaces its oldest event and increments {@link #droppedCount()}; another subscription has its
own buffer and loss count. The control protocol reader only offers values to these buffers. It
never runs subscriber code. Public operations are thread-safe; concurrent readers compete for
the same sequence, and each event is returned at most once.

<p>Closing is terminal: it discards buffered events, wakes threads blocked in {@link #next()},
and makes every later read return empty. Events discarded by close are not overflow and do not
increment the loss count.

## Members

- `EventSubscription` (method)
- `offer` (method)
- `droppedCount` (method) — Returns the exact number of events discarded because this subscription's buffer was full.
- `next` (method) — Waits until the next event arrives or this subscription closes.
- `isClosed` (method) — Whether this subscription has reached its terminal state.
- `close` (method) — Discards buffered events, removes this subscriber, and wakes every waiting reader.
