001/*
002 * (C) Copyright 2006-2011 Nuxeo SA (http://nuxeo.com/) and others.
003 *
004 * Licensed under the Apache License, Version 2.0 (the "License");
005 * you may not use this file except in compliance with the License.
006 * You may obtain a copy of the License at
007 *
008 *     http://www.apache.org/licenses/LICENSE-2.0
009 *
010 * Unless required by applicable law or agreed to in writing, software
011 * distributed under the License is distributed on an "AS IS" BASIS,
012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013 * See the License for the specific language governing permissions and
014 * limitations under the License.
015 *
016 * Contributors:
017 *     Florent Guillaume
018 */
019
020package org.nuxeo.ecm.core.storage.sql.management;
021
022import org.nuxeo.ecm.core.blob.binary.BinaryManagerStatus;
023
024/**
025 * @author Florent Guillaume
026 */
027public interface SQLRepositoryStatusMBean {
028
029    /**
030     * Lists the opened sessions.
031     */
032    String listActiveSessions();
033
034    /**
035     * Lists the remote opened sessions
036     */
037    String listRemoteSessions();
038
039    /**
040     * Return the opened sessions count
041     */
042    int getActiveSessionsCount();
043
044    /**
045     * Clears the caches.
046     */
047    String clearCaches();
048
049    /**
050     * Evaluate caches size
051     *
052     * @since 5.7.2
053     */
054    long getCachesSize();
055
056    /**
057     * GC the unused binaries.
058     *
059     * @param delete if {@code false} don't actually delete the GCed binaries (but still return statistics about them),
060     *            if {@code true} delete them
061     * @return a status about the number of GCed binaries
062     */
063    BinaryManagerStatus gcBinaries(boolean delete);
064
065    /**
066     * Is a GC of the binaries in progress?
067     * <p>
068     * It's only useful to call this from a separate thread from the one that called {@link #gcBinaries}.
069     *
070     * @return {@code true} if a GC of the binaries is in progress
071     */
072    boolean isBinariesGCInProgress();
073
074}