diff --git a/libtmux-kotlin/src/main/kotlin/io/github/libtmux/kotlin/Server.kt b/libtmux-kotlin/src/main/kotlin/io/github/libtmux/kotlin/Server.kt index 7b62e5ed..e2135eba 100644 --- a/libtmux-kotlin/src/main/kotlin/io/github/libtmux/kotlin/Server.kt +++ b/libtmux-kotlin/src/main/kotlin/io/github/libtmux/kotlin/Server.kt @@ -16,14 +16,18 @@ import io.github.libtmux.Session as JavaSession import io.github.libtmux.Window as JavaWindow /** - * One tmux server, reached over one transport. + * Manages sessions, windows, and panes on a tmux server. * - * Holds the Java handle privately: this is a wrapper, not [JavaServer] itself, so a member here - * always wins over a same-named catalog-generated extension (see `ServerOperations.kt`) and a query - * field lives on [Companion] rather than colliding with an instance member. + * Use [open] with a [ServerConfig] to select a server by socket name or path. From this object, + * create sessions or query the server's existing sessions, windows, and panes. Each [Session] + * contains windows, and each [Window] contains panes. * - * Every operation that may contact tmux is `suspend`, dispatched through [policy]. Close it once, - * after the last call on any thread — the same threading contract [JavaServer] documents. + * Operations that contact tmux are `suspend` functions dispatched through [policy]. Call [close] + * after the last operation to release resources owned by this object. The tmux server and its + * sessions keep running. + * + * [asJava] exposes the underlying [JavaServer] for interoperability. Both objects share the same + * resources, so closing either closes both. */ public class Server private constructor( internal val java: JavaServer, diff --git a/libtmux/src/main/java/io/github/libtmux/Server.java b/libtmux/src/main/java/io/github/libtmux/Server.java index 0eb32d24..cfe53f25 100644 --- a/libtmux/src/main/java/io/github/libtmux/Server.java +++ b/libtmux/src/main/java/io/github/libtmux/Server.java @@ -45,14 +45,18 @@ import org.jspecify.annotations.Nullable; /** - * One tmux server, reached over one transport. + * Manages sessions, windows, and panes on a tmux server. + * + *
Use {@link #open} with a {@link ServerConfig} to select a server by socket name or path. + * From this object, create sessions or query the server's existing sessions, windows, and panes. + * Each {@link Session} contains windows, and each {@link Window} contains panes. * *
Ownership is decided at construction and never inferred. {@link #open} creates a transport this * server closes exactly once; {@link #using} borrows one the caller keeps, so several servers can * share a transport and closing one leaves the others working. * - *
Closing a server closes a client, not a tmux. It never kills the server process: sessions - * outlive the program that made them, which is the entire point of tmux. + *
Closing this object releases its owned transport. The tmux server and its sessions keep + * running. Call {@link #killServer()} to stop the tmux server. * *
Close it anyway. A server that owns its transport holds the threads that drain tmux's output, * and those are not daemons, so that a reply being read when a program ends is finished rather than