Search in sources :

Example 11 with DirectoryScannerConfig

use of com.sun.jmx.examples.scandir.config.DirectoryScannerConfig in project jdk8u_jdk by JetBrains.

the class ScanDirConfig method removeDirectoryScanner.

// see ScanDirConfigMXBean
public DirectoryScannerConfig removeDirectoryScanner(String name) throws IOException, InstanceNotFoundException {
    final DirectoryScannerConfig scanner;
    synchronized (this) {
        scanner = config.removeScan(name);
        if (scanner == null)
            throw new IllegalArgumentException(name + ": scanner not found");
        status = MODIFIED;
    }
    sendNotification(NOTIFICATION_MODIFIED);
    return scanner;
}
Also used : DirectoryScannerConfig(com.sun.jmx.examples.scandir.config.DirectoryScannerConfig)

Example 12 with DirectoryScannerConfig

use of com.sun.jmx.examples.scandir.config.DirectoryScannerConfig in project jdk8u_jdk by JetBrains.

the class ScanManager method applyConfiguration.

// Applies a configuration.
// throws IllegalStateException if lock can't be acquired.
// Unregisters all existing directory scanners, the create and registers
// new directory scanners according to the given config.
// Then pushes the log config to the result log manager.
//
private void applyConfiguration(ScanManagerConfig bean) throws IOException, JMException {
    if (bean == null)
        return;
    if (!sequencer.tryAcquire()) {
        throw new IllegalStateException("Can't acquire lock");
    }
    try {
        unregisterScanners();
        final DirectoryScannerConfig[] scans = bean.getScanList();
        if (scans == null)
            return;
        for (DirectoryScannerConfig scan : scans) {
            addDirectoryScanner(scan);
        }
        log.setConfig(bean.getInitialResultLogConfig());
    } finally {
        sequencer.release();
    }
}
Also used : DirectoryScannerConfig(com.sun.jmx.examples.scandir.config.DirectoryScannerConfig)

Aggregations

DirectoryScannerConfig (com.sun.jmx.examples.scandir.config.DirectoryScannerConfig)12 File (java.io.File)6 ScanManagerConfig (com.sun.jmx.examples.scandir.config.ScanManagerConfig)5 XmlConfigUtils (com.sun.jmx.examples.scandir.config.XmlConfigUtils)3 Call (com.sun.jmx.examples.scandir.ScanManagerTest.Call)2 FileMatch (com.sun.jmx.examples.scandir.config.FileMatch)2 LinkedBlockingQueue (java.util.concurrent.LinkedBlockingQueue)2 ScanState (com.sun.jmx.examples.scandir.ScanManagerMXBean.ScanState)1 FileOutputStream (java.io.FileOutputStream)1 IOException (java.io.IOException)1 Date (java.util.Date)1 AttributeChangeNotification (javax.management.AttributeChangeNotification)1 Notification (javax.management.Notification)1 NotificationListener (javax.management.NotificationListener)1