[jboss-cvs] JBossCache/src/org/jboss/cache/loader ...

Vladmir Blagojevic vladimir.blagojevic at jboss.com
Wed Sep 13 11:42:17 EDT 2006


  User: vblagojevic
  Date: 06/09/13 11:42:17

  Modified:    src/org/jboss/cache/loader    AbstractCacheLoader.java
                        NodeData.java
  Added:       src/org/jboss/cache/loader    NodeDataExceptionMarker.java
  Log:
  more robust error handling for loadstate/storestate
  
  Revision  Changes    Path
  1.3       +15 -1     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.2
  retrieving revision 1.3
  diff -u -b -r1.2 -r1.3
  --- AbstractCacheLoader.java	12 Sep 2006 20:16:55 -0000	1.2
  +++ AbstractCacheLoader.java	13 Sep 2006 15:42:16 -0000	1.3
  @@ -12,6 +12,7 @@
   import java.util.Map;
   import java.util.Set;
   
  +import org.jboss.cache.CacheException;
   import org.jboss.cache.CacheSPI;
   import org.jboss.cache.Fqn;
   import org.jboss.cache.buddyreplication.BuddyManager;
  @@ -60,17 +61,30 @@
              
             for (nd = (NodeData) in.readObject(); nd != null && !nd.isMarker(); nd = (NodeData) in.readObject())
             {
  +             if(nd.isExceptionMarker())
  +             {
  +                throw new CacheException("State provider cacheloader threw exception during loadState",((NodeDataExceptionMarker)nd).getCause());
  +             }
  +             
                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
  +             {
                   this.put(fqn, null); // creates a node with null attributes                          
             }
          }
  +       }
          finally
          {
             Thread.currentThread().setContextClassLoader(currentCL);
  
  
  
  1.4       +6 -1      JBossCache/src/org/jboss/cache/loader/NodeData.java
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: NodeData.java
  ===================================================================
  RCS file: /cvsroot/jboss/JBossCache/src/org/jboss/cache/loader/NodeData.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -b -r1.3 -r1.4
  --- NodeData.java	31 Aug 2006 14:56:45 -0000	1.3
  +++ NodeData.java	13 Sep 2006 15:42:16 -0000	1.4
  @@ -11,7 +11,7 @@
   /**
    * Serializable representation of the data of a node (FQN and attributes)
    * @author Bela Ban
  - * @version $Id: NodeData.java,v 1.3 2006/08/31 14:56:45 vblagojevic Exp $
  + * @version $Id: NodeData.java,v 1.4 2006/09/13 15:42:16 vblagojevic Exp $
    */
   public class NodeData implements Externalizable {
      Fqn     fqn=null;
  @@ -49,6 +49,11 @@
         return false;
      }
   
  +   public boolean isExceptionMarker()
  +   {
  +      return false;
  +   }
  +
      public void writeExternal(ObjectOutput out) throws IOException {
         out.writeObject(fqn);
         if(attrs != null) {
  
  
  
  1.1      date: 2006/09/13 15:42:16;  author: vblagojevic;  state: Exp;JBossCache/src/org/jboss/cache/loader/NodeDataExceptionMarker.java
  
  Index: NodeDataExceptionMarker.java
  ===================================================================
  package org.jboss.cache.loader;
  
  import java.io.IOException;
  import java.io.ObjectInput;
  import java.io.ObjectOutput;
  
  public class NodeDataExceptionMarker extends NodeData
  {
     Throwable cause = null;
  
     public NodeDataExceptionMarker()
     {
        super();
     }
  
     public NodeDataExceptionMarker(Throwable t)
     {
        cause = t;
     }
  
     public Throwable getCause()
     {
        return cause;
     }
  
     public boolean isExceptionMarker()
     {
        return true;
     }
  
     public void writeExternal(ObjectOutput out) throws IOException
     {
        super.writeExternal(out);
        out.writeObject(cause);
  
     }
  
     public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException
     {
        super.readExternal(in);
        cause = (Throwable) in.readObject();
     }
  }
  
  
  



More information about the jboss-cvs-commits mailing list