All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.neo4j.kernel.impl.cache.MonitorGc Maven / Gradle / Ivy

/**
 * Copyright (c) 2002-2013 "Neo Technology,"
 * Network Engine for Objects in Lund AB [http://neotechnology.com]
 *
 * This file is part of Neo4j.
 *
 * Neo4j is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see .
 */
package org.neo4j.kernel.impl.cache;

import static org.neo4j.helpers.Settings.DURATION;
import static org.neo4j.helpers.Settings.setting;

import org.neo4j.graphdb.factory.GraphDatabaseSetting;
import org.neo4j.kernel.configuration.Config;
import org.neo4j.kernel.impl.util.StringLogger;
import org.neo4j.kernel.lifecycle.Lifecycle;

public class MonitorGc implements Lifecycle
{
    public static class Configuration
    {
        public static final GraphDatabaseSetting gc_monitor_wait_time =
                new GraphDatabaseSetting.TimeSpanSetting( setting( "gc_monitor_wait_time", DURATION, "100ms" ));
        public static final GraphDatabaseSetting gc_monitor_threshold =
                new GraphDatabaseSetting.TimeSpanSetting( setting("gc_monitor_threshold", DURATION, "200ms" ));
    }

    private final Config config;
    private final StringLogger logger;
    private volatile MeasureDoNothing monitorGc;

    public MonitorGc( Config config, StringLogger logger )
    {
        this.config = config;
        this.logger = logger;
    }

    @Override
    public void init() throws Throwable
    {
    }

    @Override
    public void start() throws Throwable
    {
        monitorGc = new MeasureDoNothing( "GC-Monitor", logger, config.get( Configuration.gc_monitor_wait_time ),
                config.get( Configuration.gc_monitor_threshold ) );
        monitorGc.start();
    }

    @Override
    public void stop() throws Throwable
    {
        monitorGc.stopMeasuring();
        monitorGc = null;
    }

    @Override
    public void shutdown() throws Throwable
    {
        // TODO Auto-generated method stub

    }

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy