Package org.apache.uima.cas.impl
Class CASImpl.SharedViewData
- java.lang.Object
-
- org.apache.uima.cas.impl.CASImpl.SharedViewData
-
- Enclosing class:
- CASImpl
static class CASImpl.SharedViewData extends java.lang.Object
-
-
Field Summary
Fields Modifier and Type Field Description private CASImpl
baseCAS
private FsGenerator3[]
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.private BinaryCasSerDes
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 outprivate java.lang.String
casId
private java.util.concurrent.atomic.AtomicInteger
casResets
private java.util.EnumSet<CasState>
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.private java.util.Map<java.lang.ClassLoader,JCasHashMap>
cl2id2tramp
private ComponentInfo
componentInfo
private CommonSerDesSequential
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 callprivate java.lang.Thread
current_one_thread_access
(package private) boolean
disableAutoCorruptionCheck
temporarily set to true by deserialization routines doing their own management of this checkprivate BooleanArray
emptyBooleanArray
private ByteArray
emptyByteArray
private DoubleArray
emptyDoubleArray
private FloatArray
emptyFloatArray
private EmptyFloatList
emptyFloatList
private java.util.Map<Type,FSArray>
emptyFSArrayMap
private EmptyFSList
emptyFSList
private IntegerArray
emptyIntegerArray
private EmptyIntegerList
emptyIntegerList
private LongArray
emptyLongArray
private ShortArray
emptyShortArray
private StringArray
emptyStringArray
private EmptyStringList
emptyStringList
private java.util.BitSet
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 indexesprivate boolean
flushEnabled
private int
fsIdGenerator
The fsId of the last created FS used to generate FSIDs, increments by 1 for each use.(package private) java.util.concurrent.atomic.AtomicInteger
fsIdLastValue
used to "capture" the fsIdGenerator value for a read-only CAS to be visible in other threadsprivate java.util.ArrayList<FSsTobeAddedback>
fssTobeAddedback
This stack corresponds to nested protectIndexes contexts.private FSsTobeAddedback.FSsTobeAddedbackSingle
fsTobeAddedbackSingle
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
fsTobeAddedbackSingleInUse
Set to true while this is in use.private FsGenerator3[]
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 classprivate IntVector
id2addr
private JCasHashMap
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 indexesprivate Id2FS
id2fs
map from FS ids to FSs.private JCasHashMap
id2tramp
A map from IDs to already created trampoline FSs for the base FS with that id.private int
initialHeapSize
private boolean
initialSofaCreated
private java.lang.invoke.MethodHandle
is_readable
private java.lang.invoke.MutableCallSite
is_readable_callsite
private java.lang.invoke.MutableCallSite[]
is_readable_callsites
private java.lang.invoke.MethodHandle
is_updatable
private java.lang.invoke.MutableCallSite
is_updatable_callsite
private java.lang.invoke.MutableCallSite[]
is_updatable_callsites
private boolean
isId2Fs
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 java.lang.ClassLoader
jcasClassLoader
private int
lastFsV2Size
The version 2 size on the main heap of the last created FSprivate LongSet
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 initializedprivate StringSet
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 initializedprivate static java.lang.invoke.MethodHandle
mh_return_false
private static java.lang.invoke.MethodHandle
mh_return_true
private java.util.Map<TOP,CASImpl.FsChange>
modifiedPreexistingFSs
Track modified preexistingFSs Note this is a map, keyed by the FS, so all changes are merged when addedprivate int
nextId2Addr
private static java.lang.invoke.MethodType
noArgBoolean
private java.lang.ClassLoader
previousJCasClassLoader
Only support one level of PEAR nesting; for more general approach, make this a dequeprivate int
reuseId
set to > 0 to reuse an id, 0 otherwise(package private) java.util.ArrayList<FSIndexRepositoryImpl>
sofa2indexMap
private java.util.Set<java.lang.String>
sofaNameSet
a set of instantiated sofaNames(package private) java.util.ArrayList<CASImpl>
sofaNbr2ViewMap
A map from Sofa numbers to CAS views.private java.lang.ClassLoader
suspendPreviousJCasClassLoader
Save area for suspending this while we create a base instanceprivate java.util.Deque<CASImpl.SwitchControl>
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 java.lang.StringBuilder
traceCowSb
private java.lang.StringBuilder
traceFScreationSb
private int
traceFSid
private boolean
traceFSisCreate
private MarkerImpl
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).private java.util.List<MarkerImpl>
trackingMarkList
This list currently only contains at most 1 element.private TypeSystemImpl
tsi
(package private) int
viewCount
-
Constructor Summary
Constructors Modifier Constructor Description private
SharedViewData(CASImpl baseCAS, int initialHeapSize, TypeSystemImpl tsi)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description (package private) void
clear()
Called from CasComplete deserialization (reinit).(package private) void
clearCasReset()
private boolean
clearCasState(CasState state)
private void
clearNonSharedInstanceData()
(package private) void
clearSofaInfo()
called by resetNoQuestions and cas complete reinitprivate void
clearTrackingMarks()
private void
flushIndexRepositoriesAllViews()
(package private) CASImpl
getInitialView()
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
lastFsV2IdIncr()
(package private) int
peekNextFsId()
private void
resetNoQuestions(boolean flushIndexRepos)
(package private) void
restoreClassLoader(boolean empty_switchControl, CASImpl.SwitchControl switchControlInstance)
private boolean
setCasState(CasState state, java.lang.Thread thread)
(package private) void
setViewForSofaNbr(int nbr, CASImpl view)
(package private) void
switchClassLoader(java.lang.ClassLoader newClassLoader, boolean wasLocked)
private void
updateCallSite(boolean desired_state, java.lang.invoke.MethodHandle tester, java.lang.invoke.MutableCallSite c, java.lang.invoke.MethodHandle mh, java.lang.invoke.MutableCallSite[] cs)
-
-
-
Field Detail
-
id2fs
private final Id2FS id2fs
map from FS ids to FSs.
-
reuseId
private int reuseId
set to > 0 to reuse an id, 0 otherwise
-
baseCAS
private final CASImpl baseCAS
-
featureCodesInIndexKeys
private final java.util.BitSet 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
java.util.ArrayList<FSIndexRepositoryImpl> sofa2indexMap
-
sofaNbr2ViewMap
java.util.ArrayList<CASImpl> 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
private java.util.Set<java.lang.String> sofaNameSet
a set of instantiated sofaNames
-
initialSofaCreated
private boolean initialSofaCreated
-
viewCount
int viewCount
-
jcasClassLoader
private java.lang.ClassLoader jcasClassLoader
-
previousJCasClassLoader
private java.lang.ClassLoader previousJCasClassLoader
Only support one level of PEAR nesting; for more general approach, make this a deque
-
suspendPreviousJCasClassLoader
private java.lang.ClassLoader suspendPreviousJCasClassLoader
Save area for suspending this while we create a base instance
-
id2tramp
private JCasHashMap 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
private JCasHashMap 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
private final java.util.Map<java.lang.ClassLoader,JCasHashMap> cl2id2tramp
-
generators
private FsGenerator3[] 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
private FsGenerator3[] 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
private TypeSystemImpl tsi
-
componentInfo
private ComponentInfo componentInfo
-
trackingMark
private MarkerImpl 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
private java.util.Map<TOP,CASImpl.FsChange> modifiedPreexistingFSs
Track modified preexistingFSs Note this is a map, keyed by the FS, so all changes are merged when added
-
trackingMarkList
private java.util.List<MarkerImpl> trackingMarkList
This list currently only contains at most 1 element. If Journaling is implemented, it may contain an element per component being journaled.
-
fssTobeAddedback
private final java.util.ArrayList<FSsTobeAddedback> fssTobeAddedback
This stack corresponds to nested protectIndexes contexts. Normally should be very shallow.
-
fsTobeAddedbackSingle
private final FSsTobeAddedback.FSsTobeAddedbackSingle 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 fsTobeAddedbackSingleInUse
Set to true while this is in use.
-
disableAutoCorruptionCheck
boolean disableAutoCorruptionCheck
temporarily set to true by deserialization routines doing their own management of this check
-
fsIdGenerator
private int fsIdGenerator
The fsId of the last created FS used to generate FSIDs, increments by 1 for each use. First id == 1
-
lastFsV2Size
private int lastFsV2Size
The version 2 size on the main heap of the last created FS
-
fsIdLastValue
java.util.concurrent.atomic.AtomicInteger fsIdLastValue
used to "capture" the fsIdGenerator value for a read-only CAS to be visible in other threads
-
casResets
private final java.util.concurrent.atomic.AtomicInteger casResets
-
casId
private final java.lang.String casId
-
emptyFSList
private EmptyFSList emptyFSList
-
emptyFloatList
private EmptyFloatList emptyFloatList
-
emptyIntegerList
private EmptyIntegerList emptyIntegerList
-
emptyStringList
private EmptyStringList emptyStringList
-
emptyFloatArray
private FloatArray emptyFloatArray
-
emptyIntegerArray
private IntegerArray emptyIntegerArray
-
emptyStringArray
private StringArray emptyStringArray
-
emptyDoubleArray
private DoubleArray emptyDoubleArray
-
emptyLongArray
private LongArray emptyLongArray
-
emptyShortArray
private ShortArray emptyShortArray
-
emptyByteArray
private ByteArray emptyByteArray
-
emptyBooleanArray
private BooleanArray emptyBooleanArray
-
bcsd
private final BinaryCasSerDes 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
private CommonSerDesSequential 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
private StringSet 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
private LongSet 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
private final java.lang.StringBuilder traceFScreationSb
-
traceCowSb
private final java.lang.StringBuilder traceCowSb
-
traceFSid
private int traceFSid
-
traceFSisCreate
private boolean traceFSisCreate
-
id2addr
private final IntVector id2addr
-
nextId2Addr
private int nextId2Addr
-
initialHeapSize
private final int initialHeapSize
-
isId2Fs
private boolean isId2Fs
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)
-
switchControl
private final java.util.Deque<CASImpl.SwitchControl> 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
private final java.util.EnumSet<CasState> 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
private static final java.lang.invoke.MethodType noArgBoolean
-
mh_return_false
private static final java.lang.invoke.MethodHandle mh_return_false
-
mh_return_true
private static final java.lang.invoke.MethodHandle mh_return_true
-
is_updatable_callsite
private final java.lang.invoke.MutableCallSite is_updatable_callsite
-
is_readable_callsite
private final java.lang.invoke.MutableCallSite is_readable_callsite
-
is_updatable
private final java.lang.invoke.MethodHandle is_updatable
-
is_readable
private final java.lang.invoke.MethodHandle is_readable
-
is_updatable_callsites
private final java.lang.invoke.MutableCallSite[] is_updatable_callsites
-
is_readable_callsites
private final java.lang.invoke.MutableCallSite[] is_readable_callsites
-
current_one_thread_access
private volatile java.lang.Thread current_one_thread_access
-
-
Constructor Detail
-
SharedViewData
private SharedViewData(CASImpl baseCAS, int initialHeapSize, TypeSystemImpl tsi)
-
-
Method Detail
-
updateCallSite
private void updateCallSite(boolean desired_state, java.lang.invoke.MethodHandle tester, java.lang.invoke.MutableCallSite c, java.lang.invoke.MethodHandle mh, java.lang.invoke.MutableCallSite[] cs)
-
setCasState
private boolean setCasState(CasState state, java.lang.Thread thread)
-
clearCasState
private boolean clearCasState(CasState state)
-
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()
-
clearNonSharedInstanceData
private void clearNonSharedInstanceData()
-
clearTrackingMarks
private void clearTrackingMarks()
-
switchClassLoader
void switchClassLoader(java.lang.ClassLoader newClassLoader, boolean wasLocked)
-
restoreClassLoader
void restoreClassLoader(boolean empty_switchControl, CASImpl.SwitchControl switchControlInstance)
-
getNextFsId
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. (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
private CASImpl getViewFromSofaNbr(int nbr)
-
getInitialView
CASImpl getInitialView()
-
setViewForSofaNbr
void setViewForSofaNbr(int nbr, CASImpl view)
-
-