net.java.truevfs.ext.pacemaker.PaceController.scala Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of truevfs-ext-pacemaker Show documentation
Show all versions of truevfs-ext-pacemaker Show documentation
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.
/*
* 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