+ /**
+ * This method sets a flag to indicate that this thread must be killed. End user must use static method kill
+ *
+ * @return
+ *
+ */
+ public void nativeStop()
+ {
+ nativeStop = true;
+ }
+ /**
+ * getter for the flag that indicates that this thread must be killed
+ *
+ * @return
+ *
+ */
+ public boolean getNativeStop()
+ {
+ return nativeStop;
+ }
+ /**
+ * checks if the flag that indicates that this thread must be killed is set to true; if true, starts to kill it. End users should not have to deal with it
+ * If you develop a new MSG native call, please include a call to interruptedStop() at the beginning of your method code, so as the process can be killed if he call
+ * your method.
+ *
+ * @return
+ *
+ */
+ public static void ifInterruptedStop() {
+ if ( (Thread.currentThread() instanceof Process) &&((Process) Thread.currentThread()).getNativeStop()) {
+ throw new RuntimeException("Interrupted");
+ }
+ }
+