[jboss-cvs] JBossCache/src/org/jboss/cache/loader ...
Manik Surtani
msurtani at jboss.com
Mon Jan 15 13:10:55 EST 2007
User: msurtani
Date: 07/01/15 13:10:55
Modified: src/org/jboss/cache/loader JDBCCacheLoader.java
AbstractCacheLoader.java
Log:
Made marshallers pluggable (JBCACHE-870)
Revision Changes Path
1.28 +17 -20 JBossCache/src/org/jboss/cache/loader/JDBCCacheLoader.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: JDBCCacheLoader.java
===================================================================
RCS file: /cvsroot/jboss/JBossCache/src/org/jboss/cache/loader/JDBCCacheLoader.java,v
retrieving revision 1.27
retrieving revision 1.28
diff -u -b -r1.27 -r1.28
--- JDBCCacheLoader.java 12 Jan 2007 17:02:02 -0000 1.27
+++ JDBCCacheLoader.java 15 Jan 2007 18:10:55 -0000 1.28
@@ -16,11 +16,8 @@
import javax.naming.NamingException;
import javax.sql.DataSource;
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.sql.Connection;
import java.sql.DatabaseMetaData;
import java.sql.DriverManager;
@@ -80,7 +77,7 @@
* @author <a href="mailto:alex at jboss.org">Alexey Loubyansky</a>
* @author <a href="mailto:hmesha at novell.com">Hany Mesha </a>
* @author <a href="mailto:galder.zamarreno at jboss.com">Galder Zamarreno</a>
- * @version <tt>$Revision: 1.27 $</tt>
+ * @version <tt>$Revision: 1.28 $</tt>
*/
public class JDBCCacheLoader extends AbstractCacheLoader
{
@@ -677,9 +674,9 @@
if (node != null)
{
-// ByteArrayOutputStream baos = new ByteArrayOutputStream();
-// ObjectOutputStream oos = new ObjectOutputStream(baos);
-// oos.writeObject(node);
+ // ByteArrayOutputStream baos = new ByteArrayOutputStream();
+ // ObjectOutputStream oos = new ObjectOutputStream(baos);
+ // oos.writeObject(node);
byte[] byteStream = getMarshaller().objectToByteBuffer(node);
ByteArrayInputStream bais = new ByteArrayInputStream(byteStream);
@@ -759,9 +756,9 @@
node = new HashMap(0);
}
-// ByteArrayOutputStream baos = new ByteArrayOutputStream();
-// ObjectOutputStream oos = new ObjectOutputStream(baos);
-// oos.writeObject(node);
+ // ByteArrayOutputStream baos = new ByteArrayOutputStream();
+ // ObjectOutputStream oos = new ObjectOutputStream(baos);
+ // oos.writeObject(node);
byte[] byteStream = getMarshaller().objectToByteBuffer(node);
ByteArrayInputStream bais = new ByteArrayInputStream(byteStream);
@@ -770,10 +767,10 @@
ps.setString(2, name.toString());
int rows = ps.executeUpdate();
-// if (rows != 1)
-// {
-// throw new IllegalStateException("Expected one updated row but got " + rows);
-// }
+ // if (rows != 1)
+ // {
+ // throw new IllegalStateException("Expected one updated row but got " + rows);
+ // }
}
catch (Exception e)
{
@@ -823,12 +820,12 @@
{
try
{
-// ObjectInputStream ois = null;
-// ois = new ObjectInputStream(is);
-// Object marshalledNode = ois.readObject();
+ // ObjectInputStream ois = null;
+ // ois = new ObjectInputStream(is);
+ // Object marshalledNode = ois.readObject();
// deserialize result
- Object marshalledNode = getMarshaller().objectFromInputStream(is);
+ Object marshalledNode = getMarshaller().objectFromStream(is);
oldNode = (Map) marshalledNode;
}
catch (Exception e)
@@ -1139,7 +1136,7 @@
try
{
con = DriverManager.getConnection(url, usr, pwd);
-// connection.set(con);
+ // connection.set(con);
}
catch (SQLException e)
{
1.18 +2 -2 JBossCache/src/org/jboss/cache/loader/AbstractCacheLoader.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: AbstractCacheLoader.java
===================================================================
RCS file: /cvsroot/jboss/JBossCache/src/org/jboss/cache/loader/AbstractCacheLoader.java,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -b -r1.17 -r1.18
--- AbstractCacheLoader.java 15 Jan 2007 16:19:10 -0000 1.17
+++ AbstractCacheLoader.java 15 Jan 2007 18:10:55 -0000 1.18
@@ -12,9 +12,9 @@
import org.jboss.cache.Modification;
import org.jboss.cache.RegionManager;
import org.jboss.cache.buddyreplication.BuddyManager;
+import org.jboss.cache.marshall.Marshaller;
import org.jboss.cache.marshall.NodeData;
import org.jboss.cache.marshall.NodeDataExceptionMarker;
-import org.jboss.cache.marshall.VersionAwareMarshaller;
import org.jboss.cache.util.MapCopy;
import java.io.ObjectInputStream;
@@ -243,7 +243,7 @@
}
}
- protected VersionAwareMarshaller getMarshaller()
+ protected Marshaller getMarshaller()
{
return cache.getMarshaller();
}
More information about the jboss-cvs-commits
mailing list