/** Signal that the membershipFailure is complete. */ public static void signalMembershipFailureComplete() { Log.getLogWriter() .info( "ControllerBB: signaling membership failure complete for vmID " + RemoteTestModule.getMyVmid()); String key = ControllerBB.MembershipFailureCompleteKey + RemoteTestModule.getMyVmid(); ControllerBB.getBB().getSharedMap().put(key, new Long(System.currentTimeMillis())); }
/** Get the value of the shared map counter for this vm. */ public static int getMapCounter(String keyBase) { String key = keyBase + RemoteTestModule.getMyVmid(); Object value = ControllerBB.getBB().getSharedMap().get(key); if (value == null) { return 0; } else { int intVal = ((Integer) value).intValue(); return intVal; } }
/** * Create a region with the given region description name. * * @param regDescriptName The name of a region description. */ protected void initializeRegion(String regDescriptName) { CacheHelper.createCache("cache1"); String key = VmIDStr + RemoteTestModule.getMyVmid(); String xmlFile = key + ".xml"; try { CacheHelper.generateCacheXmlFile("cache1", regDescriptName, xmlFile); } catch (HydraRuntimeException e) { if (e.toString().indexOf("Cache XML file was already created") >= 0) { // this can occur when reinitializing after a stop-start because // the cache xml file is written during the first init tasks } else { throw new TestException(TestHelper.getStackTrace(e)); } } aRegion = RegionHelper.createRegion(regDescriptName); }
/** * Atomically increment a counter in the ControllerBB sharedMap. * * @param keyBase A string from ControllerBB that prefixes a vm id to use as a key in the * ControllerBB shared map. The VM id used is the current vm's id. */ public static void incMapCounter(String keyBase) { String key = keyBase + RemoteTestModule.getMyVmid(); Log.getLogWriter().info("Incrementing sharedMap counter " + key); SharedLock slock = ControllerBB.getBB().getSharedLock(); slock.lock(); try { int newValue = 0; Object value = ControllerBB.getBB().getSharedMap().get(key); if (value == null) { newValue = 1; } else { newValue = ((Integer) value).intValue() + 1; } ControllerBB.getBB().getSharedMap().put(key, new Integer(newValue)); Log.getLogWriter().info("Incremented sharedMap counter, count is now " + newValue); } finally { slock.unlock(); } }
/** Return whether this vm is ready for initialization. */ public static boolean isReadyForInit() { return isReadyForInit(RemoteTestModule.getMyVmid()); }
/** Enable sickness for the current vm */ public static void enableSickness() { enableSickness(RemoteTestModule.getMyVmid()); }
/** Return whether the current vm has received a severe alert. */ public static boolean receivedSevereAlert() { return receivedSevereAlert(RemoteTestModule.getMyVmid()); }
/** Wait for the current vm to recognize a severe alert. */ public static void waitForSevereAlert() { waitForSevereAlert(RemoteTestModule.getMyVmid()); }
/** Wait for the current vm to become dead. */ public static void waitForIsDead() { waitForIsDead(RemoteTestModule.getMyVmid()); }
/** Signal that a severe alert occurred in the current vm. */ public static void signalSevereAlert() { signalSevereAlert(RemoteTestModule.getMyVmid()); }
/** Return whether the current vm is enabled for being dead. */ public static boolean isPlayDeadEnabled() { String key = ControllerBB.EnableDeadKey + RemoteTestModule.getMyVmid(); return ControllerBB.getBB().getSharedMap().containsKey(key); }
/** Signal that the current vm is dead. */ public static void signalIsDead() { signalIsDead(RemoteTestModule.getMyVmid()); }
/** Enable slow listeners for the current vm */ public static void enableSlowListener() { enableSlowListener(RemoteTestModule.getMyVmid()); }
/** Signal that this vm is ready for intialization. */ public static void signalReadyForInit() { signalReadyForInit(RemoteTestModule.getMyVmid()); }
/** Wait for membership failure to complete. */ public static void waitMembershipFailureComplete() { waitMembershipFailureComplete(RemoteTestModule.getMyVmid()); }
/** Return whether membership failure is complete for this vm. */ public static boolean isMembershipFailureComplete() { String key = ControllerBB.MembershipFailureCompleteKey + RemoteTestModule.getMyVmid(); return ControllerBB.getBB().getSharedMap().containsKey(key); }
/** Return the currentTimeMillis value of when membership failure completed */ public static long getMembershipFailureCompletionTime() { String key = ControllerBB.MembershipFailureCompleteKey + RemoteTestModule.getMyVmid(); return ((Long) (ControllerBB.getBB().getSharedMap().get(key))).longValue(); }
/** Signal that initialization for this VM is complete. */ public static void signalInitIsComplete() { signalInitIsComplete(RemoteTestModule.getMyVmid()); }
/** Wait for the current vm to complete initialization */ public static void waitForInitialization() { waitForInitialization(RemoteTestModule.getMyVmid()); }
/** Enable becoming dead for the current vm */ public static void enablePlayDead() { enablePlayDead(RemoteTestModule.getMyVmid()); }
/** Return whether slow listeners are enabled for the current vm. */ public static boolean isSlowListenerEnabled() { String key = ControllerBB.EnableSlowListenerKey + RemoteTestModule.getMyVmid(); return ControllerBB.getBB().getSharedMap().containsKey(key); }