Message-ID: From: "davecramer (@davecramer)" To: "pgjdbc/pgjdbc" Date: Fri, 15 May 2026 11:18:51 +0000 Subject: [pgjdbc/pgjdbc] PR #4073: Nio selector List-Id: X-GitHub-Author-Id: 406518 X-GitHub-Author-Login: davecramer X-GitHub-Issue: 4073 X-GitHub-Repo: pgjdbc/pgjdbc X-GitHub-State: closed X-GitHub-Type: pull_request X-GitHub-Url: https://github.com/pgjdbc/pgjdbc/pull/4073 Content-Type: text/plain; charset=utf-8 Create connections using SocketChannel.open() instead of plain Socket when the default socket factory is used. This provides a Selector that can check socket readability without consuming data — enabling safe background notification polling in a future commit. - SocketChannel created in createSocket(), kept in blocking mode for normal I/O compatibility - Selector opened alongside the channel - isDataAvailable(timeoutMillis) uses selector.select() to check for incoming data without reading bytes — safe for background threads - hasSelector() indicates NIO availability - changeSocket() (SSL upgrade) invalidates channel/selector since SSL wraps the socket with a different stream - Selector closed in PGStream.close() Non-SSL connections get full Selector support. SSL connections fall back to the existing hasMessagePending() polling approach."