On Wed, 17 Jun 2026 19:11:33 GMT, Brent Christian <[email protected]> wrote:

>> src/java.smartcardio/share/classes/sun/security/smartcardio/CardImpl.java 
>> line 327:
>> 
>>> 325:             } catch (PCSCException e) {
>>> 326:                 throw new CardException("disconnect() failed", e);
>>> 327:             } finally {
>> 
>> Is it possible to enhance the Context class to handle the flag so we don't 
>> have multiple places calling `SCardDisconnect(...)`?
>
> I myself don't see much benefit to that.
> 
> `disconnect()` would still need to keep its current logic. `SCardDisconnect` 
> still needs to be called in two different circumstances (Cleaner-called 
> `run()`, and user-called `disconnect()`). I'm not sure the advantage of that 
> call coming from a new method in `Context`, vs from `disconnect()` directly.

If `Context` can be set to use a different flag than the hardcoded one, then 
`disconnect()` can be updated to use `Context` instead? This way, the 
disconnection is always done through `cleanable.clean();` call which I find 
easier to maintain/understand.

-------------

PR Review Comment: https://git.openjdk.org/jdk/pull/30683#discussion_r3454232288

Reply via email to