MemorySessionImpl#close()). This bit is consulted prior
to memory access (see checkValidStateRaw()).
There are two kinds of memory session: confined memory session and shared memory session.
A confined memory session has an associated owner thread that confines some operations to
associated owner thread such as close() or checkValidStateRaw().
Shared sessions do not feature an owner thread - meaning their operations can be called, in a racy
manner, by multiple threads. To guarantee temporal safety in the presence of concurrent thread,
shared sessions use a more sophisticated synchronization mechanism, which guarantees that no concurrent
access is possible when a session is being closed (see jdk.internal.misc.ScopedMemoryAccess ).
| Modifier and Type | Class and Description |
|---|---|
| public abstract static class | MemorySessionImpl.
A list of all cleanup actions associated with a memory session. |
| Modifier and Type | Field and Description |
|---|---|
| pack-priv static final VarHandle | |
| pack-priv int | |
| pack-priv static final ScopedMemoryAccess. | |
| pack-priv static final int | |
| public static final MemorySessionImpl | |
| pack-priv static final int | |
| pack-priv static final int | |
| pack-priv static final int | OPEN
The value of the |
| pack-priv final Thread | |
| pack-priv final MemorySessionImpl. | |
| pack-priv static final VarHandle | |
| pack-priv int | |
| pack-priv static final ScopedMemoryAccess. |
| Access | Constructor and Description |
|---|---|
| protected |
| Modifier and Type | Method and Description |
|---|---|
| public abstract void | |
| public void | |
| pack-priv void | |
| public void | |
| pack-priv static IllegalStateException | |
| pack-priv static IllegalStateException | |
| public ArenaImpl | |
| public void | |
| public static void | |
| public void | checkValidStateRaw()
This is a faster version of |
| protected Object | |
| public void | |
| public static MemorySessionImpl | |
| public static MemorySessionImpl | |
| public static MemorySessionImpl | |
| public static MemorySessionImpl | |
| public final boolean | |
| public boolean | Returns: true if this session is not closed yet.Implements java. Returns true, if this session is still open. |
| public final boolean | |
| public final boolean | |
| pack-priv abstract void | |
| pack-priv static UnsupportedOperationException | |
| public final Thread | |
| public abstract void | |
| public static MemorySessionImpl | |
| pack-priv static IllegalStateException | |
| public void | |
| pack-priv static WrongThreadException |
| ACQUIRE_COUNT | back to summary |
|---|---|
| pack-priv static final VarHandle ACQUIRE_COUNT | |
| acquireCount | back to summary |
|---|---|
| pack-priv int acquireCount | |
| ALREADY_CLOSED | back to summary |
|---|---|
| pack-priv static final ScopedMemoryAccess. | |
| CLOSED | back to summary |
|---|---|
| pack-priv static final int CLOSED | |
| GLOBAL_SESSION | back to summary |
|---|---|
| public static final MemorySessionImpl GLOBAL_SESSION | |
| MAX_FORKS | back to summary |
|---|---|
| pack-priv static final int MAX_FORKS | |
| NONCLOSEABLE | back to summary |
|---|---|
| pack-priv static final int NONCLOSEABLE | |
| OPEN | back to summary |
|---|---|
| pack-priv static final int OPEN The value of the | |
| owner | back to summary |
|---|---|
| pack-priv final Thread owner | |
| resourceList | back to summary |
|---|---|
| pack-priv final MemorySessionImpl. | |
| STATE | back to summary |
|---|---|
| pack-priv static final VarHandle STATE | |
| state | back to summary |
|---|---|
| pack-priv int state
| |
| WRONG_THREAD | back to summary |
|---|---|
| pack-priv static final ScopedMemoryAccess. | |
| MemorySessionImpl | back to summary |
|---|---|
| protected MemorySessionImpl(Thread owner, MemorySessionImpl. | |
| acquire0 | back to summary |
|---|---|
| public abstract void acquire0() | |
| addCloseAction | back to summary |
|---|---|
| public void addCloseAction(Runnable runnable) | |
| addInternal | back to summary |
|---|---|
| pack-priv void addInternal(MemorySessionImpl. | |
| addOrCleanupIfFail | back to summary |
|---|---|
| public void addOrCleanupIfFail(MemorySessionImpl. Add a cleanup action. If a failure occurred (because of an add vs. close race), call the cleanup action. This semantics is useful when allocating new memory segments, since we first do a malloc/mmap and _then_ we register the cleanup (free/munmap) against the session; so, if registration fails, we still have to clean up memory. From the perspective of the client, such a failure would manifest as a factory returning a segment that is already "closed" - which is always possible anyway (e.g. if the session is closed _after_ the cleanup for the segment is registered but _before_ the factory returns the new segment to the client). For this reason, it's not worth adding extra complexity to the segment initialization logic here - and using an optimistic logic works well in practice. | |
| alreadyAcquired | back to summary |
|---|---|
| pack-priv static IllegalStateException alreadyAcquired(int acquires) | |
| alreadyClosed | back to summary |
|---|---|
| pack-priv static IllegalStateException alreadyClosed() | |
| asArena | back to summary |
|---|---|
| public ArenaImpl asArena() | |
| checkValidState | back to summary |
|---|---|
| public void checkValidState() Checks that this session is still alive (see
| |
| checkValidState | back to summary |
|---|---|
| public static void checkValidState(MemorySegment segment) | |
| checkValidStateRaw | back to summary |
|---|---|
| public void checkValidStateRaw() This is a faster version of
| |
| clone | back to summary |
|---|---|
| protected Object clone() throws CloneNotSupportedException Overrides java. Doc from java. Creates and returns a copy of this object. The precise meaning
of "copy" may depend on the class of the object. The general
intent is that, for any object will be true, and that the expression:x.clone() != x will bex.clone().getClass() == x.getClass() true, but these are not absolute requirements.
While it is typically the case that:
will bex.clone().equals(x) true, this is not an absolute requirement.
By convention, the returned object should be obtained by calling
By convention, the object returned by this method should be independent
of this object (which is being cloned). To achieve this independence,
it may be necessary to modify one or more fields of the object returned
by
| |
| close | back to summary |
|---|---|
| public void close() Closes this session, executing any cleanup action (where provided).
| |
| createConfined | back to summary |
|---|---|
| public static MemorySessionImpl createConfined(Thread thread) | |
| createHeap | back to summary |
|---|---|
| public static MemorySessionImpl createHeap(Object ref) | |
| createImplicit | back to summary |
|---|---|
| public static MemorySessionImpl createImplicit(Cleaner cleaner) | |
| createShared | back to summary |
|---|---|
| public static MemorySessionImpl createShared() | |
| isAccessibleBy | back to summary |
|---|---|
| public final boolean isAccessibleBy(Thread thread) | |
| isAlive | back to summary |
|---|---|
| public boolean isAlive() Implements java. Returns true, if this session is still open. This method may be called in any thread.
| |
| isCloseable | back to summary |
|---|---|
| public final boolean isCloseable() | |
| isCloseableBy | back to summary |
|---|---|
| public final boolean isCloseableBy(Thread thread) | |
| justClose | back to summary |
|---|---|
| pack-priv abstract void justClose() | |
| nonCloseable | back to summary |
|---|---|
| pack-priv static UnsupportedOperationException nonCloseable() | |
| ownerThread | back to summary |
|---|---|
| public final Thread ownerThread() | |
| release0 | back to summary |
|---|---|
| public abstract void release0() | |
| toMemorySession | back to summary |
|---|---|
public static MemorySessionImpl toMemorySession(Arena arena)
| |
| tooManyAcquires | back to summary |
|---|---|
| pack-priv static IllegalStateException tooManyAcquires() | |
| whileAlive | back to summary |
|---|---|
| public void whileAlive(Runnable action) | |
| wrongThread | back to summary |
|---|---|
| pack-priv static WrongThreadException wrongThread() | |
ResourceCleanup class, and, together, form a linked list. Depending on whether a session
is shared or confined, different implementations of this class will be used, see ConfinedSession.ConfinedResourceList
and SharedSession.SharedResourceList .
| Modifier and Type | Class and Description |
|---|---|
| public abstract static class |
| Modifier and Type | Field and Description |
|---|---|
| pack-priv MemorySessionImpl. |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| pack-priv abstract void | |
| pack-priv abstract void | |
| pack-priv static void | |
| pack-priv static void | |
| pack-priv static RuntimeException | cleanupSingle(MemorySessionImpl.
|
| public final void |
| fst | back to summary |
|---|---|
| pack-priv MemorySessionImpl. | |
| ResourceList | back to summary |
|---|---|
| public ResourceList() | |
| add | back to summary |
|---|---|
| pack-priv abstract void add(MemorySessionImpl. | |
| cleanup | back to summary |
|---|---|
| pack-priv abstract void cleanup() | |
| cleanup | back to summary |
|---|---|
| pack-priv static void cleanup(MemorySessionImpl. | |
| cleanup | back to summary |
|---|---|
| pack-priv static void cleanup(MemorySessionImpl. | |
| cleanupSingle | back to summary |
|---|---|
| pack-priv static RuntimeException cleanupSingle(MemorySessionImpl. | |
| run | back to summary |
|---|---|
| public final void run() Implements java. Doc from java. Runs this operation. | |
| Modifier and Type | Field and Description |
|---|---|
| pack-priv static final MemorySessionImpl. | |
| pack-priv MemorySessionImpl. |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| public abstract void | |
| pack-priv static MemorySessionImpl. |
| CLOSED_LIST | back to summary |
|---|---|
| pack-priv static final MemorySessionImpl. | |
| next | back to summary |
|---|---|
| pack-priv MemorySessionImpl. | |
| ResourceCleanup | back to summary |
|---|---|
| public ResourceCleanup() | |
| cleanup | back to summary |
|---|---|
| public abstract void cleanup() | |
| ofRunnable | back to summary |
|---|---|
| pack-priv static MemorySessionImpl. | |