RFR: 8296024: Usage of DIrectBuffer::address should be guarded [v8]

Maurizio Cimadamore mcimadamore at openjdk.org
Mon Nov 21 17:05:38 UTC 2022


On Mon, 21 Nov 2022 12:50:43 GMT, Per Minborg <pminborg at openjdk.org> wrote:

>> Would it be possible to re-examine acquireSession returning Runnable and 
>> acquireSessionAsAutoCloseable returning AutoCloseable. The naming is bit awkward at most of the use sites and maybe we can do better.
>
> I think it would be confusing to have overloads with the same name. 
> 
> The `aquireSession(Buffer, boolean)` method is only used once and is used in `IOUtil` so we could rename it to `aquireSessionOrNull` and then rename `acquireSessionAsAutoCloseable` to `acquireSession`.

IIRC, Runnable was chosen back then because of the issues with using TWR which was generating warnings (because resource not accessed in body of TWR). I don't have strong opinions on this, other than we should only have one way to do things, rather than 2-3. Since the JDK has capabilities to acquire and release a session w/o a TWR and/or Runnable, one might also consider whether exposing acquire/release separately, and just use those.

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

PR: https://git.openjdk.org/jdk/pull/11260


More information about the security-dev mailing list