Ejemplo n.º 1
0
 public void run() {
   while (RUNNING) {
     try {
       Thread.sleep(400000000);
     } catch (InterruptedException e) {
       // TODO Auto-generated catch block
       e.printStackTrace();
     }
     if (SESSIONS.size() != 0) {
       for (String key : SESSIONS.keySet()) {
         IndividualRecommender rec = SESSIONS.get(key);
         String stamp = Pattern.quote(rec.getTimestamp()).split("\\.")[0].substring(2);
         SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss");
         Date lastUpdateTime;
         try {
           lastUpdateTime = formatter.parse(stamp);
           Date today = new Date();
           if ((today.getTime() - lastUpdateTime.getTime()) >= MILLISECONDS.convert(20, DAYS)) {
             SESSIONS.remove(key);
           }
         } catch (ParseException e) {
           // TODO Auto-generated catch block
           e.printStackTrace();
         }
       }
     }
   }
 }
Ejemplo n.º 2
0
 @Override
 public void createNewIndividualServer(String key) {
   if (key != null) {
     if (SESSIONS.get(key) == null) {
       SESSIONS.put(key, IndividualRecommender.createNewIndividualServer(this.dataSource));
     }
   }
 }
Ejemplo n.º 3
0
 private boolean updateDataModel(IndividualRecommender rec, String key) {
   rec.updateDataModel(key);
   return rec.getRefreshed();
 }