Package org.jboss.fresh.shell

Examples of org.jboss.fresh.shell.ShellConsoleInputStream


      }
    }

    sor.setBufferSize(bsizei);

    in = new BufferedInputStream(new ShellConsoleInputStream(sor));

    Thread t = new Thread() {
      public void run() {
        byte[] buf = new byte[512];
        try {

          while (true) {
            int rc = in.read(buf, 0, buf.length);
            while (rc != -1) {
              try {

//          log.debug(">>>> read");
                //System.out.write(buf, 0, rc);
                rc = in.read(buf, 0, buf.length);
//          log.debug("<<<< read");
              } catch (ShellIOException ex) {
                Throwable th = ex;
                log.debug("EXCEPTION: ", th);
/*
          while(th instanceof ShellIOException) {
            th=((ShellIOException)th).getRootThrowable();

            if(th!=null) {
              log.debug("Caused By: ");
              th.printStackTrace();
            }
          }

          while(th instanceof ApplicationIOException) {
            th=((ApplicationIOException)th).getRootThrowable();

            if(th!=null) {
              log.debug("Caused By: ");
              th.printStackTrace();
            }
          }
*/
                break;
//          log.debug("An application exception has occured: ");
//          ex.getRootThrowable().printStackTrace();
//        } catch(EOFException ex) {
//          break;
              } catch (Exception ex) {
                //ex.printStackTrace();
                log.debug("EXCEPTION from shell-stdin: ", ex);
                break;
              }
            }

//        log.debug("Reinitialized input from remote...");
            ShellObjectReader sor = new ShellObjectReader(shell2, "0");
            sor.setBufferSize(bsizei);
            in = new BufferedInputStream(new ShellConsoleInputStream(sor));
          }
        } catch (Throwable ex) {
          //ex.printStackTrace();
          log.debug("EXCEPTION from shell-stdin: ", ex);

View Full Code Here


  public void init() throws Exception {
    ctx = new InitialContext();
    home = (RemoteShellHome) ctx.lookup("ShellSession");
    shell = home.create(true);
    shell2 = home.create(shell.getSessionID(), true);
    in = new BufferedInputStream(new ShellConsoleInputStream(new ShellObjectReader(shell2, "0")));

    Thread t = new Thread() {
      public void run() {
        byte[] buf = new byte[512];
        try {

          while (true) {
            int rc = in.read(buf, 0, buf.length);
            while (rc != -1) {
              try {

//          System.out.println(">>>> read");
                //System.out.write(buf, 0, rc);
                rc = in.read(buf, 0, buf.length);
//          System.out.println("<<<< read");
              } catch (ShellIOException ex) {
                Throwable th = ex;
                log.error("EXCEPTION: ",th);
               
                break;
//          System.out.println("An application exception has occured: ");
//          ex.getRootThrowable().printStackTrace();
//        } catch(EOFException ex) {
//          break;
              } catch (Exception ex) {
                //ex.printStackTrace();
                log.error("An exception has occured while reading from shell-stdin: " ,ex);
                break;
              }
            }

//        System.out.println("Reinitialized input from remote...");
            in = new BufferedInputStream(new ShellConsoleInputStream(new ShellObjectReader(shell2, "0")));
          }
        } catch (Throwable ex) {
          //ex.printStackTrace();
          log.error("An exception has occured while reading from shell-stdin:\n" ,ex);
View Full Code Here

TOP

Related Classes of org.jboss.fresh.shell.ShellConsoleInputStream

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.