Tabnine Logo
JCSAdminBean
Code IndexAdd Tabnine to your IDE (free)

How to use
JCSAdminBean
in
org.apache.commons.jcs.admin

Best Java code snippets using org.apache.commons.jcs.admin.JCSAdminBean (Showing top 16 results out of 315)

origin: org.apache.commons/commons-jcs-core

protected Template handleRequest( HttpServletRequest request, HttpServletResponse response, Context context )
  JCSAdminBean admin = new JCSAdminBean();
        admin.clearAllRegions();
          admin.clearRegion( cacheName );
          admin.removeItem( cacheName, keys[i] );
      context.put( "elementInfoRecords", admin.buildElementInfo( cacheName ) );
      context.put( "cacheInfoRecords", admin.buildCacheInfo() );
origin: org.apache.commons/commons-jcs-core

/**
 * Tries to estimate how much data is in a region. This is expensive. If there are any non serializable objects in
 * the region or an error occurs, suppresses exceptions and returns 0.
 * <p>
 *
 * @return int The size of the region in bytes.
 */
@Override
public int getByteCount(String cacheName)
{
  return getByteCount(cacheHub.getCache(cacheName));
}
origin: stackoverflow.com

 JCSAdminBean admin = new JCSAdminBean();
LinkedList linkedList = admin.buildCacheInfo();
ListIterator iterator = linkedList.listIterator();
while (iterator.hasNext()) {
  CacheRegionInfo info = (CacheRegionInfo)iterator.next();
  CompositeCache compCache = info.getCache();
  System.out.println("Cache Name: " + compCache.getCacheName());
  System.out.println("Cache Type: " + compCache.getCacheType());
  System.out.println("Cache Misses (not found): " + compCache.getMissCountNotFound());
  System.out.println("Cache Misses (expired): " + compCache.getMissCountExpired());
  System.out.println("Cache Hits (memory): " + compCache.getHitCountRam());
  System.out.println("Cache value: " + compCache.get(propId));
origin: org.apache.commons/commons-jcs-core

/**
 * Remove an item via the remove method.
 *
 * @throws Exception
 */
public void testRemove()
  throws Exception
{
  JCSAdminBean admin = new JCSAdminBean();
  String regionName = "myRegion";
  CacheAccess<String, String> cache = JCS.getInstance( regionName );
  // clear the region
  cache.clear();
  admin.clearRegion( regionName );
  String key = "myKey";
  cache.put( key, "value" );
  CacheElementInfo[] elements = admin.buildElementInfo( regionName );
  assertEquals( "Wrong number of elements in the region.", 1, elements.length );
  CacheElementInfo elementInfo = elements[0];
  assertEquals( "Wrong key.", key, elementInfo.getKey() );
  admin.removeItem( regionName, key );
  CacheElementInfo[] elements2 = admin.buildElementInfo( regionName );
  assertEquals( "Wrong number of elements in the region after remove.", 0, elements2.length );
}
origin: org.apache.commons/commons-jcs-core

  /**
   * Add an item to a region. Call clear all and verify that it doesn't exist.
   *
   * @throws Exception
   */
  public void testClearAll()
    throws Exception
  {
    JCSAdminBean admin = new JCSAdminBean();

    String regionName = "myRegion";
    CacheAccess<String, String> cache = JCS.getInstance( regionName );

    String key = "myKey";
    cache.put( key, "value" );

    admin.clearAllRegions();

    CacheElementInfo[] elements2 = admin.buildElementInfo( regionName );
    assertEquals( "Wrong number of elements in the region after remove.", 0, elements2.length );
  }
}
origin: org.apache.commons/commons-jcs-core

/**
 * Put a value in a region and verify that it shows up.
 *
 * @throws Exception
 */
public void testGetElementForRegionInfo()
  throws Exception
{
  String regionName = "myRegion";
  CacheAccess<String, String> cache = JCS.getInstance( regionName );
  // clear the region
  cache.clear();
  String key = "myKey";
  cache.put( key, "value" );
  JCSAdminBean admin = new JCSAdminBean();
  CacheElementInfo[] elements = admin.buildElementInfo( regionName );
  assertEquals( "Wrong number of elements in the region.", 1, elements.length );
  CacheElementInfo elementInfo = elements[0];
  assertEquals( "Wrong key." + elementInfo, key, elementInfo.getKey() );
}
origin: org.apache.commons/commons-jcs-core

JCSAdminBean adminBean = new JCSAdminBean(this);
try
origin: org.apache.tomee.patch/commons-jcs-core

/**
 * Remove an item via the remove method.
 *
 * @throws Exception
 */
public void testRemove()
  throws Exception
{
  JCSAdminBean admin = new JCSAdminBean();
  String regionName = "myRegion";
  CacheAccess<String, String> cache = JCS.getInstance( regionName );
  // clear the region
  cache.clear();
  admin.clearRegion( regionName );
  String key = "myKey";
  cache.put( key, "value" );
  CacheElementInfo[] elements = admin.buildElementInfo( regionName );
  assertEquals( "Wrong number of elements in the region.", 1, elements.length );
  CacheElementInfo elementInfo = elements[0];
  assertEquals( "Wrong key.", key, elementInfo.getKey() );
  admin.removeItem( regionName, key );
  CacheElementInfo[] elements2 = admin.buildElementInfo( regionName );
  assertEquals( "Wrong number of elements in the region after remove.", 0, elements2.length );
}
origin: org.apache.tomee.patch/commons-jcs-core

  /**
   * Add an item to a region. Call clear all and verify that it doesn't exist.
   *
   * @throws Exception
   */
  public void testClearAll()
    throws Exception
  {
    JCSAdminBean admin = new JCSAdminBean();

    String regionName = "myRegion";
    CacheAccess<String, String> cache = JCS.getInstance( regionName );

    String key = "myKey";
    cache.put( key, "value" );

    admin.clearAllRegions();

    CacheElementInfo[] elements2 = admin.buildElementInfo( regionName );
    assertEquals( "Wrong number of elements in the region after remove.", 0, elements2.length );
  }
}
origin: org.apache.commons/commons-jcs-core

/**
 * Create a test region and then verify that we get it from the list.
 *
 * @throws Exception
 *
 */
public void testGetRegionInfo()
  throws Exception
{
  String regionName = "myRegion";
  CacheAccess<String, String> cache = JCS.getInstance( regionName );
  cache.put( "key", "value" );
  JCSAdminBean admin = new JCSAdminBean();
  CacheRegionInfo[] regions = admin.buildCacheInfo();
  boolean foundRegion = false;
  for (CacheRegionInfo info : regions)
  {
    if ( info.getCacheName().equals( regionName ) )
    {
      foundRegion = true;
      assertTrue( "Byte count should be greater than 5.", info.getByteCount() > 5 );
      assertNotNull( "Should have stats.", info.getCacheStatistics() );
    }
  }
  assertTrue( "Should have found the region we just created.", foundRegion );
}
origin: org.apache.tomee.patch/commons-jcs-core

/**
 * Put a value in a region and verify that it shows up.
 *
 * @throws Exception
 */
public void testGetElementForRegionInfo()
  throws Exception
{
  String regionName = "myRegion";
  CacheAccess<String, String> cache = JCS.getInstance( regionName );
  // clear the region
  cache.clear();
  String key = "myKey";
  cache.put( key, "value" );
  JCSAdminBean admin = new JCSAdminBean();
  CacheElementInfo[] elements = admin.buildElementInfo( regionName );
  assertEquals( "Wrong number of elements in the region.", 1, elements.length );
  CacheElementInfo elementInfo = elements[0];
  assertEquals( "Wrong key." + elementInfo, key, elementInfo.getKey() );
}
origin: org.apache.tomee.patch/commons-jcs-core

JCSAdminBean adminBean = new JCSAdminBean(this);
try
origin: org.apache.tomee.patch/commons-jcs-core

protected Template handleRequest( HttpServletRequest request, HttpServletResponse response, Context context )
  JCSAdminBean admin = new JCSAdminBean();
        admin.clearAllRegions();
          admin.clearRegion( cacheName );
          admin.removeItem( cacheName, keys[i] );
      context.put( "elementInfoRecords", admin.buildElementInfo( cacheName ) );
      context.put( "cacheInfoRecords", admin.buildCacheInfo() );
origin: org.apache.tomee.patch/commons-jcs-core

/**
 * Create a test region and then verify that we get it from the list.
 *
 * @throws Exception
 *
 */
public void testGetRegionInfo()
  throws Exception
{
  String regionName = "myRegion";
  CacheAccess<String, String> cache = JCS.getInstance( regionName );
  cache.put( "key", "value" );
  JCSAdminBean admin = new JCSAdminBean();
  CacheRegionInfo[] regions = admin.buildCacheInfo();
  boolean foundRegion = false;
  for (CacheRegionInfo info : regions)
  {
    if ( info.getCacheName().equals( regionName ) )
    {
      foundRegion = true;
      assertTrue( "Byte count should be greater than 5.", info.getByteCount() > 5 );
      assertNotNull( "Should have stats.", info.getCacheStatistics() );
    }
  }
  assertTrue( "Should have found the region we just created.", foundRegion );
}
origin: org.apache.tomee.patch/commons-jcs-core

/**
 * Tries to estimate how much data is in a region. This is expensive. If there are any non serializable objects in
 * the region or an error occurs, suppresses exceptions and returns 0.
 * <p/>
 *
 * @return int The size of the region in bytes.
 */
@Override
public int getByteCount(String cacheName)
{
  return getByteCount(cacheHub.getCache(cacheName));
}
origin: org.apache.commons/commons-jcs-core

cache.getMissCountNotFound(),
cache.getMissCountExpired(),
getByteCount( cache ));
org.apache.commons.jcs.adminJCSAdminBean

Javadoc

A servlet which provides HTTP access to JCS. Allows a summary of regions to be viewed, and removeAll to be run on individual regions or all regions. Also provides the ability to remove items (any number of key arguments can be provided with action 'remove'). Should be initialized with a properties file that provides at least a classpath resource loader.

Most used methods

  • <init>
    Parameterized constructor
  • buildCacheInfo
    Builds up data on every region. TODO we need a most light weight method that does not count bytes. T
  • buildElementInfo
    Builds up info about each element in a region.
  • clearAllRegions
    Clears all regions in the cache. If this class is running within a remote cache server, clears all r
  • clearRegion
    Clears a particular cache region. If this class is running within a remote cache server, clears the
  • removeItem
    Removes a particular item from a particular region. If this class is running within a remote cache s
  • getByteCount
    Tries to estimate how much data is in a region. This is expensive. If there are any non serializable

Popular in Java

  • Reading from database using SQL prepared statement
  • getContentResolver (Context)
  • orElseThrow (Optional)
    Return the contained value, if present, otherwise throw an exception to be created by the provided s
  • putExtra (Intent)
  • HttpServer (com.sun.net.httpserver)
    This class implements a simple HTTP server. A HttpServer is bound to an IP address and port number a
  • URLConnection (java.net)
    A connection to a URL for reading or writing. For HTTP connections, see HttpURLConnection for docume
  • Semaphore (java.util.concurrent)
    A counting semaphore. Conceptually, a semaphore maintains a set of permits. Each #acquire blocks if
  • Pattern (java.util.regex)
    Patterns are compiled regular expressions. In many cases, convenience methods such as String#matches
  • JButton (javax.swing)
  • Options (org.apache.commons.cli)
    Main entry-point into the library. Options represents a collection of Option objects, which describ
  • Top plugins for WebStorm
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now