santiagopg 2002/07/23 14:09:19
Modified: java/src/org/apache/xalan/xsltc/trax TemplatesImpl.java
Log:
Ensure synchronization for Templates objects.
Revision Changes Path
1.20 +28 -27
xml-xalan/java/src/org/apache/xalan/xsltc/trax/TemplatesImpl.java
Index: TemplatesImpl.java
===================================================================
RCS file:
/home/cvs/xml-xalan/java/src/org/apache/xalan/xsltc/trax/TemplatesImpl.java,v
retrieving revision 1.19
retrieving revision 1.20
diff -u -r1.19 -r1.20
--- TemplatesImpl.java 23 Jul 2002 16:33:41 -0000 1.19
+++ TemplatesImpl.java 23 Jul 2002 21:09:19 -0000 1.20
@@ -131,32 +131,17 @@
// Temporary
private boolean _oldOutputSystem;
- // Our own private class loader - builds Class definitions from bytecodes
private class TransletClassLoader extends ClassLoader {
protected TransletClassLoader(ClassLoader parent){
super(parent);
}
-
public Class defineClass(byte[] b) {
return super.defineClass(null, b, 0, b.length);
}
}
- public void writeExternal(ObjectOutput out) throws IOException {
- out.writeObject(_name);
- out.writeObject(_bytecodes);
- out.flush();
- }
-
- public void readExternal(ObjectInput in)
- throws IOException, ClassNotFoundException {
- _name = (String)in.readObject();
- _bytecodes = (byte[][])in.readObject();
- _class = null; // must be created again...
- }
-
- /**
+ /**
* The only way to create an XSLTC emplate object
* The bytecodes for the translet and auxiliary classes, plus the name of
* the main translet class, must be supplied
@@ -172,10 +157,26 @@
_oldOutputSystem = oldOutputSystem;
}
- /**
+ public synchronized void writeExternal(ObjectOutput out)
+ throws IOException
+ {
+ out.writeObject(_name);
+ out.writeObject(_bytecodes);
+ out.flush();
+ }
+
+ public synchronized void readExternal(ObjectInput in)
+ throws IOException, ClassNotFoundException
+ {
+ _name = (String)in.readObject();
+ _bytecodes = (byte[][])in.readObject();
+ _class = null; // must be created again...
+ }
+
+ /**
* Store URIResolver needed for Transformers.
*/
- public void setURIResolver(URIResolver resolver) {
+ public synchronized void setURIResolver(URIResolver resolver) {
_uriResolver = resolver;
}
@@ -183,21 +184,21 @@
* The TransformerFactory must pass us the translet bytecodes using this
* method before we can create any translet instances
*/
- protected void setTransletBytecodes(byte[][] bytecodes) {
+ protected synchronized void setTransletBytecodes(byte[][] bytecodes) {
_bytecodes = bytecodes;
}
/**
* Returns the translet bytecodes stored in this template
*/
- public byte[][] getTransletBytecodes() {
+ public synchronized byte[][] getTransletBytecodes() {
return _bytecodes;
}
/**
* Returns the translet bytecodes stored in this template
*/
- public Class[] getTransletClasses() {
+ public synchronized Class[] getTransletClasses() {
try {
if (_class == null) defineTransletClasses();
}
@@ -210,7 +211,7 @@
/**
* Returns the index of the main class in array of bytecodes
*/
- public int getTransletIndex() {
+ public synchronized int getTransletIndex() {
try {
if (_class == null) defineTransletClasses();
}
@@ -223,14 +224,14 @@
/**
* The TransformerFactory should call this method to set the translet
name
*/
- protected void setTransletName(String name) {
+ protected synchronized void setTransletName(String name) {
_name = name;
}
/**
* Returns the name of the main translet class stored in this template
*/
- protected String getTransletName() {
+ protected synchronized String getTransletName() {
return _name;
}
@@ -328,7 +329,7 @@
*
* @throws TransformerConfigurationException
*/
- public Transformer newTransformer()
+ public synchronized Transformer newTransformer()
throws TransformerConfigurationException
{
final TransformerImpl transformer =
@@ -346,7 +347,7 @@
* we might as well just instanciate a Transformer and use its
* implementation of this method.
*/
- public Properties getOutputProperties() {
+ public synchronized Properties getOutputProperties() {
try {
return newTransformer().getOutputProperties();
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]