Search in sources :

Example 1 with FileSystem

use of io.fabric8.core.jmx.FileSystem in project docker-maven-plugin by fabric8io.

the class DockerAssemblyManager method getAssemblyFiles.

/**
 * Extract all files with a tracking archiver. These can be used to track changes in the filesystem and triggering
 * a rebuild of the image if needed ('docker:watch')
 */
public AssemblyFiles getAssemblyFiles(String name, BuildImageConfiguration buildConfig, MojoParameters mojoParams, Logger log) throws InvalidAssemblerConfigurationException, ArchiveCreationException, AssemblyFormattingException, MojoExecutionException {
    BuildDirs buildDirs = createBuildDirs(name, mojoParams);
    AssemblyConfiguration assemblyConfig = buildConfig.getAssemblyConfiguration();
    String assemblyName = assemblyConfig.getName();
    DockerAssemblyConfigurationSource source = new DockerAssemblyConfigurationSource(mojoParams, buildDirs, assemblyConfig);
    Assembly assembly = getAssemblyConfig(assemblyConfig, source);
    synchronized (trackArchiver) {
        MappingTrackArchiver ta = (MappingTrackArchiver) trackArchiver;
        ta.init(log, assemblyName);
        assembly.setId("tracker");
        assemblyArchiver.createArchive(assembly, assemblyName, "track", source, false);
        return ta.getAssemblyFiles(mojoParams.getSession());
    }
}
Also used : AssemblyConfiguration(io.fabric8.maven.docker.config.AssemblyConfiguration) Assembly(org.apache.maven.plugin.assembly.model.Assembly)

Example 2 with FileSystem

use of io.fabric8.core.jmx.FileSystem in project fabric8 by jboss-fuse.

the class GitHttpServerRegistrationHandler method unregisterServlet.

/**
 * The complexity of this code is due to problems with jgit and Windows file system.
 * See https://bugs.eclipse.org/bugs/show_bug.cgi?id=300084
 */
private void unregisterServlet() {
    unregisterGitHttpEndpoint();
    synchronized (gitRemoteUrl) {
        if (basePath != null) {
            try {
                httpService.get().unregister("/git");
            } catch (IllegalArgumentException e) {
                LOGGER.warn("/git Servlet wasn't registered. Unregistration not required.");
            }
            // this should foul jgit to use flush its cache and release locks for .pack files on Windows
            WindowCacheConfig cfg = new WindowCacheConfig();
            cfg.install();
            git.getRepository().close();
            git = null;
            boolean basePathExists = basePath.toFile().exists();
            for (int i = 0; i < 10; i++) {
                try {
                    if (basePathExists) {
                        recursiveDelete(basePath.toFile());
                        basePathExists = false;
                    }
                    break;
                } catch (IOException e) {
                    LOGGER.debug("Failed to recursively delete this filesystem path: {}", basePath, e);
                    System.gc();
                    try {
                        Thread.sleep(3 * 1000);
                    } catch (InterruptedException ie) {
                        Thread.currentThread().interrupt();
                    }
                }
            }
            if (basePathExists) {
                LOGGER.error("Failed to recursively delete this filesystem path: {}", basePath);
            } else {
                LOGGER.info("Correctly removed old git repo: {}", basePath);
            }
        }
    }
}
Also used : WindowCacheConfig(org.eclipse.jgit.storage.file.WindowCacheConfig) IOException(java.io.IOException) GitHttpEndpoint(io.fabric8.git.GitHttpEndpoint)

Example 3 with FileSystem

use of io.fabric8.core.jmx.FileSystem in project fabric8 by jboss-fuse.

the class FabricMBeanRegistrationListener method registerFabricMBeans.

private void registerFabricMBeans() {
    this.healthCheck = new HealthCheck(fabricService.get());
    this.managerMBean = new FabricManager((FabricServiceImpl) fabricService.get());
    this.zooKeeperMBean = new ZooKeeperFacade((FabricServiceImpl) fabricService.get());
    this.fileSystemMBean = new FileSystem(runtimeProperties.get());
    healthCheck.registerMBeanServer(shutdownTracker, mbeanServer.get());
    managerMBean.registerMBeanServer(shutdownTracker, mbeanServer.get());
    fileSystemMBean.registerMBeanServer(shutdownTracker, mbeanServer.get());
    zooKeeperMBean.registerMBeanServer(shutdownTracker, mbeanServer.get());
}
Also used : FabricManager(io.fabric8.core.jmx.FabricManager) ZooKeeperFacade(io.fabric8.core.jmx.ZooKeeperFacade) FileSystem(io.fabric8.core.jmx.FileSystem) HealthCheck(io.fabric8.core.jmx.HealthCheck)

Aggregations

FabricManager (io.fabric8.core.jmx.FabricManager)1 FileSystem (io.fabric8.core.jmx.FileSystem)1 HealthCheck (io.fabric8.core.jmx.HealthCheck)1 ZooKeeperFacade (io.fabric8.core.jmx.ZooKeeperFacade)1 GitHttpEndpoint (io.fabric8.git.GitHttpEndpoint)1 AssemblyConfiguration (io.fabric8.maven.docker.config.AssemblyConfiguration)1 IOException (java.io.IOException)1 Assembly (org.apache.maven.plugin.assembly.model.Assembly)1 WindowCacheConfig (org.eclipse.jgit.storage.file.WindowCacheConfig)1