All Downloads are FREE. Search and download functionalities are using the official Maven repository.

net.java.truevfs.ext.pacemaker.PaceController.scala Maven / Gradle / Ivy

Go to download

Constrains the number of concurrently mounted archive file systems in order to save some heap space. This module provides a JMX interface for monitoring and management. Add the JAR artifact of this module to the run time class path to make its services available for service location in the client API modules.

There is a newer version: 0.14.0
Show newest version
/*
 * Copyright (C) 2005-2015 Schlichtherle IT Services.
 * All rights reserved. Use is subject to license terms.
 */
package net.java.truevfs.ext.pacemaker

import net.java.truecommons.shed.OnTryFinally._
import net.java.truecommons.shed._
import net.java.truevfs.kernel.spec._

/** Calls back the given pace manager after each file system operation in order
  * to register itself as the most recently accessed file system and unmount the
  * least recently accessed file systems which exceed the maximum number of
  * mounted file systems.
  *
  * @author Christian Schlichtherle
  */
private class PaceController(manager: PaceManager, controller: FsController)
extends AspectController(controller) {

  override def apply[V](operation: () => V) =
    onTry {
      operation()
    } onFinally {
      manager recordAccess getMountPoint
    }

  override def sync(options: BitField[FsSyncOption]) { controller sync options } // skip apply!
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy