Package sisc

Examples of sisc.AppContext


    synchronized (httpContext) {
      siscContext = (AppContext)httpContext.getAttribute(REPLGenericServlet.appCtxAttrName);

      if (siscContext == null) {
        siscContext = new AppContext();
        httpContext.setAttribute(REPLGenericServlet.appCtxAttrName, siscContext);

        interPool = new ArrayList();
        Interpreter interp = getInterpreter();
View Full Code Here


    synchronized(interPool) {
      if (!interPool.empty())
        return (Interpreter)interPool.pop();

      // Create a new interpreter and return it
      AppContext ctx = (AppContext)servletContext.getAttribute(appCtxAttrName);
      DynamicEnv environment = new DynamicEnv(System.in, System.out);
      Interpreter interp = new Interpreter(ctx, environment);
      return interp;
    }
  }
View Full Code Here

    interPool = new Stack();

    Interpreter interp;

    synchronized (servletContext) {
      AppContext ctx = (AppContext)servletContext.getAttribute(appCtxAttrName);

      if (ctx == null) {
        ctx = new AppContext();
        servletContext.setAttribute(appCtxAttrName, ctx);

        interp = getInterpreter();
        // Read the heap file
        String realPath = servletContext.getRealPath("/");
        String heapFileName = realPath + config.getInitParameter("heap");
        System.out.println("loading heap " + heapFileName);
        File heapFile = new File(heapFileName);

        try {
          FileInputStream fis = new FileInputStream(heapFileName);
          BufferedInputStream bis
            = new BufferedInputStream(fis, (int)heapFile.length());
          GZIPInputStream gzis = new GZIPInputStream(bis);
          DataInputStream dis
            = new DataInputStream(new BufferedInputStream(gzis));
          ctx.loadEnv(interp, dis);
     
        } catch (IOException ex) {
          System.err.println("Error loading heap:" + ex);
          ex.printStackTrace();
          throw new ServletException(ex);
        }

        ctx.setEvaluator("eval");
      }
      else {
        interp = getInterpreter();
      }     
    }
View Full Code Here

    synchronized (httpContext) {
      siscContext = (AppContext)httpContext.getAttribute(REPLGenericServlet.appCtxAttrName);

      if (siscContext == null) {
        siscContext = new AppContext();
        httpContext.setAttribute(REPLGenericServlet.appCtxAttrName, siscContext);

        interPool = new ArrayList();
        Interpreter interp = getInterpreter();
View Full Code Here

    interPool = new Stack();

    Interpreter interp;

    synchronized (servletContext) {
      AppContext ctx = (AppContext)servletContext.getAttribute(appCtxAttrName);

      if (ctx == null) {
        ctx = new AppContext();
        servletContext.setAttribute(appCtxAttrName, ctx);

        interp = getInterpreter();
        // Read the heap file
        String realPath = servletContext.getRealPath("/");
        String heapFileName = realPath + config.getInitParameter("heap");
        System.out.println("loading heap " + heapFileName);
        File heapFile = new File(heapFileName);

        try {
          FileInputStream fis = new FileInputStream(heapFileName);
          BufferedInputStream bis
            = new BufferedInputStream(fis, (int)heapFile.length());
          GZIPInputStream gzis = new GZIPInputStream(bis);
          DataInputStream dis
            = new DataInputStream(new BufferedInputStream(gzis));
          ctx.loadEnv(interp, dis);
     
        } catch (IOException ex) {
          System.err.println("Error loading heap:" + ex);
          ex.printStackTrace();
          throw new ServletException(ex);
        }

        ctx.setEvaluator("eval");
      }
      else {
        interp = getInterpreter();
      }     
    }
View Full Code Here

    synchronized(interPool) {
      if (!interPool.empty())
        return (Interpreter)interPool.pop();

      // Create a new interpreter and return it
      AppContext ctx = (AppContext)servletContext.getAttribute(appCtxAttrName);
      DynamicEnv environment = new DynamicEnv(System.in, System.out);
      Interpreter interp = new Interpreter(ctx, environment);
      return interp;
    }
  }
View Full Code Here

  {
    String heapFileName = confs.getAttribute("heap", null);
    if (heapFileName == null)
      throw new ConfigurationException("Heap Scheme file not specified");

    siscContext = new AppContext();

    interPool = new ArrayList();
    sisc.Interpreter interp = getInterpreter();

    try {
View Full Code Here

TOP

Related Classes of sisc.AppContext

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.