1 package org.apache.commons.jcs.admin; 2 3 /* 4 * Licensed to the Apache Software Foundation (ASF) under one 5 * or more contributor license agreements. See the NOTICE file 6 * distributed with this work for additional information 7 * regarding copyright ownership. The ASF licenses this file 8 * to you under the Apache License, Version 2.0 (the 9 * "License"); you may not use this file except in compliance 10 * with the License. You may obtain a copy of the License at 11 * 12 * http://www.apache.org/licenses/LICENSE-2.0 13 * 14 * Unless required by applicable law or agreed to in writing, 15 * software distributed under the License is distributed on an 16 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 17 * KIND, either express or implied. See the License for the 18 * specific language governing permissions and limitations 19 * under the License. 20 */ 21 22 import javax.management.MXBean; 23 import java.io.IOException; 24 25 /** 26 * A MXBean to expose the JCS statistics to JMX 27 */ 28 @MXBean 29 public interface JCSJMXBean 30 { 31 /** 32 * Builds up info about each element in a region. 33 * <p> 34 * @param cacheName 35 * @return Array of CacheElementInfo objects 36 * @throws Exception 37 */ 38 CacheElementInfo[] buildElementInfo( String cacheName ) throws Exception; 39 40 /** 41 * Builds up data on every region. 42 * <p> 43 * TODO we need a most light weight method that does not count bytes. The byte counting can 44 * really swamp a server. 45 * @return Array of CacheRegionInfo objects 46 * @throws Exception 47 */ 48 CacheRegionInfo[] buildCacheInfo() throws Exception; 49 50 /** 51 * Tries to estimate how much data is in a region. This is expensive. If there are any non serializable objects in 52 * the region or an error occurs, suppresses exceptions and returns 0. 53 * <p> 54 * 55 * @return int The size of the region in bytes. 56 */ 57 int getByteCount(String cacheName); 58 59 /** 60 * Clears all regions in the cache. 61 * <p> 62 * If this class is running within a remote cache server, clears all regions via the <code>RemoteCacheServer</code> 63 * API, so that removes will be broadcast to client machines. Otherwise clears all regions in the cache directly via 64 * the usual cache API. 65 */ 66 void clearAllRegions() throws IOException; 67 68 /** 69 * Clears a particular cache region. 70 * <p> 71 * If this class is running within a remote cache server, clears the region via the <code>RemoteCacheServer</code> 72 * API, so that removes will be broadcast to client machines. Otherwise clears the region directly via the usual 73 * cache API. 74 */ 75 void clearRegion(String cacheName) throws IOException; 76 77 /** 78 * Removes a particular item from a particular region. 79 * <p> 80 * If this class is running within a remote cache server, removes the item via the <code>RemoteCacheServer</code> 81 * API, so that removes will be broadcast to client machines. Otherwise clears the region directly via the usual 82 * cache API. 83 * 84 * @param cacheName 85 * @param key 86 * 87 * @throws IOException 88 */ 89 void removeItem(String cacheName, String key) throws IOException; 90 }