- Timestamp:
- 2012-05-22T13:01:04+12:00 (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
main/trunk/greenstone3/src/java/org/greenstone/gsdl3/LibraryServlet.java
r25425 r25635 11 11 import org.w3c.dom.NodeList; 12 12 import java.io.*; 13 13 14 import javax.servlet.*; 14 15 import javax.servlet.http.*; … … 90 91 * form: sid -> (UserSessionCache object) 91 92 */ 92 protected Hashtable session_ids_table = new Hashtable();93 protected Hashtable<String, UserSessionCache> session_ids_table = new Hashtable<String, UserSessionCache>(); 93 94 94 95 /** … … 156 157 } 157 158 158 HashMap config_params = new HashMap();159 HashMap<String, Comparable> config_params = new HashMap<String, Comparable>(); 159 160 160 161 config_params.put(GSConstants.LIBRARY_NAME, library_name); … … 310 311 * param_value) 311 312 */ 312 protected Hashtable coll_name_params_table = null;313 314 public UserSessionCache(String id, Hashtable table)313 protected Hashtable<String, Hashtable<String, String>> coll_name_params_table = null; 314 315 public UserSessionCache(String id, Hashtable<String, Hashtable<String, String>> table) 315 316 { 316 317 session_id = id; … … 326 327 } 327 328 328 protected Hashtable getParamsTable()329 protected Hashtable<String, Hashtable<String, String>> getParamsTable() 329 330 { 330 331 return coll_name_params_table; … … 517 518 if (clean_all) 518 519 { 519 session_ids_table = new Hashtable ();520 session_ids_table = new Hashtable<String, UserSessionCache>(); 520 521 session.removeAttribute(GSXML.USER_SESSION_CACHE_ATT); 521 522 } … … 523 524 { 524 525 // just clean up info for clean_collection 525 ArrayList cache_list = new ArrayList(session_ids_table.values());526 ArrayList<UserSessionCache> cache_list = new ArrayList<UserSessionCache>(session_ids_table.values()); 526 527 for (int i = 0; i < cache_list.size(); i++) 527 528 { 528 UserSessionCache cache = (UserSessionCache)cache_list.get(i);529 UserSessionCache cache = cache_list.get(i); 529 530 cache.cleanupCache(clean_collection); 530 531 } … … 555 556 556 557 UserSessionCache session_cache = null; 557 Hashtable param_table = null;558 Hashtable table = null;558 Hashtable<String, Hashtable<String, String>> param_table = null; 559 Hashtable<String, String> table = null; 559 560 String sid = session.getId(); 560 561 if (should_cache == true && cache_key != null && !cache_key.equals("")) … … 562 563 if (session_ids_table.containsKey(sid)) 563 564 { 564 session_cache = (UserSessionCache)session_ids_table.get(sid);565 session_cache = session_ids_table.get(sid); 565 566 param_table = session_cache.getParamsTable(); 566 567 logger.info("collections in table: " + tableToString(param_table)); … … 568 569 { 569 570 //logger.info("existing table: " + collection); 570 table = (Hashtable)param_table.get(cache_key);571 table = param_table.get(cache_key); 571 572 } 572 573 else 573 574 { 574 table = new Hashtable ();575 table = new Hashtable<String, String>(); 575 576 param_table.put(cache_key, table); 576 577 //logger.info("new table: " + collection); … … 579 580 else 580 581 { 581 param_table = new Hashtable ();582 table = new Hashtable ();582 param_table = new Hashtable<String, Hashtable<String, String>>(); 583 table = new Hashtable<String, String>(); 583 584 param_table.put(cache_key, table); 584 585 session_cache = new UserSessionCache(sid, param_table); … … 642 643 if (table != null) 643 644 { 644 Enumeration keys = table.keys();645 Enumeration<String> keys = table.keys(); 645 646 while (keys.hasMoreElements()) 646 647 { 647 String name = (String)keys.nextElement();648 session.setAttribute(name, (String)table.get(name));648 String name = keys.nextElement(); 649 session.setAttribute(name, table.get(name)); 649 650 } 650 651 } … … 691 692 for (int j = 0; j < httpHeaders.size(); j++) 692 693 { 693 Map nameValueMap = (Map)httpHeaders.get(j);694 Map nameValueMap = httpHeaders.get(j); 694 695 String name = (String) nameValueMap.get("name"); 695 696 String value = (String) nameValueMap.get("value"); … … 825 826 else 826 827 { 827 HashMap responseParams = GSXML.extractParams(responseParamList, true);828 HashMap<String, Serializable> responseParams = GSXML.extractParams(responseParamList, true); 828 829 String groups = (String) responseParams.get(GSXML.GROUPS_ATT); 829 830 … … 910 911 911 912 //a debugging method 912 private void displaySize(Hashtable table)913 private void displaySize(Hashtable<String, UserSessionCache> table) 913 914 { 914 915 if (table == null) … … 923 924 } 924 925 int num_cached_coll = 0; 925 ArrayList cache_list = new ArrayList(table.values());926 ArrayList<UserSessionCache> cache_list = new ArrayList<UserSessionCache>(table.values()); 926 927 for (int i = 0; i < cache_list.size(); i++) 927 928 { 928 num_cached_coll += ((UserSessionCache) cache_list.get(i)).tableSize();929 num_cached_coll += cache_list.get(i).tableSize(); 929 930 } 930 931 logger.info("Number of sessions : total number of cached collection info = " + table.size() + " : " + num_cached_coll); … … 932 933 933 934 /** merely a debugging method! */ 934 private String tableToString(Hashtable table)935 private String tableToString(Hashtable<String, Hashtable<String, String>> table) 935 936 { 936 937 String str = ""; 937 Enumeration keys = table.keys();938 Enumeration<String> keys = table.keys(); 938 939 while (keys.hasMoreElements()) 939 940 { 940 String name = (String)keys.nextElement();941 String name = keys.nextElement(); 941 942 str += name + ", "; 942 943 }
Note:
See TracChangeset
for help on using the changeset viewer.