Problem
The pool currently reads one fixed OAuth2 token from its Jakarta Mail Session and reuses that value when allocating or reconnecting transports. A long-lived pool therefore cannot ask an application for a refreshed access token when the previous token expires.
This is the pool-side part of Simple Java Mail #692, which extends the fixed-token XOAUTH2 support originally introduced in Simple Java Mail #421.
Change
Accept a Supplier<String> through a dedicated Session property and resolve it immediately before every physical Transport.connect(username, token):
- resolve on initial allocation;
- resolve when a disconnected transport is claimed for reuse;
- do not resolve when a connected transport is reused;
- retain the existing fixed-token property as a compatible fallback;
- fail clearly and without exposing token material when the supplier throws or returns a blank value.
The pool remains independent of Simple Java Mail's public provider interface and depends only on the JDK Supplier<String> contract.
Problem
The pool currently reads one fixed OAuth2 token from its Jakarta Mail
Sessionand reuses that value when allocating or reconnecting transports. A long-lived pool therefore cannot ask an application for a refreshed access token when the previous token expires.This is the pool-side part of Simple Java Mail #692, which extends the fixed-token XOAUTH2 support originally introduced in Simple Java Mail #421.
Change
Accept a
Supplier<String>through a dedicated Session property and resolve it immediately before every physicalTransport.connect(username, token):The pool remains independent of Simple Java Mail's public provider interface and depends only on the JDK
Supplier<String>contract.