예제 #1
0
  public void checkSlave() throws IOException, ClassNotFoundException {
    ServerSocket listener = null;
    Socket socket;
    ObjectInputStream in = null;

    try {
      // 1. creating a server socket
      listener = new ServerSocket(15440);

      while (true) {

        // 2. wait for connection
        //				System.out.println("Waiting for checkSlave");
        socket = listener.accept();

        // 3.read object from inputstream
        in = new ObjectInputStream(socket.getInputStream());
        SlaveBean slave = (SlaveBean) in.readObject();
        slaveList.put(slave, slave.getCurCount());
      }
    } catch (IOException e) {
      e.printStackTrace();
    } finally {
      // 4.close connection
      in.close();
      listener.close();
    }
  }
예제 #2
0
 public void migrateProcessBest(MigratableProcess process) {
   SlaveBean bestSlave = getBestSlave();
   migrateProcess(bestSlave.getHost(), bestSlave.getPort(), process);
 }