Skip to content

SnLib v1.24.0

Choose a tag to compare

@ValentinTarnovsky ValentinTarnovsky released this 05 Aug 02:19
· 8 commits to main since this release

A teardown flush that can be bounded.

Bukkit clears the plugin's enabled flag BEFORE onDisable runs, so thenSync's is-enabled guard drops every success continuation from the first line of onInnerDisable onward. Blocking was the only way left to observe a teardown write, and join() had no timeout - a consumer flushing player state had to choose between freezing the server stop on one unreachable database and dropping the write ordering the flush exists for.

  • SnFuture.joinWithin(Duration) - join() under a budget. true = settled in time (the value is then one non-blocking join() away), false = the budget ran out with the work still running (not cancelled), and a throw = it FAILED, with the same CompletionException / CancellationException join() already throws. Same main-thread rules as join(): silent in teardown and bootstrap, warned elsewhere, and a main-completed future still refuses to be waited on from the main thread.
  • DbConfig.connectTimeoutSeconds() / socketTimeoutSeconds() - a budget above the future is only half a bound. SnDb set no Hikari connectionTimeout and left socketTimeout at the driver's unlimited default, so one getConnection() against a black-holed host outlasted any consumer-side timeout. Two optional keys in the same database section, safe defaults, existing configs unchanged:
database:
  connect-timeout-seconds: 10   # default 10, clamp 1..3600 - Hikari connectionTimeout (both backends) + MySQL connectTimeout
  socket-timeout-seconds: 30    # default 30, clamp 0..3600, 0 = unlimited - MySQL socketTimeout

Strictly additive: three new public methods, zero signatures changed, zero behaviour changed on any existing path. japicmp gate passes. SnApi.LEVEL 15 -> 16.