3 public class JaceSession {
6 private static JaceSession Instance;
7 private/* static */Task taskObject = null;
8 private/* static */Thread taskThread = null;
11 private JaceSession() {
14 public static JaceSession Instance() {
15 if (Instance == null) {
16 Instance = new JaceSession();
21 // nettoie les files de comm si pas vides
22 public synchronized void init() {
23 // JaceBuffer.Instance().purge();
24 // MsgQueue.Instance().purge();
29 public synchronized void addTaskObject(Task obj) {
33 public synchronized Task getTaskObject() {
37 public void addTaskThread(Thread th) {
41 public Thread getTaskThread() {
45 @SuppressWarnings("deprecation")
46 public void deleteTaskThread() {
48 // not to put this because it crashes !!!!
49 // taskThread.yield();
50 // taskThread.interrupt();
51 System.out.println("I m going to kill the thread");
54 System.out.println("thread stopped without pb!!!!!!!");
56 } catch (Exception e) {
57 System.out.println("ERROR : thread not join : " + e);
58 System.out.println("I m going to kill the thread");
61 System.out.println("thread stopped after a problem !!!!!!!");
63 } catch (Exception e2) {
64 System.out.println("ERROR thread not killed : " + e);
70 // clean JaceBuffer, MsgQueue, Register
71 // and delete taskObject and taskThread
72 public synchronized void kill() {
73 // JaceBuffer.Instance().purge();
74 MsgQueue.Instance().purge();
76 Register.Instance().purge();
80 System.out.println("I SET MY TASK at NUULL");
82 System.out.println("Size of MsgQueue : "
83 + MsgQueue.Instance().getSize());