Package center.task.prm

Examples of center.task.prm.IDependentParam


    public void processing(String fullname) throws Throwable {
      boolean db = true;
      boolean cache = false;
      String gl_name = "prm." + fullname;
      Object o = info.prms.get(fullname);
      IDependentParam p = null;
      boolean log = true;
      if (o != null && o instanceof IDependentParam) {
        p = (IDependentParam) o;
        db = !p.isNonDB();
        cache = p.isCache();
        log = p.getLog();
      }
      Object result = null;
      try {
        // Проверить кэшируемость параметра
        if (cache) {
          synchronized (sync_eval) {
            result = prms_eval.get(gl_name);
            // Если расчёт не производился, получить новый буфер для расчёта
            //System.out.println("001 ::: " + fullname);
            if (result == null) {
              //System.out.println("002 ::: " + fullname);
              prms_eval.put(gl_name, this);
            }
          }
          if (result != null) {
            if (log)
              Context.this.log(false, "ASYNC:", gl_name, "(CACHE)=", result);
            // System.out.println(Context.this.ta.getAlias() + " : " +
            // Context.this.id_task + " : ASYNC:" + gl_name + "(CACHE)=" +
            // result);
            if (!result.equals(this)) {
              retValue(result);
              //System.out.println("003 ::: " + fullname);
              return;
            }
            result = this.getValueIm();
            if (result != null) {
              return;
            }
          }
        }
        // Если не запрещено из базы
        if (db) {
          //System.out.println("004 ::: " + fullname);
          result = ta.getParam(id_task, fullname);
          if (!Null.equ(result)) {
            if (log)
              Context.this.log(false, "ASYNC:", gl_name, "(DB)=", result);
            // System.out.println(Context.this.ta.getAlias() + " : " +
            // Context.this.id_task + " : ASYNC:" + gl_name + "(DB)=" + result);
            retValue(result);
            //System.out.println("005 ::: " + fullname);
            return;
          }
        }
        if (p != null) {
          TimeList tl = getTimeList(gl_name, p);
          result = p.calculate(tl, Context.this);
          //System.out.println("006 ::: " + fullname);
          if (p.getTrace())
            tl.printTrace();
          p.executeCopyTo(Context.this, result);
        }
        if (log)
          Context.this.log(false, "ASYNC:", gl_name, "=", result);
        // System.out.println(Context.this.ta.getAlias() + " : " +
        // Context.this.id_task + " : ASYNC:" + gl_name + "=" + result);
View Full Code Here


        Object v = x.getValue();
        if (Null.equ(v))
          continue;
        String name = x.getKey();
        if (v instanceof IDependentParam) {
          IDependentParam d = (IDependentParam) v;
          if (!d.isNoSave()) {
            TimeList tl = cntx.getTimeList(d.getGLName(), d);
            Object vl = d.getValue(cntx);
            if (Null.equ(vl))
              continue;
            long wait = tl.getWaitTime();
            long calc = tl.getWorkTime();
            long sc = tl.getSystemCallTime();
View Full Code Here

    if (processor_id != null)
      s = Strings.addAllToSet(s, processor_id.depedentOnParent());
    for (Map.Entry<String, Object> e : prms_parent.entrySet()) {
      Object o = e.getValue();
      if (o != null && o instanceof IDependentParam) {
        IDependentParam p = (IDependentParam) o;
        s = Strings.addAllToSet(s, p.depedentOnParent());
      }
    }
    return s;
  }
View Full Code Here

    for (String k : info.prms.keySet()) {
      String[] n = getFullName(k);
      if (group.equals(n[0])) {
        Object o = info.prms.get(k);
        if ((o != null) && (o instanceof IDependentParam)) {
          IDependentParam p = (IDependentParam) o;
          if (res.get(k) == null || p.isNonDB()) {
            res.put(k, o);
          }
        } else if (res.get(k) == null) {
          res.put(k, o);
        }
View Full Code Here

      boolean cloneValue) throws SysException {
    String fn = (fullname == null) ? "" : fullname;
    String gl_name = "prm." + fn;
    boolean db = true;
    boolean cache = false;
    IDependentParam p = null;
    Map<String, Object> prm = info.getPrmsBySpace("prm");
    Object o = prm.get(fn);
    boolean log = true;
    Object alg = null;
    if (o != null && o instanceof IDependentParam) {
      p = (IDependentParam) o;
      db = !p.isNonDB();
      cache = p.isCache();
      log = p.getLog();
    }
    WaitValue v = null;
    // Если параметр кэшируемый
    if (cache)
      try {
        synchronized (sync_eval) {
          v = prms_eval.get(gl_name);
          // Если расчёт не производился, получить новый буфер
          if (v == null) {
            v = new WaitValue(gl_name, log);
            prms_eval.put(gl_name, v);
          }
        }
      } finally {
        v.retValue(obj);
        return true;
      }

    // Если не запрещено из базы
    if (db) {
      long i = ta.setParamObject(id_task, fn, obj);
      return (i > 0);
    }
    if (p != null && (alg = p.getFromSection()) instanceof Recipient) {
      ((Recipient) alg).adobt(obj);
    }
    return false;
  }
View Full Code Here

      Object obj, boolean cloneValue) throws SysException {
    String fn = (fullname == null) ? "" : fullname;
    String gl_name = space + "." + fn;
    boolean db = true;
    boolean cache = false;
    IDependentParam p = null;
    Map<String, Object> prm = info.getPrmsBySpace(space);
    Object o = prm.get(fn);
    boolean log = true;
    if (o != null && o instanceof IDependentParam) {
      p = (IDependentParam) o;
      db = !p.isNonDB();
      cache = p.isCache();
      log = p.getLog();
    }
    WaitValue v = null;
    // Если параметр кэшируемый
    if (cache)
      synchronized (sync_eval) {
View Full Code Here

    //  System.out.println("!!!");
    String fn = (fullname == null) ? "" : fullname;
    String gl_name = space + "." + fn;
    boolean db = true;
    boolean cache = false;
    IDependentParam p = null;
    // TODO надо оптимизировать!!
    Map<String, Object> prm = info.getPrmsBySpace(space);
    Object o = prm.get(fn);
    boolean log = true;
    if (o != null && o instanceof IDependentParam) {
      p = (IDependentParam) o;
      db = !p.isNonDB();
      cache = p.isCache();
      log = p.getLog();
    }
    WaitValue v = null;
    Object result = null;
    // Проверить кэшируемость параметра
    if (cache) {
      synchronized (sync_eval) {
        result = prms_eval.get(gl_name);
        // Если расчёт не производился, получить новый буфер для расчёта
        //System.out.println("101 ::: " + fullname);
        if (result == null) {
          v = new WaitValue(gl_name, log);
          prms_eval.put(gl_name, v);
          //System.out.println("102 ::: " + fullname);
        }
      }
      if (result != null) {
        if (result instanceof WaitValue) {
          result = ((WaitValue) result).getValueWait(timeout);
          //System.out.println("103 ::: (" + timeout + ") " + fullname);
        }
        if (log)
          Context.this.log(false, "SYNC:", gl_name, "(CACHE)=", result);
        // System.out.println(Context.this.ta.getAlias() + " : " +
        // Context.this.id_task + " : SYNC:" + gl_name + "(CACHE)=" + result);
        return result;
      } else {
        //System.out.println("104 ::: " + fullname);
      }
    }
    // Если не запрещено из базы
    if (db && "prm".equals(space)) {
      result = ta.getParam(id_task, fn);
      if (!Null.equ(result)) {
        if (log)
          Context.this.log(false, "SYNC:", gl_name, "(DB)=", result);
        if (v != null) // Кэшируемый параметр
          v.retValue(result);
        // System.out.println(Context.this.ta.getAlias() + " : " +
        // Context.this.id_task + " : SYNC:" + gl_name + "(DB)=" + result);
        //System.out.println("105 ::: " + fullname);
        return result;
      }
    }
    if (p != null) {
      try {
        TimeList tl = getTimeList(gl_name, p);
        result = p.calculate(tl, this);
        //System.out.println("106 ::: " + fullname);
        if (p.getTrace())
          tl.printTrace();
      } catch (CalculateException e) {
        if (v != null)
          v.retException(e);
        throw e;
      }
      p.executeCopyTo(this, result);
    }
    if (log)
      Context.this.log(false, "SYNC:", gl_name, "=", result);
    if (v != null)
      v.retValue(result);
View Full Code Here

              if (k.indexOf(h) == 0) {
                k = k.substring(h.length());
                Object o = e.getValue();
                String v;
                if (o != null && o instanceof IDependentParam) {
                  IDependentParam idp = (IDependentParam)o;
                  try {
                    o = idp.getValue(cntx);
                  } catch (CalculateException e1) {
                    e1.printStackTrace();
                  }
                }
                if (o == null)
View Full Code Here

              if (k.indexOf(h) == 0) {
                k = k.substring(h.length());
                Object o = e.getValue();
                String v;
                if (o != null && o instanceof IDependentParam) {
                  IDependentParam idp = (IDependentParam) o;
                  try {
                    o = idp.getValue(cntx_child);
                  } catch (CalculateException e1) {
                    e1.printStackTrace();
                  }
                }
                if (o == null)
View Full Code Here

TOP

Related Classes of center.task.prm.IDependentParam

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.