public void run(){
        try{
            Message assignCmd = new Message(msgType.COMMAND);
            assignCmd.setCommandId(CommandType.ASSIGNID);
            assignCmd.setWorkerID(workerId);
            sendToWorker(assignCmd);
            
            Message workerMessage;
            System.out.println("managerServer for worker "+workerId+"running");
            while(running){
                
                try{
                    workerMessage = (Message) objInput.readObject();
                }catch(ClassNotFoundException e){
                    continue;
                }
                if(workerMessage.getResponseId() != ResponseType.PULLINFORES)
                    System.out.println("worker message received: id "+workerMessage.getResponseId());
                
                switch(workerMessage.getResponseId()){
                    case STARTRES:
                        handleStartRes(workerMessage);
                    
                        break;
                    case MIGARATESOURCERES:
                        handleMigrateSourceRes(workerMessage);
                        break;
                    case MIGRATETARGETRES:
                        hanleMigrateTargetRes(workerMessage);
                        break;
                    case KILLRES:
                        handleKillRes(workerMessage);
                        break;
                    case PULLINFORES:
                        handleWorkerInfoReport(workerMessage);
                        break;
                    default:
                        System.out.println("unrecagnized message");
                }
            }
            objInput.close();
            objOutput.close();
        }catch(IOException e){
            
        }
    }