49 TestLibrary.getExtraProperty("jcov.sleep.multiplier","1"));
50 } catch (NumberFormatException ignore) {}
51 SAFE_WAIT_TIME = 60000 * slopFactor;
52 }
53
54 private static final String SYSTEM_NAME =
55 ActivationSystem.class.getName();
56
57 private static void mesg(Object mesg) {
58 System.err.println("ACTIVATION_LIBRARY: " + mesg.toString());
59 }
60
61 /**
62 * Deactivate an activated Activatable
63 */
64 public static void deactivate(Remote remote,
65 ActivationID id) {
66 // We do as much as 50 deactivation trials, each separated by
67 // at least 100 milliseconds sleep time (max sleep time of 5 secs).
68 final long deactivateSleepTime = 100;
69 for (int i = 0; i < 50; i ++) {
70 try {
71 if (Activatable.inactive(id) == true) {
72 mesg("inactive successful");
73 return;
74 } else {
75 mesg("inactive trial failed. Sleeping " +
76 deactivateSleepTime +
77 " milliseconds before next trial");
78 Thread.sleep(deactivateSleepTime);
79 }
80 } catch (InterruptedException e) {
81 Thread.currentThread().interrupt();
82 mesg("Thread interrupted while trying to deactivate activatable. Exiting deactivation");
83 return;
84 } catch (Exception e) {
85 try {
86 // forcibly unexport the object
87 mesg("Unexpected exception. Have to forcibly unexport the object." +
88 " Exception was :");
89 e.printStackTrace();
|
49 TestLibrary.getExtraProperty("jcov.sleep.multiplier","1"));
50 } catch (NumberFormatException ignore) {}
51 SAFE_WAIT_TIME = 60000 * slopFactor;
52 }
53
54 private static final String SYSTEM_NAME =
55 ActivationSystem.class.getName();
56
57 private static void mesg(Object mesg) {
58 System.err.println("ACTIVATION_LIBRARY: " + mesg.toString());
59 }
60
61 /**
62 * Deactivate an activated Activatable
63 */
64 public static void deactivate(Remote remote,
65 ActivationID id) {
66 // We do as much as 50 deactivation trials, each separated by
67 // at least 100 milliseconds sleep time (max sleep time of 5 secs).
68 final long deactivateSleepTime = 100;
69 long stopTime = System.currentTimeMillis() + deactivateSleepTime * 50;
70 while (System.currentTimeMillis() < stopTime) {
71 try {
72 if (Activatable.inactive(id) == true) {
73 mesg("inactive successful");
74 return;
75 } else {
76 mesg("inactive trial failed. Sleeping " +
77 deactivateSleepTime +
78 " milliseconds before next trial");
79 Thread.sleep(deactivateSleepTime);
80 }
81 } catch (InterruptedException e) {
82 Thread.currentThread().interrupt();
83 mesg("Thread interrupted while trying to deactivate activatable. Exiting deactivation");
84 return;
85 } catch (Exception e) {
86 try {
87 // forcibly unexport the object
88 mesg("Unexpected exception. Have to forcibly unexport the object." +
89 " Exception was :");
90 e.printStackTrace();
|