jmcnally    02/03/15 14:45:03

  Modified:    src/java/org/apache/torque/manager AbstractBaseManager.java
  Log:
  mark the manager as Serializable.  Not sure the cache is serializable or if
  it is that we would want to serialize its data, so i marked it as transient
  and it is reinitialized after deserialization.
  
  Revision  Changes    Path
  1.2       +32 -3     
jakarta-turbine-torque/src/java/org/apache/torque/manager/AbstractBaseManager.java
  
  Index: AbstractBaseManager.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-turbine-torque/src/java/org/apache/torque/manager/AbstractBaseManager.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- AbstractBaseManager.java  13 Mar 2002 21:31:23 -0000      1.1
  +++ AbstractBaseManager.java  15 Mar 2002 22:45:03 -0000      1.2
  @@ -62,6 +62,8 @@
   import java.util.Map;
   import java.util.HashMap;
   import java.util.Iterator;
  +import java.io.Serializable;
  +import java.io.IOException;
   
   import org.apache.stratum.jcs.JCS;
   import org.apache.stratum.jcs.access.behavior.ICacheAccess;
  @@ -77,15 +79,16 @@
    * instantiating OM's.
    *
    * @author <a href="mailto:[EMAIL PROTECTED]";>John McNally</a>
  - * @version $Id: AbstractBaseManager.java,v 1.1 2002/03/13 21:31:23 jmcnally Exp $
  + * @version $Id: AbstractBaseManager.java,v 1.2 2002/03/15 22:45:03 jmcnally Exp $
    */
   public abstract class AbstractBaseManager
  +    implements Serializable
   {
       protected static final Category category =
           Category.getInstance(AbstractBaseManager.class.getName());
   
  -    /** used to cache the om objects */
  -    protected ICacheAccess cache;
  +    /** used to cache the om objects. cache is set by the region property */
  +    transient protected ICacheAccess cache;
   
       /** method results cache */
       protected MethodResultCache mrCache;
  @@ -533,6 +536,32 @@
                       }
                   }
               }
  +        }
  +    }
  +
  +    // helper methods for the Serializable interface
  +    private void writeObject(java.io.ObjectOutputStream out)
  +        throws IOException
  +    {
  +        out.defaultWriteObject();
  +    }
  +
  +    private void readObject(java.io.ObjectInputStream in)
  +        throws IOException, ClassNotFoundException
  +    {
  +        in.defaultReadObject();
  +        // initialize the cache
  +        try
  +        {
  +            if (region != null) 
  +            {
  +                setRegion(region);                
  +            }            
  +        }
  +        catch (Exception e)
  +        {
  +            category.error("Cache was not be initialized for region: " 
  +                           + region + "after deserialization");
           }
       }
   }
  
  
  

--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to