public class DTMManagerDefault extends DTMManager
%REVIEW% There is currently a reentrancy issue, since the finalizer for XRTreeFrag (which runs
in the GC thread) wants to call DTMManager.release(), and may do so at the same time that the
main transformation thread is accessing the manager. Our current solution is to make most of the
manager's methods synchronized. Early tests suggest that doing so is not causing a
significant performance hit in Xalan. However, it should be noted that there is a possible
alternative solution: rewrite release() so it merely posts a request for release onto a
threadsafe queue, and explicitly process that queue on an infrequent basis during main-thread
activity (eg, when getDTM() is invoked). The downside of that solution would be a greater delay
before the DTM's storage is actually released for reuse.
| Modifier and Type | Field and Description |
|---|---|
protected DTM[] |
m_dtms
Map from DTM identifier numbers to DTM objects that this manager manages.
|
IDENT_DTM_DEFAULT, IDENT_DTM_NODE_BITS, IDENT_MAX_DTMS, IDENT_NODE_DEFAULT| Constructor and Description |
|---|
DTMManagerDefault()
Constructor DTMManagerDefault
|
| Modifier and Type | Method and Description |
|---|---|
void |
addDTM(DTM dtm,
int id,
int offset)
Add a DTM to the DTM table.
|
DTM |
getDTM(int nodeHandle)
Get the instance of DTM that "owns" a node handle.
|
DTM |
getDTM(Source source,
boolean unique,
boolean incremental,
boolean doIndexing)
Get an instance of a DTM, loaded with the content from the specified source.
|
int |
getDTMHandleFromNode(Node node)
Given a W3C DOM node, try and return a DTM handle.
|
ExpandedNameTable |
getExpandedNameTable() |
int |
getFirstFreeDTMID() |
newInstanceprotected DTM[] m_dtms
This array grows as necessary; see addDTM().
This array grows as necessary; see addDTM(). Growth is uncommon... but access needs to be blindingly fast since it's used in node addressing.
public void addDTM(DTM dtm, int id, int offset)
dtm - Should be a valid reference to a DTM.id - Integer DTM ID to be bound to this DTM.offset - Integer addressing offset. The internal DTM Node ID is obtained by adding this
offset to the node-number field of the public DTM Handle. For the first DTM ID accessing
each DTM, this is 0; for overflow addressing it will be a multiple of
1<<IDENT_DTM_NODE_BITS.public int getFirstFreeDTMID()
public DTM getDTM(Source source, boolean unique, boolean incremental, boolean doIndexing)
DTMManager(More parameters may eventually need to be added for error handling and entity resolution, and to better control selection of implementations.)
getDTM in class DTMManagersource - the specification of the source object, which may be null, in which case it is
assumed that node construction will take by some other means.unique - true if the returned DTM must be unique, probably because it is going to be
mutated.incremental - true if the DTM should be built incrementally, if possible.doIndexing - true if the caller considers it worth it to use indexing schemes.public int getDTMHandleFromNode(Node node)
getDTMHandleFromNode in class DTMManagernode - Non-null reference to a DOM node.public DTM getDTM(int nodeHandle)
getDTM in class DTMManagernodeHandle - the nodeHandle.public ExpandedNameTable getExpandedNameTable()
NEEDSDOC @param dtm
NEEDSDOC ($objectName$) @return
Copyright © 2022–2024 HtmlUnit. All rights reserved.