Search in sources :

Example 1 with VfsEmbeddedFileSystemCloser

use of org.pentaho.di.core.osgi.api.VfsEmbeddedFileSystemCloser in project pentaho-kettle by pentaho.

the class ConcurrentFileSystemManager method closeEmbeddedFileSystem.

public void closeEmbeddedFileSystem(String embeddedMetastoreKey) {
    lock.readLock().lock();
    Map<String, FileProvider> providers;
    try {
        // Close the file system
        java.lang.reflect.Field field = null;
        try {
            field = this.getClass().getSuperclass().getSuperclass().getDeclaredField("providers");
            field.setAccessible(true);
        } catch (NoSuchFieldException e) {
            e.printStackTrace();
        }
        providers = (Map<String, FileProvider>) field.get(this);
        FileProvider provider = providers.get("hc");
        if (provider != null) {
            ((VfsEmbeddedFileSystemCloser) provider).closeFileSystem(embeddedMetastoreKey);
        }
    } catch (IllegalAccessException e) {
        e.printStackTrace();
    } finally {
        lock.readLock().unlock();
    }
}
Also used : VfsEmbeddedFileSystemCloser(org.pentaho.di.core.osgi.api.VfsEmbeddedFileSystemCloser) FileProvider(org.apache.commons.vfs2.provider.FileProvider)

Aggregations

FileProvider (org.apache.commons.vfs2.provider.FileProvider)1 VfsEmbeddedFileSystemCloser (org.pentaho.di.core.osgi.api.VfsEmbeddedFileSystemCloser)1