Exemplo n.º 1
0
 /** 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()));
 }
Exemplo n.º 2
0
 /** 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;
   }
 }
Exemplo n.º 3
0
 /**
  * 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);
 }
Exemplo n.º 4
0
 /**
  * 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();
   }
 }
Exemplo n.º 5
0
 /** Return whether this vm is ready for initialization. */
 public static boolean isReadyForInit() {
   return isReadyForInit(RemoteTestModule.getMyVmid());
 }
Exemplo n.º 6
0
 /** Enable sickness for the current vm */
 public static void enableSickness() {
   enableSickness(RemoteTestModule.getMyVmid());
 }
Exemplo n.º 7
0
 /** Return whether the current vm has received a severe alert. */
 public static boolean receivedSevereAlert() {
   return receivedSevereAlert(RemoteTestModule.getMyVmid());
 }
Exemplo n.º 8
0
 /** Wait for the current vm to recognize a severe alert. */
 public static void waitForSevereAlert() {
   waitForSevereAlert(RemoteTestModule.getMyVmid());
 }
Exemplo n.º 9
0
 /** Wait for the current vm to become dead. */
 public static void waitForIsDead() {
   waitForIsDead(RemoteTestModule.getMyVmid());
 }
Exemplo n.º 10
0
 /** Signal that a severe alert occurred in the current vm. */
 public static void signalSevereAlert() {
   signalSevereAlert(RemoteTestModule.getMyVmid());
 }
Exemplo n.º 11
0
 /** 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);
 }
Exemplo n.º 12
0
 /** Signal that the current vm is dead. */
 public static void signalIsDead() {
   signalIsDead(RemoteTestModule.getMyVmid());
 }
Exemplo n.º 13
0
 /** Enable slow listeners for the current vm */
 public static void enableSlowListener() {
   enableSlowListener(RemoteTestModule.getMyVmid());
 }
Exemplo n.º 14
0
 /** Signal that this vm is ready for intialization. */
 public static void signalReadyForInit() {
   signalReadyForInit(RemoteTestModule.getMyVmid());
 }
Exemplo n.º 15
0
 /** Wait for membership failure to complete. */
 public static void waitMembershipFailureComplete() {
   waitMembershipFailureComplete(RemoteTestModule.getMyVmid());
 }
Exemplo n.º 16
0
 /** 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);
 }
Exemplo n.º 17
0
 /** 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();
 }
Exemplo n.º 18
0
 /** Signal that initialization for this VM is complete. */
 public static void signalInitIsComplete() {
   signalInitIsComplete(RemoteTestModule.getMyVmid());
 }
Exemplo n.º 19
0
 /** Wait for the current vm to complete initialization */
 public static void waitForInitialization() {
   waitForInitialization(RemoteTestModule.getMyVmid());
 }
Exemplo n.º 20
0
 /** Enable becoming dead for the current vm */
 public static void enablePlayDead() {
   enablePlayDead(RemoteTestModule.getMyVmid());
 }
Exemplo n.º 21
0
 /** 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);
 }