コード例 #1
0
  private void cleanUp(boolean shutdown, String message) {
    try {
      sr.done();
    } catch (ShutdownException se) {
      // Nothing to do at this point, we're already shutting down
    }

    if (niagara.connection_server.NiagraServer.TIME_OPERATORS) {
      cpuTimer.stop();
      cpuTimer.print(getName() + "(shutdown: " + message + ")");
    }

    try {
      if (!shutdown) outputStream.endOfStream();
      else
        // REFACTOR
        outputStream.putCtrlMsg(ControlFlag.SHUTDOWN, message);
    } catch (java.lang.InterruptedException ie) {
      /* do nothing */
    } catch (ShutdownException se) {
      /* do nothing */
    }

    outputStream = null;
    sr = null;
    return;
  }
コード例 #2
0
  /** Thread run method */
  public void run() {
    if (NiagraServer.RUNNING_NIPROF) JProf.registerThreadName(this.getName());

    if (NiagraServer.TIME_OPERATORS) {
      cpuTimer = new CPUTimer();
      cpuTimer.start();
    }

    boolean shutdown = false;
    String message = "normal";

    try {
      sr = new SAXDOMReader(dm.getInputStreamFor(resource));
      sr.readDocuments(outputStream);
    } catch (SAXException saxE) {
      System.err.println(
          "StreamThread::SAX exception parsing document. Message: " + saxE.getMessage());
      shutdown = true;
      message = "SAX Exception " + saxE.getMessage();
    } catch (java.io.IOException ioe) {
      System.err.println("StreamThread::IOException. Message: " + ioe.getMessage());
      shutdown = true;
      message = "StreamThread::IOException " + ioe.getMessage();
    } catch (ShutdownException se) {
      System.err.println("StreamThread::ShutdownException. Message " + se.getMessage());
      shutdown = true;
      message = se.getMessage();
    }

    cleanUp(shutdown, message);
    return;
  }