Exemplo n.º 1
0
 /**
  * Marks a stream as available for closing. A log will only be closed if a new log is requested
  * and the pool has reached its maximum size.
  */
 synchronized void releaseLogStream(LogStream stream) {
   StreamKey key = (StreamKey) stream.getKey();
   if (pool.get(key) == null)
     throw new InternalMailboxException(
         "Not managing stream: " + stream + ":" + key + " -- release failed");
   freeList.add(key);
   notifyAll();
 }
Exemplo n.º 2
0
  /**
   * Removes the given <tt>LogStream</tt> from the pool and closes it, if possible. The intent is
   * for this method to be called for unusable logs so that they will no longer be returned by a
   * subsequent call to one of the "get" methods.
   */
  synchronized void removeLogStream(LogStream stream) {
    StreamKey key = (StreamKey) stream.getKey();
    if (pool.remove(key) == null)
      throw new InternalMailboxException(
          "Not managing stream: " + stream + ":" + key + " -- remove failed");

    // Remove it from freeList, if present
    freeList.remove(key);
    try {
      stream.close();
    } catch (IOException ioe) {
      // Note the exception, but otherwise ignore
      if (persistenceLogger.isLoggable(Levels.HANDLED)) {
        persistenceLogger.log(Levels.HANDLED, "Exception closing Log", ioe);
      }
    }
  }