@Override
    public void run() {

        Wrapper obj;
        synchronized (this) {
            while (true) {                
                if (que.isEmpty()) {
                    try {
                        System.out.println("start to wait");
                        wait();
                    } catch (InterruptedException ex) {
                        ex.printStackTrace();
                        Logger.getLogger(CallbackProxy.class.getName()).log(Level.SEVERE, null, ex);
                    }                   
                }
                System.out.println("get notify");
                obj = que.remove(0);
                switch (obj.getType()) {
                    case PRE_CHAIN:
                        callback.preToolChain((ToolChain) obj.getObj());
                        break;
                    case AFTER_CHAIN:
                        callback.afterToolChain((ToolChain) obj.getObj());
                        break;
                    case PRE_SCRIPT:
                        callback.preToolScript((ToolScript) obj.getObj());
                        break;
                    case AFTER_SCRIPT:
                        callback.afterToolScript((ToolScript) obj.getObj());
                         que.clear();
                        return;
                    case FINISHED:
                       callback.finished((ToolScript) obj.getObj(), (Status) obj.getObj1());
                       
                        break;
                    case PROGRESS:
                        callback.setProgress((int) obj.getObj());
                        break;
                    default:
                        Logger.getLogger(CallbackProxy.class.getName()).log(Level.SEVERE, "unkown type");
                }
            }
        }

    }