APIdia Launch Partner
Top Description Inners Fields Constructors Methods
jdk.internal.foreign

pack-priv sealed Class SharedSession

extends MemorySessionImpl
permits ImplicitSession
Class Inheritance
Known Direct Subclasses
jdk.internal.foreign.ImplicitSession
Imports
jdk.internal.invoke.MhUtil, jdk.internal.misc.ScopedMemoryAccess, jdk.internal.vm.annotation.ForceInline, java.lang.invoke.MethodHandles, .VarHandle

A shared session, which can be shared across multiple threads. Closing a shared session has to ensure that (i) only one thread can successfully close a session (e.g. in a close vs. close race) and that (ii) no other thread is accessing the memory associated with this session while the segment is being closed. To ensure the former condition, a CAS is performed on the liveness bit. Ensuring the latter is trickier, and require a complex synchronization protocol (see jdk.internal.misc.ScopedMemoryAccess). Since it is the responsibility of the closing thread to make sure that no concurrent access is possible, checking the liveness bit upon access can be performed in plain mode, as in the confined case.

Nested and Inner Type Summary

Modifier and TypeClass and Description
pack-priv static class
SharedSession.SharedResourceList

A shared resource list; this implementation has to handle add vs. add races, as well as add vs. cleanup races.

Field Summary

Modifier and TypeField and Description
private static final int
private static final ScopedMemoryAccess
Inherited from jdk.internal.foreign.MemorySessionImpl:
ACQUIRE_COUNTacquireCountALREADY_CLOSEDCLOSEDGLOBAL_SESSIONMAX_FORKSNONCLOSEABLEOPENownerresourceListSTATEstateWRONG_THREAD

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Modifier and TypeMethod and Description
public void
pack-priv void
public void
private IllegalStateException
Inherited from jdk.internal.foreign.MemorySessionImpl:
addCloseActionaddInternaladdOrCleanupIfFailalreadyAcquiredalreadyClosedasArenacheckValidStatecheckValidStatecheckValidStateRawcloneclosecreateConfinedcreateHeapcreateImplicitcreateSharedisAccessibleByisAliveisCloseableisCloseableBynonCloseableownerThreadtoMemorySessiontooManyAcquireswhileAlivewrongThread

Field Detail

CLOSED_ACQUIRE_COUNTback to summary
private static final int CLOSED_ACQUIRE_COUNT
SCOPED_MEMORY_ACCESSback to summary
private static final ScopedMemoryAccess SCOPED_MEMORY_ACCESS

Constructor Detail

SharedSessionback to summary
pack-priv SharedSession()

Method Detail

acquire0back to summary
public void acquire0()

Implements abstract jdk.internal.foreign.MemorySessionImpl.acquire0.

Annotations
@Override
@ForceInline
justCloseback to summary
pack-priv void justClose()

Implements abstract jdk.internal.foreign.MemorySessionImpl.justClose.

release0back to summary
public void release0()

Implements abstract jdk.internal.foreign.MemorySessionImpl.release0.

Annotations
@Override
@ForceInline
sharedSessionAlreadyClosedback to summary
private IllegalStateException sharedSessionAlreadyClosed()
jdk.internal.foreign back to summary

pack-priv Class SharedSession.SharedResourceList

extends ResourceList
Class Inheritance

A shared resource list; this implementation has to handle add vs. add races, as well as add vs. cleanup races.

Field Summary

Modifier and TypeField and Description
pack-priv static final VarHandle
Inherited from jdk.internal.foreign.MemorySessionImpl.ResourceList:
fst

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Modifier and TypeMethod and Description
pack-priv void
pack-priv void
Inherited from jdk.internal.foreign.MemorySessionImpl.ResourceList:
cleanupcleanupcleanupSinglerun

Field Detail

FSTback to summary
pack-priv static final VarHandle FST

Constructor Detail

SharedResourceListback to summary
pack-priv SharedResourceList()

Method Detail

addback to summary
pack-priv void add(MemorySessionImpl.ResourceList.ResourceCleanup cleanup)

Implements abstract jdk.internal.foreign.MemorySessionImpl.ResourceList.add.

Annotations
@Override
cleanupback to summary
pack-priv void cleanup()

Implements abstract jdk.internal.foreign.MemorySessionImpl.ResourceList.cleanup.