Package com.atomikos.persistence

Examples of com.atomikos.persistence.LogException


      // will probably want to write more!
      // Thus, we return the open stream to the client.
      // Any closing will be done later, during cleanup if necessary.

      if (corrupt_) {
        throw new LogException("Instance corrupted");
      }

      try {
        file_.discardBackupVersion();
      } catch (IOException errorOnDelete) {
        markAsCorrupt();
        // should restart
        throw new LogException("Old file could not be deleted");
      }
    } catch (Exception e) {
      throw new LogException("Error during checkpointing", e);
    }

  }
View Full Code Here


  }

  public synchronized void flushObject(Object o, boolean shouldSync) throws LogException {
    if (ooutput_ == null)
      throw new LogException("Not Initialized or already closed");
    try {
      ooutput_.writeObject(o);
      output_.flush();
      ooutput_.flush();
      if (shouldSync)
        output_.getFD().sync();
    } catch (IOException e) {
      throw new LogException(e.getMessage(), e);
    }
  }
View Full Code Here

    if (forceCheckpoint)
      forceWriteCheckpoint();
    if (e instanceof LogException)
      throw (LogException) e;
    else
      throw new LogException(msg, e);
  }
View Full Code Here

   * @see ObjectLog
   */

  public synchronized Vector recover() throws LogException {
    if (!initialized_)
      throw new LogException("Not initialized");

    Vector ret = new Vector();
    Enumeration enumm = contentForNextCheckpoint_.elements();
    while (enumm.hasMoreElements()) {
      SystemLogImage next = (SystemLogImage) enumm.nextElement();
View Full Code Here

        LOGGER.logInfo(WRITE_AHEAD_OBJECT_LOG_CLASSNAME+" instantiation failed - falling back to default");
      }
     
      objectlog_.init();
    } catch (IOException e) {
      throw new LogException(e.getMessage(), e);
    }
   
  }
View Full Code Here

  }

  public Vector<Recoverable> recover() throws LogException {

    if (corrupt_)
      throw new LogException("Instance might be corrupted");

    Vector<Recoverable> ret = new Vector<Recoverable>();

    try {
      FileInputStream f = file_.openLastValidVersionForReading();

      int count = 0;
      if (LOGGER.isInfoEnabled()) {
        LOGGER.logInfo("Starting read of logfile " + file_.getCurrentVersionFileName());
      }
     
      while (f.available()>0) {
        // if crashed, then unproper closing might cause endless blocking!
        // therefore, we check if avaible first.
        count++;
       
        SystemLogImage systemLogImage = new SystemLogImage();

        systemLogImage.readData(new DataInputStream(f));
        ret.addElement(systemLogImage);
        if (count % 10 == 0) {
          LOGGER.logInfo(".");
        }

      }
      LOGGER.logInfo("Done read of logfile");

    } catch (java.io.EOFException unexpectedEOF) {
      LOGGER.logDebug("Unexpected EOF - logfile not closed properly last time?", unexpectedEOF);
      // merely return what was read so far...
    } catch (StreamCorruptedException unexpectedEOF) {
      LOGGER.logDebug("Unexpected EOF - logfile not closed properly last time?", unexpectedEOF);
      // merely return what was read so far...
    } catch (ObjectStreamException unexpectedEOF) {
      LOGGER.logDebug("Unexpected EOF - logfile not closed properly last time?", unexpectedEOF);
      // merely return what was read so far...
    } catch (FileNotFoundException firstStart) {
      // the file could not be opened for reading;
      // merely return the default empty vector
    } catch (Exception e) {
      String msg = "Error in recover";
      LOGGER.logWarning(msg, e);
      throw new LogException(msg, e);
    }

    return ret;
  }
View Full Code Here

        // Thus, we return the open stream to the client.
        // Any closing will be done later, during cleanup if necessary.

        if (simulateCrash_) {
          corrupt_ = true;
          throw new LogException("Old file could not be deleted");
        }

        try {
          file_.discardBackupVersion();
        } catch (IOException errorOnDelete) {
          corrupt_ = true;
          // should restart
          throw new LogException("Old file could not be deleted");
        }
      } catch (Exception e) {
        throw new LogException("Error during checkpointing", e);
      }

    }
   
  }
View Full Code Here

        }
      }
      if (shouldSync && output_!=null)   output_.getFD().sync();
    } catch (IOException e) {

      throw new LogException(e.getMessage(), e);
    }
  }
View Full Code Here

            throw le;
        } catch ( Exception e ) {

            // bad exit condition
            errors.push ( e );
            throw new LogException ( e.getMessage (), errors );

        }// catch

        finally {
            initialized_ = true;
View Full Code Here

    {
        Stack errors = new Stack ();
        Vector hist = new Vector ();

        if ( !initialized_ )
            throw new LogException ( "Not initialized" );
        Enumeration enumm = logTable_.elements ();

        while ( enumm.hasMoreElements () ) {
            SystemLogImage next = (SystemLogImage) enumm.nextElement ();
View Full Code Here

TOP

Related Classes of com.atomikos.persistence.LogException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.