Package org.jboss.fresh.io

Examples of org.jboss.fresh.io.BufferImpl


    try {
      ec.registerEventNetRouter(agentid, this);
    } catch (Exception ex) {
      log.error("Internal Event System error: failed to register EventNetRouter for " + agentid + " : " + hostLabel + "/" + app, ex);
    }
    outgoink = new BufferImpl();
    outgoink.setMaxSize(1000);
    lis = new ECentralListener(ec.generateID());
    String origin = echost + "/" + ecapp + "/EventNetRouter_" + hostLabel + "_" + app + "(" + lis.getID() + ")";
    try {
      // this event listener must be hidden - it's part of infrastructure and should only be used locally
View Full Code Here


    //shellin.setMaxSize(STD_BUF_SIZE);

    if (interactive) {
      ProcessGroup stdproc = new ProcessGroup(STDINPROC_ID, null, null);

      shellout = new BufferImpl();
      // CAREFUL HERE: If you print too much to out at the very beginning - in terms of objects
      // you will deadlock
      //shellout.setMaxSize(1);
      shellout.setMaxSize(20);
      stdproc.setOutputBuffer(shellout);
View Full Code Here

      if (in == null) {
//log.debug("No output redirect setup...");
        if (hasin) {
          if (!"SINGLE".equals(getEnvProperty("TMODE"))) {
            in = new BufferImpl();
          } else {
            in = new MemFileBufferImpl();
          }
          // here we set whatever is maxsize for inputbuffer for this executable - we have this set
          // as attribute on the file or something ...
          // FIXME
          List input = cmdl.getStdInput();
          if(input != null) {
            in.setMaxSize(input.size());
            try {
              ((Buffer)in).putBuffer(new LinkedList(input), 1000);
              in.close();
            } catch (IOException ex) {
              throw new ShellException("Exception occured while initializing input buffer: " + ex.toString());
            }
          }
          in.setMaxSize(inbufmax); // should be a variable

        } else {
          in = new NullBuffer();
        }
      }

    } else {
//log.debug("Piping in previous out...");
      Object o_in = ((Process) joblist.getLast()).getOutputBuffer();
      if (!(o_in instanceof InBuffer)) {
        throw new ShellException("Invalid pipe chain. Trying to read from write-only buffer.");
      }
      in = (InBuffer) o_in;
    }

//log.debug("\n\nin = " + in);

    OutBuffer out = null;

    if (cmdl.size() == joblist.size() + 1) {

      if (cmdl.getSLStdOutRedir() != null) {
        try {
          OutputStreamBuffer bout = new OutputStreamBuffer(new FileOutputStream(cmdl.getSLStdOutRedir(), cmdl.getSLAppend()), cmdl.isSLOutObjMode());
          bout.setProperties(env);
          out = bout;
          p.setRedirected(true);
        } catch (IOException ex) {
          throw new ShellException("Exception occured while initializing output buffer: " + ex.toString());
        }

      } else if (cmdl.getStdOutRedir() != null) {
        try {
          ////out=new OutputStreamBuffer(new VFSOutputStream(new SecureVFS(vfs, uctx), cmdl.getStdOutRedir(), cmdl.getAppend()), cmdl.isOutObjMode());

          //if(TxSupport.isActive()) throw new ShellException("Illegal state - inside transaction.");
          //TxSupport.begin();
          try {
            FileName fname = new FileName(cmdl.getStdOutRedir());
            if (fname.isRelative()) {
              fname = new FileName(getEnvProperty("PWD")).absolutize(fname);
            }
            OutputStreamBuffer bout = new OutputStreamBuffer(new LazyVFSOutputStream(new SecureVFS(vfs, uctx), fname.toString(), cmdl.getAppend()), cmdl.isOutObjMode());
            bout.setProperties(env);
            out = bout;
            p.setRedirected(true);
            //TxSupport.commit();
          } catch (Exception ex) {
            //TxSupport.rollback();
            throw ex;
          }
        } catch (Exception ex) {
          log.error("Exception occured while initializing output buffer: ", ex);
          throw new ShellException("Exception occured while initializing output buffer: " + ex.toString());
        }
      }
    }
//log.debug("\n\nout = " + out);
    if (out == null) {
      if (hasout) {
        if (!"SINGLE".equals(getEnvProperty("TMODE"))) {
          out = new BufferImpl();
        } else {
          out = new MemFileBufferImpl();
        }
       
        // here we set whatever is maxsize for inputbuffer for this executable - we have this set
View Full Code Here

TOP

Related Classes of org.jboss.fresh.io.BufferImpl

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.