User: biorn_steedom
  Date: 01/04/20 16:08:36

  Modified:    src/main/org/jboss/ejb/plugins
                        StatefulSessionFilePersistenceManager.java
  Log:
  Restricted access modifier to data members and implemented a new method that allows 
removal of timed out beans.
  
  Revision  Changes    Path
  1.17      +24 -9     
jboss/src/main/org/jboss/ejb/plugins/StatefulSessionFilePersistenceManager.java
  
  Index: StatefulSessionFilePersistenceManager.java
  ===================================================================
  RCS file: 
/cvsroot/jboss/jboss/src/main/org/jboss/ejb/plugins/StatefulSessionFilePersistenceManager.java,v
  retrieving revision 1.16
  retrieving revision 1.17
  diff -u -r1.16 -r1.17
  --- StatefulSessionFilePersistenceManager.java        2001/01/08 20:28:46     1.16
  +++ StatefulSessionFilePersistenceManager.java        2001/04/20 23:08:36     1.17
  @@ -63,7 +63,7 @@
    *  @author Rickard Öberg ([EMAIL PROTECTED])
    *  @author <a href="[EMAIL PROTECTED]">Marc Fleury</a>
    *  @author <a href="mailto:[EMAIL PROTECTED]">Sebastien Alborini</a>
  - *  @version $Revision: 1.16 $
  + *  @version $Revision: 1.17 $
    */
   public class StatefulSessionFilePersistenceManager
      implements StatefulSessionPersistenceManager
  @@ -71,15 +71,15 @@
      // Constants -----------------------------------------------------
   
      // Attributes ----------------------------------------------------
  -   StatefulSessionContainer con;
  +   private StatefulSessionContainer con;
   
  -   Method ejbActivate;
  -   Method ejbPassivate;
  -   Method ejbRemove;
  +   private Method ejbActivate;
  +   private Method ejbPassivate;
  +   private Method ejbRemove;
   
  -   File dir;
  +   private File dir;
   
  -   ArrayList fields;
  +   private ArrayList fields;
   
      // Static --------------------------------------------------------
      private static long id = System.currentTimeMillis();
  @@ -221,14 +221,17 @@
   
   
            // Load state
  -         in = new SessionObjectInputStream(ctx, new FileInputStream(new File(dir, 
ctx.getId()+".ser")));
  +         in = new SessionObjectInputStream(ctx, new 
FileInputStream(getFile(ctx.getId())));
            
            ctx.setInstance(in.readObject());
            
            in.close();
  +              
  +              removePassivated(ctx.getId());
            
            // Call bean
            ejbActivate.invoke(ctx.getInstance(), new Object[0]);
  +              
         } catch (ClassNotFoundException e)
         {
            throw new ServerException("Could not activate", e); 
  @@ -273,7 +276,7 @@
            ejbPassivate.invoke(ctx.getInstance(), new Object[0]);
   
            // Store state
  -         ObjectOutputStream out = new SessionObjectOutputStream(new 
FileOutputStream(new File(dir, ctx.getId()+".ser")));
  +         ObjectOutputStream out = new SessionObjectOutputStream(new 
FileOutputStream(getFile(ctx.getId())));
   
            out.writeObject(ctx.getInstance());
   
  @@ -318,6 +321,7 @@
         try
         {
            ejbRemove.invoke(ctx.getInstance(), new Object[0]);
  +              
         } catch (IllegalAccessException e)
         {
            // Throw this as a bean exception...(?)
  @@ -349,6 +353,12 @@
            }
         }
      }
  +   
  +   public void removePassivated(Object key) 
  +   {
  +        // OK also if the file does not exists
  +        getFile(key).delete();
  +   }
   
      // Z implementation ----------------------------------------------
   
  @@ -358,6 +368,11 @@
      protected Long nextId()
      {
         return new Long(id++);
  +   }
  +   
  +   protected File getFile(Object key) 
  +   {
  +        return new File(dir, key + ".ser");
      }
   
      // Private -------------------------------------------------------
  
  
  

_______________________________________________
Jboss-development mailing list
[EMAIL PROTECTED]
http://lists.sourceforge.net/lists/listinfo/jboss-development

Reply via email to