net.java.truevfs.ext.insight.I5tStatistics.scala Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of truevfs-ext-insight Show documentation
Show all versions of truevfs-ext-insight Show documentation
Instruments the TrueVFS Kernel for statistics monitoring via JMX. 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-2013 Schlichtherle IT Services.
* All rights reserved. Use is subject to license terms.
*/
package net.java.truevfs.ext.insight
import javax.annotation.concurrent._
import net.java.truevfs.comp.jmx._
import net.java.truevfs.ext.insight.stats._
/**
* A controller for [[net.java.truevfs.ext.insight.stats.FsStatistics]].
*
* @author Christian Schlichtherle
*/
@ThreadSafe
private abstract class I5tStatistics(mediator: I5tMediator, offset: Int)
extends JmxComponent {
assert(0 <= offset)
def subject = mediator.subject
def stats = mediator stats offset
def rotate { mediator rotateStats this }
private def objectName = mediator
.nameBuilder(classOf[FsStatistics])
.put("subject", subject)
.put("offset", mediator formatOffset offset)
.get
def newView: I5tStatisticsView
override def activate() { mediator register (objectName, newView) }
override def toString =
"%s[subject=%s, offset=%d, mediator=%s]" format (getClass.getName, subject, offset, mediator)
}