org.apache.flink.runtime.state.gemini.engine.rm.LeakDetector Maven / Gradle / Ivy
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.flink.runtime.state.gemini.engine.rm;
import java.io.Closeable;
/**
* A Leak Detector is designed to discover the leak when a {@link Finalizable} is recycled by GC but its internal resources
* haven't be released. Or you can rely on it to do auto clean up, but it isn't a real-time cleaner.
*/
public interface LeakDetector extends Closeable {
/**
* Determine the action when leak occurs.
*/
enum LeakReportLevel {
DEBUG, //Default
ERROR //Treat leak as an error. Only used for test and debug for now.
}
/**
* Register a {@link Finalizable} to let Leak Detector to monitor and call the finalizing procedure if needed.
* @param finalizable the finalizable object.
*/
void register(Finalizable finalizable);
/**
* Return whether at least one leak detected.
* @return whether at least one leak detected.
*/
boolean leakDetected();
}