Package org.apache.uima.cas.impl
Class CASImpl.SharedViewData
java.lang.Object
org.apache.uima.cas.impl.CASImpl.SharedViewData
- Enclosing class:
CASImpl
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final CASImpl
private FsGenerator3[]
When generating a new instance of a FS in a PEAR where there's an alternate JCas class impl, generate the base version, and make the alternate a trampoline to it.private final BinaryCasSerDes
Created at startup time, lives as long as the CAS lives Serves to reference code for binary cas ser/des that used to live in this class, but was moved outprivate final String
private final AtomicInteger
C A S S T A T E management * Cas state is implemented in a way to allow the Java to efficiently * access the state test without synchronization or "voliatile" memory accessing, * while at the same time, allowing for an occasional cross-thread memory invalidation * when the state is changed.private final Map
<ClassLoader, JCasHashMap> private ComponentInfo
private CommonSerDesSequential
Created when doing binary or form4 non-delta (de)serialization, used in subsequent delta ser/deserialization Created when doing binary or form4 non-delta ser/deserialization, used in subsequent delta (de)serialization Reset with CasReset or deltaMergesComplete API callprivate Thread
(package private) boolean
temporarily set to true by deserialization routines doing their own management of this checkprivate BooleanArray
private ByteArray
private DoubleArray
private FloatArray
private EmptyFloatList
private EmptyFSList
private IntegerArray
private EmptyIntegerList
private LongArray
private ShortArray
private StringArray
private EmptyStringList
private final BitSet
These fields are here, not in TypeSystemImpl, because different CASes may have different indexes but share the same type system They hold the same data (constant per CAS) but are accessed with different indexesprivate boolean
private int
The fsId of the last created FS used to generate FSIDs, increments by 1 for each use.(package private) AtomicInteger
used to "capture" the fsIdGenerator value for a read-only CAS to be visible in other threadsprivate final ArrayList
<FSsTobeAddedback> This stack corresponds to nested protectIndexes contexts.private final FSsTobeAddedback.FSsTobeAddedbackSingle
This version is for single fs use, by binary deserializers and by automatic mode Only one user at a time is allowed.(package private) boolean
Set to true while this is in use.private FsGenerator3[]
The current (active, switches at Pear boundaries) FsGenerators (excluding array-generators) key = type code read-only, unsynchronized for this CAS Cache for setting this kept in TypeSystemImpl, by classloader - shared among all CASs that use that Type System and class loader -- in turn, initialized from FSClassRegistry, once per classloader / typesystem combo Pear generators are mostly null except for instances where the PEAR has redefined the JCas cover classprivate final IntVector
private JCasHashMap
a map from IDs of FSs that have a Pear version, to the base (non-Pear) version used to locate the base version for adding to indexesprivate final Id2FS
map from FS ids to FSs.private JCasHashMap
A map from IDs to already created trampoline FSs for the base FS with that id.private final int
private boolean
private final MethodHandle
private final MutableCallSite
private final MutableCallSite[]
private final MethodHandle
private final MutableCallSite
private final MutableCallSite[]
private boolean
if true, modify fs creation to save in id2fs map modify deserializers to create fss with ids the same as the serialized form ( or the V2 "address" imputed from that) modify serializers to include reachables only found via id2fs table not static because is updated (see ll_enableV2IdRefs)private ClassLoader
private int
The version 2 size on the main heap of the last created FSprivate LongSet
A LongSet used only to support v2 ll_get/setInt api get adds long to this and returns the int handle set retrieves the long, given the handle lazy initializedprivate StringSet
A StringSet used only to support ll_get/setInt api get adds string to this and returns the int handle set retrieves the string, given the handle lazy initializedprivate static final MethodHandle
private static final MethodHandle
private Map
<TOP, CASImpl.FsChange> Track modified preexistingFSs Note this is a map, keyed by the FS, so all changes are merged when addedprivate int
private static final MethodType
private ClassLoader
Only support one level of PEAR nesting; for more general approach, make this a dequeprivate int
set to > 0 to reuse an id, 0 otherwise(package private) ArrayList
<FSIndexRepositoryImpl> a set of instantiated sofaNamesA map from Sofa numbers to CAS views.private ClassLoader
Save area for suspending this while we create a base instanceprivate final Deque
<CASImpl.SwitchControl> a stack used to remember and restore previous state of cas lock and class loaders when switching classloaders and locking the cas https://issues.apache.org/jira/browse/UIMA-6057private final StringBuilder
private final StringBuilder
private int
private boolean
private MarkerImpl
This tracks the changes for delta cas May also in the future support Journaling by component, allowing determination of which component in a flow created/updated a FeatureStructure (not implmented) TrackingMarkers are held on to by things outside of the Cas, to support switching from one tracking marker to another (currently not used, but designed to support Component Journaling).private List
<MarkerImpl> This list currently only contains at most 1 element.private TypeSystemImpl
(package private) int
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprivate
SharedViewData
(CASImpl baseCAS, int initialHeapSize, TypeSystemImpl tsi) -
Method Summary
Modifier and TypeMethodDescription(package private) void
clear()
Called from CasComplete deserialization (reinit).(package private) void
private boolean
clearCasState
(CasState state) private void
(package private) void
called by resetNoQuestions and cas complete reinitprivate void
private void
(package private) CASImpl
private int
getNextFsId
(TOP fs) The logic for this is: - normal - add 1 to the value of the previous which is kept in fsIdGenerator Update fsIdGenerator to be this id.private CASImpl
getViewFromSofaNbr
(int nbr) (package private) int
(package private) int
private void
resetNoQuestions
(boolean flushIndexRepos) (package private) void
restoreClassLoader
(boolean empty_switchControl, CASImpl.SwitchControl switchControlInstance) private boolean
setCasState
(CasState state, Thread thread) (package private) void
setViewForSofaNbr
(int nbr, CASImpl view) (package private) void
switchClassLoader
(ClassLoader newClassLoader, boolean wasLocked) private void
updateCallSite
(boolean desired_state, MethodHandle tester, MutableCallSite c, MethodHandle mh, MutableCallSite[] cs)
-
Field Details
-
id2fs
map from FS ids to FSs. -
reuseId
private int reuseIdset to > 0 to reuse an id, 0 otherwise -
baseCAS
-
featureCodesInIndexKeys
These fields are here, not in TypeSystemImpl, because different CASes may have different indexes but share the same type system They hold the same data (constant per CAS) but are accessed with different indexes -
sofa2indexMap
ArrayList<FSIndexRepositoryImpl> sofa2indexMap -
sofaNbr2ViewMap
A map from Sofa numbers to CAS views. number 0 - not used number 1 - used for view named "_InitialView" number 2-n used for other views Note: this is not reset with "Cas Reset" because views (really, their associated index repos) take a lot of setup for the indexes. However, the maximum view count is reset; so creation of new views "reuses" these pre-setup indexRepos associated with these views. -
sofaNameSet
a set of instantiated sofaNames -
initialSofaCreated
private boolean initialSofaCreated -
viewCount
int viewCount -
jcasClassLoader
-
previousJCasClassLoader
Only support one level of PEAR nesting; for more general approach, make this a deque -
suspendPreviousJCasClassLoader
Save area for suspending this while we create a base instance -
id2tramp
A map from IDs to already created trampoline FSs for the base FS with that id. These are used when in a Pear and retrieving a FS (via index or deref) and you want the Pear version for that ID. There are potentially multiple maps - one per PEAR Classpath -
id2base
a map from IDs of FSs that have a Pear version, to the base (non-Pear) version used to locate the base version for adding to indexes -
cl2id2tramp
-
generators
The current (active, switches at Pear boundaries) FsGenerators (excluding array-generators) key = type code read-only, unsynchronized for this CAS Cache for setting this kept in TypeSystemImpl, by classloader - shared among all CASs that use that Type System and class loader -- in turn, initialized from FSClassRegistry, once per classloader / typesystem combo Pear generators are mostly null except for instances where the PEAR has redefined the JCas cover class -
baseGenerators
When generating a new instance of a FS in a PEAR where there's an alternate JCas class impl, generate the base version, and make the alternate a trampoline to it. Note: in future, if it is known that this FS is never used outside of this PEAR, then can skip generating the double version -
flushEnabled
private boolean flushEnabled -
tsi
-
componentInfo
-
trackingMark
This tracks the changes for delta cas May also in the future support Journaling by component, allowing determination of which component in a flow created/updated a FeatureStructure (not implmented) TrackingMarkers are held on to by things outside of the Cas, to support switching from one tracking marker to another (currently not used, but designed to support Component Journaling). We track changes on a granularity of features and for features which are arrays, which element of the array (This last to enable efficient delta serializations of giant arrays of things, where you've only updated a few items) The FsChange doesn't store the changed data, only stores the ref info needed to get to what was changed. -
modifiedPreexistingFSs
Track modified preexistingFSs Note this is a map, keyed by the FS, so all changes are merged when added -
trackingMarkList
This list currently only contains at most 1 element. If Journaling is implemented, it may contain an element per component being journaled. -
fssTobeAddedback
This stack corresponds to nested protectIndexes contexts. Normally should be very shallow. -
fsTobeAddedbackSingle
This version is for single fs use, by binary deserializers and by automatic mode Only one user at a time is allowed. -
fsTobeAddedbackSingleInUse
boolean fsTobeAddedbackSingleInUseSet to true while this is in use. -
disableAutoCorruptionCheck
boolean disableAutoCorruptionChecktemporarily set to true by deserialization routines doing their own management of this check -
fsIdGenerator
private int fsIdGeneratorThe fsId of the last created FS used to generate FSIDs, increments by 1 for each use. First id == 1 -
lastFsV2Size
private int lastFsV2SizeThe version 2 size on the main heap of the last created FS -
fsIdLastValue
AtomicInteger fsIdLastValueused to "capture" the fsIdGenerator value for a read-only CAS to be visible in other threads -
casResets
-
casId
-
emptyFSList
-
emptyFloatList
-
emptyIntegerList
-
emptyStringList
-
emptyFloatArray
-
emptyFSArrayMap
-
emptyIntegerArray
-
emptyStringArray
-
emptyDoubleArray
-
emptyLongArray
-
emptyShortArray
-
emptyByteArray
-
emptyBooleanArray
-
bcsd
Created at startup time, lives as long as the CAS lives Serves to reference code for binary cas ser/des that used to live in this class, but was moved out -
csds
Created when doing binary or form4 non-delta (de)serialization, used in subsequent delta ser/deserialization Created when doing binary or form4 non-delta ser/deserialization, used in subsequent delta (de)serialization Reset with CasReset or deltaMergesComplete API call -
llstringSet
A StringSet used only to support ll_get/setInt api get adds string to this and returns the int handle set retrieves the string, given the handle lazy initialized -
lllongSet
A LongSet used only to support v2 ll_get/setInt api get adds long to this and returns the int handle set retrieves the long, given the handle lazy initialized -
traceFScreationSb
-
traceCowSb
-
traceFSid
private int traceFSid -
traceFSisCreate
private boolean traceFSisCreate -
id2addr
-
nextId2Addr
private int nextId2Addr -
initialHeapSize
private final int initialHeapSize -
isId2Fs
private boolean isId2Fsif true, modify fs creation to save in id2fs map modify deserializers to create fss with ids the same as the serialized form ( or the V2 "address" imputed from that) modify serializers to include reachables only found via id2fs table not static because is updated (see ll_enableV2IdRefs) -
switchControl
a stack used to remember and restore previous state of cas lock and class loaders when switching classloaders and locking the cas https://issues.apache.org/jira/browse/UIMA-6057 -
casState
C A S S T A T E management * Cas state is implemented in a way to allow the Java to efficiently * access the state test without synchronization or "voliatile" memory accessing, * while at the same time, allowing for an occasional cross-thread memory invalidation * when the state is changed. This is done using a MutableCallSite plus that * objects "syncAll" method. * -
noArgBoolean
-
mh_return_false
-
mh_return_true
-
is_updatable_callsite
-
is_readable_callsite
-
is_updatable
-
is_readable
-
is_updatable_callsites
-
is_readable_callsites
-
current_one_thread_access
-
-
Constructor Details
-
SharedViewData
-
-
Method Details
-
updateCallSite
private void updateCallSite(boolean desired_state, MethodHandle tester, MutableCallSite c, MethodHandle mh, MutableCallSite[] cs) -
setCasState
-
clearCasState
-
clearCasReset
void clearCasReset() -
clearSofaInfo
void clearSofaInfo()called by resetNoQuestions and cas complete reinit -
clear
void clear()Called from CasComplete deserialization (reinit). Skips the resetNoQuestions operation of flushing the indexes, since these will be reinitialized with potentially new definitions. Clears additional data related to having the - type system potentially change - the features belonging to indexes change -
resetNoQuestions
private void resetNoQuestions(boolean flushIndexRepos) -
flushIndexRepositoriesAllViews
private void flushIndexRepositoriesAllViews() -
clearTrackingMarks
private void clearTrackingMarks() -
switchClassLoader
-
restoreClassLoader
-
getNextFsId
The logic for this is: - normal - add 1 to the value of the previous which is kept in fsIdGenerator Update fsIdGenerator to be this id. (maybe) set lastFsV2Size to the size of this FS in v2 - pear trampolines: use the exact same id as the main fs. This value is in reuseId. In this case, no computation of "next" is done - isId2Fs This is set if in special mode to emulate v2 addresses. - used for backwards compatibility when LowLevelCas getFSForRef calls in use - used for debugging v2 vs v3 runs - causes fsId to be set to a value which should match the v2 address Side effect: when doing v2 emulation, updates the lastFsV2Size- Parameters:
fs
- - the fs, used to compute its "size" on the v2 heap when emulating v2 addresses- Returns:
- the id to use
-
peekNextFsId
int peekNextFsId()- Returns:
- the lastUsedFsId + the size of that or 1
-
lastFsV2IdIncr
int lastFsV2IdIncr() -
getViewFromSofaNbr
-
getInitialView
CASImpl getInitialView() -
setViewForSofaNbr
-