asmuts      02/01/17 15:08:17

  Modified:    src/java/org/apache/stratum/jcs/auxiliary/disk/jisp
                        JISPCache.java
  Log:
  cleaned, removed some unused stuff
  started on a dispose emthod
  marked some TODO's
  
  Revision  Changes    Path
  1.8       +23 -77    
jakarta-turbine-stratum/src/java/org/apache/stratum/jcs/auxiliary/disk/jisp/JISPCache.java
  
  Index: JISPCache.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-turbine-stratum/src/java/org/apache/stratum/jcs/auxiliary/disk/jisp/JISPCache.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- JISPCache.java    17 Jan 2002 22:57:18 -0000      1.7
  +++ JISPCache.java    17 Jan 2002 23:08:16 -0000      1.8
  @@ -72,7 +72,7 @@
       IndexedObjectDatabase database;
       BTreeIndex index1;
       private static int s_order = 101;
  -    //?
  +
       String jispDataFileName = "default_this_is_BAD";
       String jispIndexFileName = "default_this_is_BAD";
   
  @@ -107,10 +107,6 @@
           this.buffer = buffer;
       }
   
  -    //protected JISPCache ( String cacheName ) {
  -
  -    //  this( cacheName, null);
  -    //}
       //////////////////////////////////////////////////////////////////////
       /**
        *  Constructor for the JISPCache object
  @@ -536,8 +532,7 @@
               }
               catch ( Exception e2 )
               {
  -                log.error( e2, "Could not create error files!" );
  -
  +              log.error( e2, "Could not create error files!" );
               }
           }
       }
  @@ -563,38 +558,26 @@
        */
       public void dispose()
       {
  -//    if (!isAlive) {
  -//      log.logIt("is not alive and close() was called -- " + fileName);
  -//      return;
  -//    }
  -//    locker.writeLock();
  -//    try {
  -//      if (!isAlive) {
  -//        log.logIt("is not alive and close() was called -- " + fileName);
  -//        return;
  -//      }
  -//      try {
  -//        optimizeFile();
  -//      } catch (Exception e) {
  -//        JISPKey(e, "-- " + fileName);
  -//      }
  -//      try {
  -//        numInstances--;
  -//        if (numInstances == 0) {
  -//          p( "dispose -- Closing files -- in close -- " + fileName );
  -//          log.warn("dispose -- Closing files -- in close -- " + fileName);
  -//          dataFile.close();
  -//          dataFile = null;
  -//          keyFile.close();
  -//          keyFile = null;
  -//        }
  -//      } catch (Exception e) {
  -//        JISPKey(e, "-- " + fileName);
  -//      }
  -//    } finally {
  -//      isAlive = false;
  -//      locker.done();            // release write lock;
  -//    }
  +
  +       if (!isAlive)
  +       {
  +          log.logIt("is not alive and close() was called -- " + 
this.jispDataFileName);
  +          return;
  +        }
  +
  +        try
  +        {
  +          database.close();
  +        }
  +         catch (Exception e)
  +        {
  +          log.error(e);
  +        } finally {
  +          isAlive = false;
  +        }
  +
  +        // TODO: can we defragment here?
  +
       }
       // end dispose
   
  @@ -638,6 +621,7 @@
        */
       public void dump()
       {
  +      // TODO: not sure this is possible with JISP
   //    log.debug("keyHash.size()=" + keyHash.size());
   //    for (Iterator itr = keyHash.entrySet().iterator(); itr.hasNext();) {
   //      Map.Entry e = (Map.Entry)itr.next();
  @@ -649,19 +633,6 @@
       }
   
   
  -    //////////////////////////////////////////
  -    /**
  -     *  Description of the Method
  -     *
  -     *@param  s  Description of the Parameter
  -     */
  -    void trace( String s )
  -    {
  -        p( s );
  -    }
  -
  -    //////////////
  -
       /**
        *  Description of the Method
        *
  @@ -682,31 +653,6 @@
       public String getCacheName()
       {
           return cacheName;
  -    }
  -
  -
  -    /////////////////////////////////////////////////////////////////////////
  -    /**
  -     *  Returns the serialized form of the given object in a byte array.
  -     *
  -     *@param  obj              Description of the Parameter
  -     *@return                  Description of the Return Value
  -     *@exception  IOException  Description of the Exception
  -     */
  -    static byte[] serialize( Serializable obj )
  -        throws IOException
  -    {
  -        ByteArrayOutputStream baos = new ByteArrayOutputStream();
  -        ObjectOutputStream oos = new ObjectOutputStream( baos );
  -        try
  -        {
  -            oos.writeObject( obj );
  -        }
  -        finally
  -        {
  -            oos.close();
  -        }
  -        return baos.toByteArray();
       }
   
   }
  
  
  

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

Reply via email to