예제 #1
0
  public void updateStates() {
    NumberFormat nf = NumberFormat.getInstance();
    nf.setMaximumFractionDigits(2);
    nf.setMinimumFractionDigits(2);

    try {
      // System.out.println("getting variables.");
      status = cryo.cryoGetStatusCORBA();
      frame.lblStatus.setText(statusString[status] + " ");
      heater = cryo.cryoGetHeaterCORBA();
      frame.lblHeater.setText(nf.format(heater) + " watts");
      temp = cryo.cryoGetTempCORBA();
      frame.lblTemp.setText(nf.format(temp) + " deg");
      cli = cryo.cryoGetCliCORBA();
      if (Double.isNaN(cli)) {
        frame.lblCli.setText(cli + " ");
      } else frame.lblCli.setText(nf.format(cli) + " ");

    } catch (org.omg.CORBA.COMM_FAILURE cf) {
      // stop thread and try to reconnect to the server
      frame.lblStatus.setText("FAILURE!! Server connected?");
      stop = true;
      return;
    }
  }
예제 #2
0
  public CryoBay reconnectServer(ORB o, ReconnectThread rct) {

    BufferedReader reader;
    File file;
    ORB orb;
    org.omg.CORBA.Object obj;

    orb = o;

    obj = null;
    cryoB = null;

    try {
      // instantiate ModuleAccessor
      file = new File("/vnmr/acqqueue/cryoBay.CORBAref");
      if (file.exists()) {
        reader = new BufferedReader(new FileReader(file));
        obj = orb.string_to_object(reader.readLine());
      }

      if (obj != null) {
        cryoB = CryoBayHelper.narrow(obj);
      }

      if (cryoB != null) {
        if (!(cryoB._non_existent())) {
          // System.out.println("reconnected!!!!");
          rct.reconnected = true;
        }
      }
    } catch (Exception e) {
      // System.out.println("Got error: " + e);
    }
    return cryoB;
  }
예제 #3
0
  public ClientGui(ORB o) throws Exception {
    ShutdownFrame sf;
    BufferedReader reader;
    boolean modulePresent;
    File file;
    CryoThread update;

    orb = o;

    obj = null;
    cryoBay = null;

    // System.out.println("running test client.");

    // instantiate ModuleAccessor
    file = new File("/vnmr/acqqueue/cryoBay.CORBAref");
    if (file.exists()) {
      reader = new BufferedReader(new FileReader(file));
      obj = orb.string_to_object(reader.readLine());
    }

    if (obj == null) {
      throw new Exception("string_to_object is null: cryoBay.CORBAref");
    }

    // System.out.println("Got object.");

    cryoBay = CryoBayHelper.narrow(obj);

    if (cryoBay == null) {
      throw new Exception("cryoBay is null");
    }

    if (cryoBay._non_existent()) {
      throw new Exception("cryoBay is not running");
    }

    sf = new ShutdownFrame(cryoBay);
    update = new CryoThread(cryoBay, sf, this);
    sf.show();
    update.start();
  } /*end of constructor*/