/** * Gets the status attribute of the RemoteCacheNoWaitFacade object * <p> * Return ALIVE if any are alive. * <p> * @return The status value */ @Override public CacheStatus getStatus() { for (RemoteCacheNoWait<K, V> nw : noWaits) { if ( nw.getStatus() == CacheStatus.ALIVE ) { return CacheStatus.ALIVE; } } return CacheStatus.DISPOSED; }
/** * Gets the status attribute of the RemoteCacheNoWaitFacade object * <p> * Return ALIVE if any are alive. * <p> * @return The status value */ @Override public CacheStatus getStatus() { for ( int i = 0; i < noWaits.length; i++ ) { if ( noWaits[i].getStatus() == CacheStatus.ALIVE ) { return CacheStatus.ALIVE; } } return CacheStatus.DISPOSED; }
/** * Fixes up all the caches managed by this cache manager. */ public void fixCaches() { if ( !canFix ) { return; } if ( log.isInfoEnabled() ) { log.info( "Fixing caches. ICacheServiceNonLocal " + remoteService + " | IRemoteCacheObserver " + remoteWatch ); } for (RemoteCacheNoWait<?, ?> c : caches.values()) { if (c.getStatus() == CacheStatus.ERROR) { c.fixCache( remoteService ); } } if ( log.isInfoEnabled() ) { String msg = "Remote connection to " + registry + " resumed."; if ( cacheEventLogger != null ) { cacheEventLogger.logApplicationEvent( "RemoteCacheManager", "fix", msg ); } log.info( msg ); } }
/** * @return statistics about this communication */ @Override public IStats getStatistics() { IStats stats = new Stats(); stats.setTypeName( "Remote Cache No Wait" ); ArrayList<IStatElement<?>> elems = new ArrayList<IStatElement<?>>(); elems.add(new StatElement<CacheStatus>( "Status", getStatus() ) ); // get the stats from the cache queue too IStats cStats = this.remoteCacheClient.getStatistics(); if ( cStats != null ) { elems.addAll(cStats.getStatElements()); } // get the stats from the event queue too IStats eqStats = this.cacheEventQueue.getStatistics(); elems.addAll(eqStats.getStatElements()); elems.add(new StatElement<Integer>( "Get Count", Integer.valueOf(this.getCount) ) ); elems.add(new StatElement<Integer>( "GetMatching Count", Integer.valueOf(this.getMatchingCount) ) ); elems.add(new StatElement<Integer>( "GetMultiple Count", Integer.valueOf(this.getMultipleCount) ) ); elems.add(new StatElement<Integer>( "Remove Count", Integer.valueOf(this.removeCount) ) ); elems.add(new StatElement<Integer>( "Put Count", Integer.valueOf(this.putCount) ) ); stats.setStatElements( elems ); return stats; }
/** * @return statistics about this communication */ @Override public IStats getStatistics() { IStats stats = new Stats(); stats.setTypeName( "Remote Cache No Wait" ); ArrayList<IStatElement<?>> elems = new ArrayList<IStatElement<?>>(); elems.add(new StatElement<CacheStatus>( "Status", getStatus() ) ); // get the stats from the cache queue too IStats cStats = this.remoteCacheClient.getStatistics(); if ( cStats != null ) { elems.addAll(cStats.getStatElements()); } // get the stats from the event queue too IStats eqStats = this.cacheEventQueue.getStatistics(); elems.addAll(eqStats.getStatElements()); elems.add(new StatElement<Integer>( "Get Count", Integer.valueOf(this.getCount) ) ); elems.add(new StatElement<Integer>( "GetMatching Count", Integer.valueOf(this.getMatchingCount) ) ); elems.add(new StatElement<Integer>( "GetMultiple Count", Integer.valueOf(this.getMultipleCount) ) ); elems.add(new StatElement<Integer>( "Remove Count", Integer.valueOf(this.removeCount) ) ); elems.add(new StatElement<Integer>( "Put Count", Integer.valueOf(this.putCount) ) ); stats.setStatElements( elems ); return stats; }
if ( c.getStatus() == CacheStatus.ERROR )
if ( noWaits[i].getStatus() == CacheStatus.ERROR )
if ( rcnw.getStatus() == CacheStatus.ERROR )
if ( facade.getPrimaryServer() != null && facade.getPrimaryServer().getStatus() == CacheStatus.ALIVE )
if ( facade.noWaits[0] != null && facade.noWaits[0].getStatus() == CacheStatus.ALIVE )
/** * Simply verify that we get a status of error if the cache is in error.. * <p> * @throws Exception */ public void testGetStatus_error() throws Exception { // SETUP MockRemoteCacheClient<String, String> client = new MockRemoteCacheClient<String, String>(); client.status = CacheStatus.ERROR; RemoteCacheNoWait<String, String> noWait = new RemoteCacheNoWait<String, String>( client ); // DO WORK CacheStatus result = noWait.getStatus(); // VERIFY assertEquals( "Wrong status", CacheStatus.ERROR, result ); }
/** * Simply verify that we get a status of error if the cache is in error.. * <p> * @throws Exception */ public void testGetStatus_error() throws Exception { // SETUP MockRemoteCacheClient<String, String> client = new MockRemoteCacheClient<String, String>(); client.status = CacheStatus.ERROR; RemoteCacheNoWait<String, String> noWait = new RemoteCacheNoWait<String, String>( client ); // DO WORK CacheStatus result = noWait.getStatus(); // VERIFY assertEquals( "Wrong status", CacheStatus.ERROR, result ); }