/** * Replaces the lateral cache service handle with the given handle and reset the queue by * starting up a new instance. * <p> * @param lateral */ public void fixCache( ICacheServiceNonLocal<K, V> lateral ) { cache.fixCache( lateral ); resetEventQ(); }
/** * No lateral invocation. * <p> * @return The size value */ @Override public int getSize() { return cache.getSize(); }
/** * No lateral invocation. * <p> * @return The cacheType value */ @Override public CacheType getCacheType() { return cache.getCacheType(); }
/** * Verify that we can remove an item. */ public void testAdd_InList() { // SETUP @SuppressWarnings("unchecked") LateralCacheNoWait<String, String>[] noWaits = new LateralCacheNoWait[0]; ILateralCacheAttributes cattr = new LateralCacheAttributes(); cattr.setCacheName( "testCache1" ); LateralCacheNoWaitFacade<String, String> facade = new LateralCacheNoWaitFacade<String, String>( null, noWaits, cattr ); LateralCache<String, String> cache = new LateralCache<String, String>( cattr ); LateralCacheNoWait<String, String> noWait = new LateralCacheNoWait<String, String>( cache ); // DO WORK facade.addNoWait( noWait ); facade.addNoWait( noWait ); // VERIFY assertTrue( "Should be in the list.", facade.containsNoWait( noWait ) ); assertEquals( "Should only have 1", 1, facade.noWaits.length ); }
/** * Verify that we can remove an item. */ public void testAddThenRemoveNoWait_NotInList() { // SETUP @SuppressWarnings("unchecked") LateralCacheNoWait<String, String>[] noWaits = new LateralCacheNoWait[0]; ILateralCacheAttributes cattr = new LateralCacheAttributes(); cattr.setCacheName( "testCache1" ); LateralCacheNoWaitFacade<String, String> facade = new LateralCacheNoWaitFacade<String, String>( null, noWaits, cattr ); LateralCache<String, String> cache = new LateralCache<String, String>( cattr ); LateralCacheNoWait<String, String> noWait = new LateralCacheNoWait<String, String>( cache ); // DO WORK facade.removeNoWait( noWait ); // VERIFY assertFalse( "Should not be in the list.", facade.containsNoWait( noWait ) ); } }
/** * Add a cache to be monitored * * @param cache the cache */ public void addCache(LateralCacheNoWait<?, ?> cache) { this.caches.put(cache.getCacheName(), cache); // if not yet started, go ahead if (this.getState() == Thread.State.NEW) { this.start(); } }
/** * Allows us to see if the facade is present and if it has the no wait. * <p> * @param cacheName - facades are for a region * @param noWait - is this no wait in the facade * @return do we contain the no wait. true if so */ public <K, V> boolean containsNoWait( String cacheName, LateralCacheNoWait<K, V> noWait ) { @SuppressWarnings("unchecked") // Need to cast because of common map for all facades LateralCacheNoWaitFacade<K, V> facade = (LateralCacheNoWaitFacade<K, V>)facades.get( noWait.getCacheName() ); if ( facade == null ) { return false; } return facade.containsNoWait( noWait ); }
/** * Gets the cacheName attribute of the LateralCacheNoWait object * <p> * @return The cacheName value */ @Override public String getCacheName() { return cache.getCacheName(); }
/** * @return Returns the AuxiliaryCacheAttributes. */ @Override public AuxiliaryCacheAttributes getAuxiliaryCacheAttributes() { return cache.getAuxiliaryCacheAttributes(); }
/** * Verify that we can remove an item. */ public void testAdd_InList() { // SETUP @SuppressWarnings("unchecked") LateralCacheNoWait<String, String>[] noWaits = new LateralCacheNoWait[0]; ILateralCacheAttributes cattr = new LateralCacheAttributes(); cattr.setCacheName( "testCache1" ); LateralCacheNoWaitFacade<String, String> facade = new LateralCacheNoWaitFacade<String, String>( null, noWaits, cattr ); LateralCache<String, String> cache = new LateralCache<String, String>( cattr ); LateralCacheNoWait<String, String> noWait = new LateralCacheNoWait<String, String>( cache ); // DO WORK facade.addNoWait( noWait ); facade.addNoWait( noWait ); // VERIFY assertTrue( "Should be in the list.", facade.containsNoWait( noWait ) ); assertEquals( "Should only have 1", 1, facade.noWaits.length ); }
/** * Verify that we can remove an item. */ public void testAddThenRemoveNoWait_NotInList() { // SETUP @SuppressWarnings("unchecked") LateralCacheNoWait<String, String>[] noWaits = new LateralCacheNoWait[0]; ILateralCacheAttributes cattr = new LateralCacheAttributes(); cattr.setCacheName( "testCache1" ); LateralCacheNoWaitFacade<String, String> facade = new LateralCacheNoWaitFacade<String, String>( null, noWaits, cattr ); LateralCache<String, String> cache = new LateralCache<String, String>( cattr ); LateralCacheNoWait<String, String> noWait = new LateralCacheNoWait<String, String>( cache ); // DO WORK facade.removeNoWait( noWait ); // VERIFY assertFalse( "Should not be in the list.", facade.containsNoWait( noWait ) ); } }
/** * Add a cache to be monitored * * @param cache the cache */ public void addCache(LateralCacheNoWait<?, ?> cache) { this.caches.put(cache.getCacheName(), cache); // if not yet started, go ahead if (this.getState() == Thread.State.NEW) { this.start(); } }
/** * Replaces the lateral cache service handle with the given handle and reset the queue by * starting up a new instance. * <p> * @param lateral */ public void fixCache( ICacheServiceNonLocal<K, V> lateral ) { cache.fixCache( lateral ); resetEventQ(); }
/** * No lateral invocation. * <p> * @return The size value */ @Override public int getSize() { return cache.getSize(); }
/** * No lateral invocation. * <p> * @return The cacheType value */ @Override public CacheType getCacheType() { return cache.getCacheType(); }
/** * Gets the cacheName attribute of the LateralCacheNoWait object * <p> * @return The cacheName value */ @Override public String getCacheName() { return cache.getCacheName(); }
/** * @return Returns the AuxiliaryCacheAttributes. */ @Override public AuxiliaryCacheAttributes getAuxiliaryCacheAttributes() { return cache.getAuxiliaryCacheAttributes(); }
/** * Verify that we can remove an item. */ public void testAddThenRemoveNoWait_InList() { // SETUP @SuppressWarnings("unchecked") LateralCacheNoWait<String, String>[] noWaits = new LateralCacheNoWait[0]; ILateralCacheAttributes cattr = new LateralCacheAttributes(); cattr.setCacheName( "testCache1" ); LateralCacheNoWaitFacade<String, String> facade = new LateralCacheNoWaitFacade<String, String>( null, noWaits, cattr ); LateralCache<String, String> cache = new LateralCache<String, String>( cattr ); LateralCacheNoWait<String, String> noWait = new LateralCacheNoWait<String, String>( cache ); // DO WORK facade.addNoWait( noWait ); // VERIFY assertTrue( "Should be in the list.", facade.containsNoWait( noWait ) ); // DO WORK facade.removeNoWait( noWait ); // VERIFY assertEquals( "Should have 0", 0, facade.noWaits.length ); assertFalse( "Should not be in the list. ", facade.containsNoWait( noWait ) ); }