001package org.apache.commons.jcs3.admin; 002 003import java.io.IOException; 004import java.util.List; 005 006/* 007 * Licensed to the Apache Software Foundation (ASF) under one 008 * or more contributor license agreements. See the NOTICE file 009 * distributed with this work for additional information 010 * regarding copyright ownership. The ASF licenses this file 011 * to you under the Apache License, Version 2.0 (the 012 * "License"); you may not use this file except in compliance 013 * with the License. You may obtain a copy of the License at 014 * 015 * http://www.apache.org/licenses/LICENSE-2.0 016 * 017 * Unless required by applicable law or agreed to in writing, 018 * software distributed under the License is distributed on an 019 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 020 * KIND, either express or implied. See the License for the 021 * specific language governing permissions and limitations 022 * under the License. 023 */ 024 025import javax.management.MXBean; 026 027/** 028 * A MXBean to expose the JCS statistics to JMX 029 */ 030@MXBean 031public interface JCSJMXBean 032{ 033 /** 034 * Builds up info about each element in a region. 035 * <p> 036 * @param cacheName 037 * @return List of CacheElementInfo objects 038 * @throws IOException 039 */ 040 List<CacheElementInfo> buildElementInfo( String cacheName ) throws IOException; 041 042 /** 043 * Builds up data on every region. 044 * <p> 045 * TODO we need a most light weight method that does not count bytes. The byte counting can 046 * really swamp a server. 047 * @return List of CacheRegionInfo objects 048 */ 049 List<CacheRegionInfo> buildCacheInfo(); 050 051 /** 052 * Tries to estimate how much data is in a region. This is expensive. If there are any non serializable objects in 053 * the region or an error occurs, suppresses exceptions and returns 0. 054 * <p> 055 * 056 * @return long The size of the region in bytes. 057 */ 058 long getByteCount(String cacheName); 059 060 /** 061 * Clears all regions in the cache. 062 * <p> 063 * If this class is running within a remote cache server, clears all regions via the <code>RemoteCacheServer</code> 064 * API, so that removes will be broadcast to client machines. Otherwise clears all regions in the cache directly via 065 * the usual cache API. 066 */ 067 void clearAllRegions() throws IOException; 068 069 /** 070 * Clears a particular cache region. 071 * <p> 072 * If this class is running within a remote cache server, clears the region via the <code>RemoteCacheServer</code> 073 * API, so that removes will be broadcast to client machines. Otherwise clears the region directly via the usual 074 * cache API. 075 */ 076 void clearRegion(String cacheName) throws IOException; 077 078 /** 079 * Removes a particular item from a particular region. 080 * <p> 081 * If this class is running within a remote cache server, removes the item via the <code>RemoteCacheServer</code> 082 * API, so that removes will be broadcast to client machines. Otherwise clears the region directly via the usual 083 * cache API. 084 * 085 * @param cacheName 086 * @param key 087 * 088 * @throws IOException 089 */ 090 void removeItem(String cacheName, String key) throws IOException; 091}