Class JvmLocalPreferences
Preferences tree — the JVM-scoped branch
VaadinPreferencesFactory takes when no EmulatorContext
is active on the calling thread (D_prefs_scope_split). It exists because SB-Emulators'
PreferencesFactory SPI is selected JVM-wide, so callers that
have nothing to do with a migrated Swing app — most concretely Vaadin's own
commercial-component license checker
(com.vaadin.pro.licensechecker.History, which reads/writes
Preferences.userNodeForPackage(...) off any UI when an RTE-backed
JEditorPane renders) — also land here. Routing those to the browser's
localStorage is wrong (no UI to reach, and it isn't the user's data),
so they get this instead: a plain heap tree, no browser round-trip, no UI
requirement, never throws.
Ephemeral by design. Nothing persists across JVM restarts. For the
license checker that means its "last check" cache starts cold each boot (it
re-validates rather than throttling — correct, just unthrottled). In-memory is
chosen over delegating to the JDK's file store precisely so a
misclassified app-pref write (migrated code on a raw background thread
that never propagated its EmulatorContext) is lost to a
process-local heap rather than silently persisted to the server's
shared ~/.java/.userPrefs — the wrong machine, and cross-user on a
deployed server. See D_prefs_scope_split.
Thread-safe: AbstractPreferences holds each node's lock across its
*Spi calls, and the per-node maps are ConcurrentHashMap so the
cross-node child registry is safe too.
-
Field Summary
Fields inherited from class AbstractPreferences
lock, newNodeFields inherited from class Preferences
MAX_KEY_LENGTH, MAX_NAME_LENGTH, MAX_VALUE_LENGTH -
Method Summary
Modifier and TypeMethodDescriptionprotected String[]protected AbstractPreferencesprotected voidflushSpi()No backing store to flush to — writes are already in the heap map.protected Stringprotected String[]keysSpi()protected voidprotected voidprotected voidprotected voidsyncSpi()No backing store to reconcile with — the heap map is the whole store.Methods inherited from class AbstractPreferences
absolutePath, addNodeChangeListener, addPreferenceChangeListener, cachedChildren, childrenNames, clear, exportNode, exportSubtree, flush, get, getBoolean, getByteArray, getChild, getDouble, getFloat, getInt, getLong, isRemoved, isUserNode, keys, name, node, nodeExists, parent, put, putBoolean, putByteArray, putDouble, putFloat, putInt, putLong, remove, removeNode, removeNodeChangeListener, removePreferenceChangeListener, sync, toStringMethods inherited from class Preferences
importPreferences, systemNodeForPackage, systemRoot, userNodeForPackage, userRoot
-
Method Details
-
putSpi
- Specified by:
putSpiin classAbstractPreferences
-
getSpi
- Specified by:
getSpiin classAbstractPreferences
-
removeSpi
- Specified by:
removeSpiin classAbstractPreferences
-
removeNodeSpi
protected void removeNodeSpi()- Specified by:
removeNodeSpiin classAbstractPreferences
-
keysSpi
- Specified by:
keysSpiin classAbstractPreferences
-
childrenNamesSpi
- Specified by:
childrenNamesSpiin classAbstractPreferences
-
childSpi
- Specified by:
childSpiin classAbstractPreferences
-
flushSpi
protected void flushSpi()No backing store to flush to — writes are already in the heap map.- Specified by:
flushSpiin classAbstractPreferences
-
syncSpi
protected void syncSpi()No backing store to reconcile with — the heap map is the whole store.- Specified by:
syncSpiin classAbstractPreferences
-