001/*
002 * Licensed to the Apache Software Foundation (ASF) under one or more
003 * contributor license agreements.  See the NOTICE file distributed with
004 * this work for additional information regarding copyright ownership.
005 * The ASF licenses this file to You under the Apache License, Version 2.0
006 * (the "License"); you may not use this file except in compliance with
007 * the License.  You may obtain a copy of the License at
008 *
009 *      http://www.apache.org/licenses/LICENSE-2.0
010 *
011 * Unless required by applicable law or agreed to in writing, software
012 * distributed under the License is distributed on an "AS IS" BASIS,
013 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014 * See the License for the specific language governing permissions and
015 * limitations under the License.
016 */
017package org.apache.camel.api.management.mbean;
018
019import org.apache.camel.api.management.ManagedAttribute;
020import org.apache.camel.api.management.ManagedOperation;
021
022public interface ManagedStreamCachingStrategyMBean extends ManagedServiceMBean {
023
024    /**
025     * Used for selecting if the memory limit is <tt>committed</tt> or <tt>maximum</tt> heap memory setting.
026     */
027    enum SpoolUsedHeapMemoryLimit {
028        Committed,
029        Max
030    }
031
032    @ManagedAttribute(description = "Whether stream caching is enabled")
033    boolean isEnabled();
034
035    @ManagedAttribute(description = "To filter stream caching of a given set of allowed/denied classes.")
036    String[] getAllowClasses();
037
038    @ManagedAttribute(description = "To filter stream caching of a given set of allowed/denied classes.")
039    String[] getDenyClasses();
040
041    @ManagedAttribute(description = "Whether spooling to disk enabled")
042    boolean isSpoolEnabled();
043
044    @ManagedAttribute(description = "Directory used when overflow and spooling to disk")
045    String getSpoolDirectory();
046
047    @ManagedAttribute(description = "Cipher used if writing with encryption")
048    String getSpoolCipher();
049
050    @ManagedAttribute(description = "Threshold in bytes when overflow and spooling to disk instead of keeping in memory")
051    void setSpoolThreshold(long threshold);
052
053    @ManagedAttribute(description = "Threshold in bytes when overflow and spooling to disk instead of keeping in memory")
054    long getSpoolThreshold();
055
056    @ManagedAttribute(description = "Percentage (1-99) of used heap memory threshold to activate spooling to disk")
057    void setSpoolUsedHeapMemoryThreshold(int percentage);
058
059    @ManagedAttribute(description = "Percentage (1-99) of used heap memory threshold to activate spooling to disk")
060    int getSpoolUsedHeapMemoryThreshold();
061
062    @ManagedAttribute(description = "Whether used heap memory limit is committed or maximum")
063    void setSpoolUsedHeapMemoryLimit(SpoolUsedHeapMemoryLimit limit);
064
065    @ManagedAttribute(description = "Whether used heap memory limit is committed or maximum")
066    SpoolUsedHeapMemoryLimit getSpoolUsedHeapMemoryLimit();
067
068    @ManagedAttribute(description = "Buffer size in bytes to use when coping between buffers")
069    void setBufferSize(int bufferSize);
070
071    @ManagedAttribute(description = "Buffer size in bytes to use when coping between buffers")
072    int getBufferSize();
073
074    @ManagedAttribute(description = "Whether to remove spool directory when stopping")
075    void setRemoveSpoolDirectoryWhenStopping(boolean remove);
076
077    @ManagedAttribute(description = "Whether to remove spool directory when stopping")
078    boolean isRemoveSpoolDirectoryWhenStopping();
079
080    @ManagedAttribute(description = "Whether any or all spool rules determines whether to spool")
081    void setAnySpoolRules(boolean any);
082
083    @ManagedAttribute(description = "Whether any or all spool rules determines whether to spool")
084    boolean isAnySpoolRules();
085
086    @ManagedAttribute(description = "Number of in-memory StreamCache created")
087    long getCacheMemoryCounter();
088
089    @ManagedAttribute(description = "Total accumulated number of bytes which has been stream cached for in-memory StreamCache")
090    long getCacheMemorySize();
091
092    @ManagedAttribute(description = "Average number of bytes per cached stream for in-memory stream caches.")
093    long getCacheMemoryAverageSize();
094
095    @ManagedAttribute(description = "Number of spooled (not in-memory) StreamCache created")
096    long getCacheSpoolCounter();
097
098    @ManagedAttribute(description = "Total accumulated number of bytes which has been stream cached for spooled StreamCache")
099    long getCacheSpoolSize();
100
101    @ManagedAttribute(description = "Average number of bytes per cached stream for spooled (not in-memory) stream caches.")
102    long getCacheSpoolAverageSize();
103
104    @ManagedAttribute(description = "Whether utilization statistics is enabled")
105    boolean isStatisticsEnabled();
106
107    @ManagedAttribute(description = "Whether utilization statistics is enabled")
108    void setStatisticsEnabled(boolean enabled);
109
110    @ManagedOperation(description = "Reset the utilization statistics")
111    void resetStatistics();
112
113}