# io.github.libtmux.scaladsl.streaming.Observation

- **Module:** io.github.libtmux.scaladsl.streaming
- **Package:** io.github.libtmux:libtmux-scala_3
- **Language:** Scala
- **Kind:** class
- **Source:** https://github.com/libtmux/libtmux-java/blob/f56392b5d9bc7f1f9c1631842333fb90f3d82d40/libtmux-scala/src/main/scala/io/github/libtmux/scaladsl/streaming/Observation.scala#L19
- **Page:** https://libtmux.org/en/scala/latest/reference/io-github-libtmux-scaladsl-streaming-observation/

```
final class Observation[T] 
    extends AutoCloseable

object Observation
```

A single-consumer guard over one Java subscription, for direct-style reading.

`EventSubscription` is already single-consumer by construction at the Java
layer — a second concurrent read is refused — but that guard is scoped to
one call; nothing stopped two direct `Iterator`s built from the same
subscription from interleaving reads across calls. This adds the same
scoped-CAS discipline the Cats module's own `Observation` already had, so a
`read` call is the unit of exclusive ownership here too, released when it
returns so a later sequential `read` stays legal.

## Members

### Common operations

- `close` (method)
- `read` (method): Runs `use` over every step waiting or arriving within `pollTimeout` per poll, until the subscription closes. Rejects a second, overlapping `read` on this observation.

### Other members

- `apply` (method)
- `droppedCount` (method): The cumulative overflow count. A [[io.github.libtmux.control.Delivery$Gap Delivery.Gap]] read by [[read]] says where it sits.
