[teiid-commits] teiid SVN: r3717 - trunk/cache-jbosscache/src/main/java/org/teiid/replication/jboss.

teiid-commits at lists.jboss.org teiid-commits at lists.jboss.org
Mon Dec 5 11:29:37 EST 2011


Author: shawkins
Date: 2011-12-05 11:29:37 -0500 (Mon, 05 Dec 2011)
New Revision: 3717

Modified:
   trunk/cache-jbosscache/src/main/java/org/teiid/replication/jboss/JGroupsObjectReplicator.java
Log:
TEIID-1720 reusing existing class

Modified: trunk/cache-jbosscache/src/main/java/org/teiid/replication/jboss/JGroupsObjectReplicator.java
===================================================================
--- trunk/cache-jbosscache/src/main/java/org/teiid/replication/jboss/JGroupsObjectReplicator.java	2011-12-02 11:42:20 UTC (rev 3716)
+++ trunk/cache-jbosscache/src/main/java/org/teiid/replication/jboss/JGroupsObjectReplicator.java	2011-12-05 16:29:37 UTC (rev 3717)
@@ -25,10 +25,8 @@
 import java.io.ByteArrayInputStream;
 import java.io.ByteArrayOutputStream;
 import java.io.IOException;
-import java.io.InputStream;
 import java.io.ObjectInputStream;
 import java.io.ObjectOutputStream;
-import java.io.ObjectStreamClass;
 import java.io.Serializable;
 import java.lang.reflect.InvocationHandler;
 import java.lang.reflect.InvocationTargetException;
@@ -66,6 +64,7 @@
 import org.teiid.Replicated;
 import org.teiid.Replicated.ReplicationMode;
 import org.teiid.core.TeiidRuntimeException;
+import org.teiid.core.util.ObjectInputStreamWithClassloader;
 import org.teiid.logging.LogConstants;
 import org.teiid.logging.LogManager;
 import org.teiid.query.ObjectReplicator;
@@ -600,26 +599,11 @@
 
 		@Override
 		public Object objectFromBuffer(byte[] buf, int offset, int length) throws Exception {
-			ObjectInputStream in = new CLAwareObjectInputStream(new ByteArrayInputStream(buf, offset, length), this.classloader);
+			ObjectInputStream in = new ObjectInputStreamWithClassloader(new ByteArrayInputStream(buf, offset, length), this.classloader);
 			Object anObj = in.readObject();
 			in.close();
 			return anObj;
 		}
 	}
 	
-	static class CLAwareObjectInputStream extends ObjectInputStream {
-		private ClassLoader classloader;
-		@Override
-		public Class resolveClass(ObjectStreamClass desc) throws IOException, ClassNotFoundException {
-			try {
-				return this.classloader.loadClass(desc.getName());
-			} catch (Throwable t) {
-			}
-			return super.resolveClass(desc);
-		}
-		public CLAwareObjectInputStream(InputStream in, ClassLoader classloader) throws IOException {
-			super(in);
-			this.classloader = classloader;
-		}
-	}	
 }



More information about the teiid-commits mailing list