Ignore:
Timestamp:
11/10/10 12:58:33 (14 years ago)
Author:
gaba
Message:
 
Location:
MDService2/trunk/MDService2/src/eu/clarin/cmdi/mdservice/action
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • MDService2/trunk/MDService2/src/eu/clarin/cmdi/mdservice/action/Cache.java

    r832 r870  
    158158                }else{
    159159                        e.setAttribute("lang", "");
     160                }
     161                if (key_array.length > 9){
     162                        e.setAttribute("duration", key_array[9]);
     163                }else{
     164                        e.setAttribute("duration", "");
    160165                }
    161166               
  • MDService2/trunk/MDService2/src/eu/clarin/cmdi/mdservice/action/GenericProxyAction.java

    r862 r870  
    5959        //private Map<String,Object> session;
    6060         private HttpServletRequest request;
    61 
     61         private long duration = 0;
     62         
    6263        public String getQ() {
    6364                return q;
     
    314315                       
    315316                        if (getLang()!=null) {
    316                                 key += getLang();
    317                         }
     317                                key += getLang() + "//-";
     318                        }else{
     319                                key +="//-" ;
     320                        }
     321                       
    318322                         
    319323                        return key;
     
    424428        }
    425429       
     430        public String addDurationKey(){
     431                String req_key = getRequestKey();
     432       
     433                Double duration_d;
     434
     435            duration_d = (double)duration;
     436            duration_d = duration_d/1000.0;
     437                req_key += duration_d + "//-";
     438                return req_key;
     439        }
     440       
    426441        public void prepare() throws Exception {               
    427442               
     
    445460                        if (sourceStream == null) { // either not in cache or cache_flag=refresh
    446461                                //sourceStream = getTargetRequest().openStream();
     462                                long startMillis = System.currentTimeMillis();
    447463                                sourceStream = getSourceStream();
     464                                duration = System.currentTimeMillis() - startMillis;
     465                                req_key = addDurationKey();
     466                               
     467                                long now = System.currentTimeMillis();
    448468                                xcid = Cache.getCache().putInCache(req_key,sourceStream);                       
    449469                                Admin.notifyUser("putting in cache: " + req_key);                       
     
    478498        //Admin.notifyUser(String.valueOf(getSession()));
    479499       
     500        long now = System.currentTimeMillis();
     501
    480502                prepare();
     503                long duration = (System.currentTimeMillis() - now);
     504                //duration
     505
    481506                if (resultStream == null) {
    482507                        return ERROR;   
Note: See TracChangeset for help on using the changeset viewer.