costin      01/06/08 20:33:24

  Modified:    src/share/org/apache/tomcat/startup EmbededTomcat.java
  Log:
  Ops, commited a bit too much...
  
  Removed the serialization/deserialization of tomcat snapshots ( it doesn't
  work anyway without the additional "transient" and "Serializable"), better
   to keep things simple.
  
  Revision  Changes    Path
  1.45      +1 -76     
jakarta-tomcat/src/share/org/apache/tomcat/startup/EmbededTomcat.java
  
  Index: EmbededTomcat.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/startup/EmbededTomcat.java,v
  retrieving revision 1.44
  retrieving revision 1.45
  diff -u -r1.44 -r1.45
  --- EmbededTomcat.java        2001/06/09 03:28:50     1.44
  +++ EmbededTomcat.java        2001/06/09 03:33:24     1.45
  @@ -330,7 +330,7 @@
        processArgs(args);
        
        // Configure the server
  -     tryConfigSnapshot();
  +     //      tryConfigSnapshot();
        //      tryProperties();
        //      tryServerXml();
        //      tryDefault();
  @@ -341,84 +341,12 @@
        if( ! initialized ) {
            initContextManager();
   
  -         // Save config for later use
  -         writeSnapshot();
        }
        
        // Start
        start();
       }
   
  -    // -------------------- Snapshot --------------------
  -    String confSnap="tomcatconfig.snapshot";
  -    boolean modified=true;
  -    protected boolean fastStart=false; // default
  -    
  -    /** Save a snapshot of the server config, for fast start
  -     */
  -    public void writeSnapshot() throws TomcatException {
  -     if( fastStart && modified ) {
  -         try {
  -             long time1=System.currentTimeMillis();
  -             OutputStream out=
  -                 new BufferedOutputStream(new FileOutputStream( confSnap ));
  -             ObjectOutputStream oos=new ObjectOutputStream( out );
  -             oos.writeObject( contextM );
  -             oos.close();
  -             long time2=System.currentTimeMillis();
  -             log( "Snapshot save time " + ( time2-time1));
  -         } catch( IOException ex ) {
  -             log("Error saving state ", ex );
  -         }
  -     }
  -    }
  -
  -    public void tryConfigSnapshot() {
  -     if( fastStart ) { // && ! modified
  -         try {
  -             long time1=System.currentTimeMillis();
  -                     
  -             File f=new File( confSnap );
  -             if( ! f.exists() ) {
  -                 return;
  -             }
  -             // Check if f is newer than server.xml, etc
  -             
  -             InputStream in=
  -                 new BufferedInputStream(new FileInputStream( confSnap ));
  -             ObjectInputStream ois=new ObjectInputStream( in );
  -             contextM=(ContextManager)ois.readObject();
  -
  -             // check dependencies
  -             
  -             // Post read fixes
  -             ois.close();
  -             long time2=System.currentTimeMillis();
  -             System.out.println( "Snapshot read time " + ( time2-time1));
  -             initialized=true;
  -         } catch( Exception ex ) {
  -             ex.printStackTrace();
  -             log( "Error reading snapshot ", ex );
  -         }
  -     }
  -    }
  -
  -    private boolean isFastStart() {
  -     return fastStart && ! modified;
  -    }
  -
  -    private void checkConfigSnapshot() {
  -     try {
  -         FileInputStream in=new FileInputStream( confSnap );
  -         ObjectInputStream ois=new ObjectInputStream( in );
  -         ContextManager cm=(ContextManager)ois.readObject();
  -     } catch( Exception ex ) {
  -         log("Error reading state ", ex );
  -     }
  -     modified=true;
  -    }
  -    
  -
   
       // -------------------- Main --------------------
       protected String args[]=null;
  @@ -433,8 +361,6 @@
   
            if (arg.equals("-sandbox")) {
                sandbox=true;
  -         } else if (arg.equals("-fastStart")) {
  -             fastStart=true;
            } else if (arg.equals("-h") || arg.equals("-home")) {
                i++;
                if (i < args.length)
  @@ -454,7 +380,6 @@
       
       public static void main(String args[] ) {
        EmbededTomcat tomcat=new EmbededTomcat();
  -     tomcat.fastStart=true;
        try {
            tomcat.setArgs( args );
               tomcat.execute();
  
  
  

Reply via email to