1 /*
2 * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
3 * @LastModified: Nov 2017
4 */
5 /*
6 * Licensed to the Apache Software Foundation (ASF) under one or more
7 * contributor license agreements. See the NOTICE file distributed with
8 * this work for additional information regarding copyright ownership.
9 * The ASF licenses this file to You under the Apache License, Version 2.0
10 * (the "License"); you may not use this file except in compliance with
11 * the License. You may obtain a copy of the License at
12 *
13 * http://www.apache.org/licenses/LICENSE-2.0
14 *
15 * Unless required by applicable law or agreed to in writing, software
16 * distributed under the License is distributed on an "AS IS" BASIS,
17 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18 * See the License for the specific language governing permissions and
19 * limitations under the License.
20 */
21
22 package com.sun.org.apache.xml.internal.dtm.ref;
23
54 import org.xml.sax.SAXNotSupportedException;
55 import org.xml.sax.XMLReader;
56 import org.xml.sax.helpers.DefaultHandler;
57
58 /**
59 * The default implementation for the DTMManager.
60 *
61 * %REVIEW% There is currently a reentrancy issue, since the finalizer
62 * for XRTreeFrag (which runs in the GC thread) wants to call
63 * DTMManager.release(), and may do so at the same time that the main
64 * transformation thread is accessing the manager. Our current solution is
65 * to make most of the manager's methods <code>synchronized</code>.
66 * Early tests suggest that doing so is not causing a significant
67 * performance hit in Xalan. However, it should be noted that there
68 * is a possible alternative solution: rewrite release() so it merely
69 * posts a request for release onto a threadsafe queue, and explicitly
70 * process that queue on an infrequent basis during main-thread
71 * activity (eg, when getDTM() is invoked). The downside of that solution
72 * would be a greater delay before the DTM's storage is actually released
73 * for reuse.
74 * */
75 public class DTMManagerDefault extends DTMManager
76 {
77 //static final boolean JKESS_XNI_EXPERIMENT=true;
78
79 /** Set this to true if you want a dump of the DTM after creation. */
80 private static final boolean DUMPTREE = false;
81
82 /** Set this to true if you want a basic diagnostics. */
83 private static final boolean DEBUG = false;
84
85 /**
86 * Map from DTM identifier numbers to DTM objects that this manager manages.
87 * One DTM may have several prefix numbers, if extended node indexing
88 * is in use; in that case, m_dtm_offsets[] will used to control which
89 * prefix maps to which section of the DTM.
90 *
91 * This array grows as necessary; see addDTM().
92 *
93 * This array grows as necessary; see addDTM(). Growth is uncommon... but
94 * access needs to be blindingly fast since it's used in node addressing.
|
1 /*
2 * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
3 */
4 /*
5 * Licensed to the Apache Software Foundation (ASF) under one or more
6 * contributor license agreements. See the NOTICE file distributed with
7 * this work for additional information regarding copyright ownership.
8 * The ASF licenses this file to You under the Apache License, Version 2.0
9 * (the "License"); you may not use this file except in compliance with
10 * the License. You may obtain a copy of the License at
11 *
12 * http://www.apache.org/licenses/LICENSE-2.0
13 *
14 * Unless required by applicable law or agreed to in writing, software
15 * distributed under the License is distributed on an "AS IS" BASIS,
16 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17 * See the License for the specific language governing permissions and
18 * limitations under the License.
19 */
20
21 package com.sun.org.apache.xml.internal.dtm.ref;
22
53 import org.xml.sax.SAXNotSupportedException;
54 import org.xml.sax.XMLReader;
55 import org.xml.sax.helpers.DefaultHandler;
56
57 /**
58 * The default implementation for the DTMManager.
59 *
60 * %REVIEW% There is currently a reentrancy issue, since the finalizer
61 * for XRTreeFrag (which runs in the GC thread) wants to call
62 * DTMManager.release(), and may do so at the same time that the main
63 * transformation thread is accessing the manager. Our current solution is
64 * to make most of the manager's methods <code>synchronized</code>.
65 * Early tests suggest that doing so is not causing a significant
66 * performance hit in Xalan. However, it should be noted that there
67 * is a possible alternative solution: rewrite release() so it merely
68 * posts a request for release onto a threadsafe queue, and explicitly
69 * process that queue on an infrequent basis during main-thread
70 * activity (eg, when getDTM() is invoked). The downside of that solution
71 * would be a greater delay before the DTM's storage is actually released
72 * for reuse.
73 *
74 * @LastModified: Nov 2017
75 */
76 public class DTMManagerDefault extends DTMManager
77 {
78 //static final boolean JKESS_XNI_EXPERIMENT=true;
79
80 /** Set this to true if you want a dump of the DTM after creation. */
81 private static final boolean DUMPTREE = false;
82
83 /** Set this to true if you want a basic diagnostics. */
84 private static final boolean DEBUG = false;
85
86 /**
87 * Map from DTM identifier numbers to DTM objects that this manager manages.
88 * One DTM may have several prefix numbers, if extended node indexing
89 * is in use; in that case, m_dtm_offsets[] will used to control which
90 * prefix maps to which section of the DTM.
91 *
92 * This array grows as necessary; see addDTM().
93 *
94 * This array grows as necessary; see addDTM(). Growth is uncommon... but
95 * access needs to be blindingly fast since it's used in node addressing.
|