Class TableStatus
java.lang.Object
de.aristaflow.adept2.base.registry.dbconfiguration.TableStatus
The cached existence of the table for a runtime configuration, shared between a
The
The methods of this class must not perform any I/O, so its lock is only ever held briefly.
TableManager and the corresponding DatabaseConfiguration. null means
the existence is unknown, so the next access will check the meta data.The
TableManager creates and drops the table and checks the meta data under its own
lock, so what it learns is the current status by definition and it sets the
status unconditionally. The DatabaseConfiguration only observes: its changes carry
the nano timestamp of the TableStatus.Snapshot the observation started from and will only be applied
if the stamp has not advanced in the meantime. Otherwise the fresher status stands. This way an
observation that started before a change of the table by the manager can never overwrite the
status set for that change.The methods of this class must not perform any I/O, so its lock is only ever held briefly.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final recordA snapshot of the table status. -
Constructor Summary
ConstructorsConstructorDescriptionTableStatus(Boolean exists) Creates a new table status with the designated initial value. -
Method Summary
Modifier and TypeMethodDescriptionvoidset(boolean exists) Sets the designated status unconditionally.Sets the designated status (nullfor unknown) derived from an observation that started at the designated stamp.snapshot()Gets the current status and the stamp of its last change or unconditional set atomically.
-
Constructor Details
-
TableStatus
Creates a new table status with the designated initial value.- Parameters:
exists- Whether the table exists;nullif unknown.
-
-
Method Details
-
snapshot
Gets the current status and the stamp of its last change or unconditional set atomically.- Returns:
- A snapshot of the current status. This will never be
null.
-
set
public void set(boolean exists) Sets the designated status unconditionally. This is for theTableManager, which creates and drops the table itself and checks the meta data under its lock, so what it sets is the current status by definition. The stamp always advances, so observations started before will be rejected byset(Boolean, long).- Parameters:
exists- Whether the table exists.
-
set
Sets the designated status (nullfor unknown) derived from an observation that started at the designated stamp. The status will only be applied if the stamp has not advanced since then; setting the same value again does not advance the stamp.- Parameters:
exists- Whether the table exists;nullif unknown.observedAt- The stamp of the snapshot the observation started from.- Returns:
- The resulting snapshot. Its status is the designated one if this has been applied or
has been set before; otherwise it is the fresher status set in the meantime, which
stands. This will never be
null.
-