コード例 #1
0
  /*
   * (non-Javadoc)
   *
   * @see java.util.TimerTask#run()
   */
  @Override
  public void run() {
    log.info(this + ":Start");
    try {
      /*
       * ALERT: new software version!!
       */
      log.warning("Need implementation for New Software Update!");

    } catch (Exception e) {
      log.error(e);
      throw new RuntimeException(e);
    } finally {
      log.info(this + ":Stop");
    }
  }
コード例 #2
0
 /*
  * (non-Javadoc)
  *
  * @see pt.consulting.grlp.container.IContainer#existGrowller(int)
  */
 @Override
 public String existGrowller(int growllerId) {
   String version = growllerMap.get(growllerId);
   if (null == version) {
     log.warning("Growller dont exist: " + growllerId);
   }
   return version;
 }
コード例 #3
0
 /*
  * (non-Javadoc)
  *
  * @see
  * pt.consulting.grlp.container.IContainer#addGrowller(pt.consulting.grlp
  * .dao.entity.Growller)
  */
 @Override
 public void addGrowller(Growllers growller) {
   int id = growller.getId();
   String token = growller.getToken();
   synchronized (growllerMap) {
     growllerMap.put(id, token);
     log.info("addGrowller:{" + id + ":" + token + "}");
   }
 }
コード例 #4
0
  /*
   * (non-Javadoc)
   *
   * @see pt.consulting.grlp.container.IContainer#initTask(long, long)
   */
  @Override
  public Timer initTask(long delay, long period) {
    log = ResourceConfig.getInstance().createLog("container");
    log.info(this + ":Persistence Unit Name: " + service.getUnitName());
    /*
     * load growller map
     */
    loadGrowllerMap();

    return schedule(delay, period);
  }
コード例 #5
0
 /**
  * Task to load the {@link Growllers} map structure.
  *
  * @throws Exception
  */
 private void loadGrowllerMap() {
   List<Growllers> growllerList;
   log.info(this + ":loadGrowllerMap:Init");
   try {
     growllerList = service.findAllGrowllers();
     if (null != growllerList) {
       int id;
       String token;
       synchronized (growllerMap) {
         growllerMap.clear();
         for (Growllers growller : growllerList) {
           id = growller.getId();
           token = growller.getToken();
           growllerMap.put(id, token);
           log.info("Loaded:{" + id + ":" + token + "}");
         }
       }
     }
   } catch (Exception e) {
     throw new RuntimeException("Load Growller Map fail: ", e);
   }
   log.info(this + ":loadGrowllerMap:End");
 }