de.schlichtherle.truezip.fs.inst.jmx.JmxManager Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of truezip-extension-jmx-jul Show documentation
Show all versions of truezip-extension-jmx-jul Show documentation
This module provides a file system manager and an I/O pool service
for managing and monitoring TrueZIP via JMX and java.util.logging.
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.
The newest version!
/*
* Copyright (C) 2005-2015 Schlichtherle IT Services.
* All rights reserved. Use is subject to license terms.
*/
package de.schlichtherle.truezip.fs.inst.jmx;
import de.schlichtherle.truezip.fs.FsManager;
import de.schlichtherle.truezip.fs.FsSyncException;
import de.schlichtherle.truezip.fs.FsSyncOption;
import de.schlichtherle.truezip.fs.inst.InstrumentingManager;
import de.schlichtherle.truezip.util.BitField;
import javax.annotation.concurrent.Immutable;
/**
* @author Christian Schlichtherle
*/
@Immutable
final class JmxManager extends InstrumentingManager {
@SuppressWarnings("LeakingThisInConstructor")
JmxManager(final FsManager manager, final JmxDirector director) {
super(manager, director);
assert null != director;
director.setApplicationIOStatistics(new JmxIOStatistics());
director.setKernelIOStatistics(new JmxIOStatistics());
director.setTempIOStatistics(new JmxIOStatistics());
JmxManagerView.register(this);
}
/**
* {@inheritDoc}
*
* After the synchronization, this implementation creates a new statistics
* object which can get accessed by calling
* {@link JmxDirector#getKernelIOStatistics}.
*/
@Override
public void sync(BitField options) throws FsSyncException {
try {
delegate.sync(options);
} finally {
JmxDirector d = ((JmxDirector) director);
d.setApplicationIOStatistics(new JmxIOStatistics());
d.setKernelIOStatistics(new JmxIOStatistics());
d.setTempIOStatistics(new JmxIOStatistics());
}
}
}