/** * A test to check whether the cache is in its started state. If not, calls should not be made as the channel may * not have properly started, blocks due to state transfers may be in progress, etc. * * @return true if the cache is in its STARTED state. */ protected boolean isCacheReady() { return cache.getCacheStatus() == CacheStatus.STARTED; }
/** * Checks field modifications via setters * * @param fieldName */ protected void testImmutability(String fieldName) { try { if (!accessible && cache != null && cache.getCacheStatus() != null && cache.getCacheStatus() == CacheStatus.STARTED && !getClass().getDeclaredField(fieldName).isAnnotationPresent(Dynamic.class)) { throw new ConfigurationException("Attempted to modify a non-Dynamic configuration element [" + fieldName + "] after the cache has started!"); } } catch (NoSuchFieldException e) { log.warn("Field " + fieldName + " not found!!"); } finally { accessible = false; } }
/** * Registers the cache's MBean resources, if {@link #getRegisterJmxResource()} * is <code>true</code>. */ public void postRegister(Boolean registrationDone) { if (Boolean.TRUE.equals(registrationDone)) { log.debug("Registered in JMX under " + cacheObjectName); if (cache != null && CacheStatus.STARTED.equals(cache.getCacheStatus())) { try { registerJmxResources(); } catch (Exception e) { log.error("Caught exception registering cache ResourcesDMBean with JMX", e); } } registered = true; } }
if (cache.getCacheStatus() == CacheStatus.DESTROYED)
public void getState(ObjectOutputStream out, Fqn fqn, long timeout, boolean force, boolean suppressErrors) throws Exception boolean canProvideState = cache.getCacheStatus().allowInvocations() && !regionManager.isInactive(fqn) && cache.peek(fqn, false) != null; if (trace) log.trace("Can provide state? " + canProvideState); if (!cache.getCacheStatus().allowInvocations()) exceptionMessage = " [Cache is not in the correct status]";