Author: jiwils
Date: 2009-01-03 22:21:39 -0500 (Sat, 03 Jan 2009)
New Revision: 7344
Modified:
core/branches/1.4.X/src/org/jboss/cache/loader/JDBCExtendedCacheLoader.java
Log:
Fix for JBCACHE-1453. Persistent state transfer now loops using the
ByteArrayInputStream's available method rather than the wrapper
MarshalledValueInputStream.
Modified: core/branches/1.4.X/src/org/jboss/cache/loader/JDBCExtendedCacheLoader.java
===================================================================
--- core/branches/1.4.X/src/org/jboss/cache/loader/JDBCExtendedCacheLoader.java 2009-01-04
03:17:17 UTC (rev 7343)
+++ core/branches/1.4.X/src/org/jboss/cache/loader/JDBCExtendedCacheLoader.java 2009-01-04
03:21:39 UTC (rev 7344)
@@ -18,23 +18,23 @@
import org.jboss.invocation.MarshalledValueOutputStream;
/**
- * A A <code>JDBCCacheLoader</code> that implements
+ * A A <code>JDBCCacheLoader</code> that implements
* <code>ExtendedCacheLoader</code>.
- *
+ *
* @author <a href="mailto://brian.stansberry@jboss.com">Brian
Stansberry</a>
* @version $Id$
*/
public class JDBCExtendedCacheLoader extends JDBCCacheLoader implements
ExtendedCacheLoader
{
// -------------------------------------------------------- Instance Fields
-
+
private RegionManager manager_;
-
+
// ----------------------------------------------------------- Constructors
/**
* Create a new JDBCExtendedCacheLoader.
- *
+ *
*/
public JDBCExtendedCacheLoader()
{
@@ -50,7 +50,7 @@
{
// Set the TCCL to any classloader registered for subtree
setUnmarshallingClassLoader(subtree);
-
+
ByteArrayOutputStream out_stream=new ByteArrayOutputStream(1024);
ObjectOutputStream out=new MarshalledValueOutputStream(out_stream);
loadState(subtree, out);
@@ -71,28 +71,28 @@
{
// Set the TCCL to any classloader registered for subtree
setUnmarshallingClassLoader(subtree);
-
+
ByteArrayInputStream in_stream=new ByteArrayInputStream(state);
MarshalledValueInputStream in=new MarshalledValueInputStream(in_stream);
NodeData nd;
-
+
// remove entire existing state
this.remove(subtree);
-
- boolean moveToBuddy =
+
+ boolean moveToBuddy =
subtree.isChildOf(BuddyManager.BUDDY_BACKUP_SUBTREE_FQN) &&
subtree.size() > 1;
-
+
// store new state
Fqn fqn = null;
- while(in.available() > 0)
+ while(in_stream.available() > 0)
{
nd=(NodeData)in.readObject();
-
+
if (moveToBuddy)
fqn = BuddyManager.getBackupFqn(subtree, nd.fqn);
else
fqn = nd.fqn;
-
+
if(nd.attrs != null)
this.put(fqn, nd.attrs, true); // creates a node with 0 or more
attributes
else
@@ -132,16 +132,16 @@
{
storeState(state, Fqn.fromString("/"));
}
-
+
// ------------------------------------------------------- Private Methods
/**
- * Checks the RegionManager for a classloader registered for the
+ * Checks the RegionManager for a classloader registered for the
* given, and if found sets it as the TCCL
- *
+ *
* @param subtree
*/
private void setUnmarshallingClassLoader(Fqn subtree)
Show replies by date