SHARE
TWEET

Untitled

a guest Jun 20th, 2019 57 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. public class MyCache {
  2.         static ConcurrentHashMap<String, NavigableMap <Long, String>> map1= new ConcurrentHashMap<String, NavigableMap <Long, String>> ();
  3.         static HashMap <String, NavigableMap <Long, String>> map2= new ConcurrentHashMap<String, NavigableMap <Long, String>> ();
  4.         static ConcurrentHashMap<String, NavigableMap <Long, String>> map3= new ConcurrentHashMap<String, NavigableMap <Long, String>> ();
  5.         static ConcurrentHashMap<String, NavigableMap <Long, String>> map4= new ConcurrentHashMap<String, NavigableMap <Long, String>> ();
  6.         static ConcurrentHashMap<String, NavigableMap <Long, String>> map5= new ConcurrentHashMap<String, NavigableMap <Long, String>> ();
  7.         static ConcurrentHashMap<String, NavigableMap <Long, String>> map6= new ConcurrentHashMap<String, NavigableMap <Long, String>> ();
  8.         static ConcurrentHashMap<String, NavigableMap <Long, String>> map7= new ConcurrentHashMap<String, NavigableMap <Long, String>> ();
  9.  
  10.         public static void main(String[] args) throws Exception {
  11.     new Server(); //new server thread accessing caches
  12.     for (int i =0 ; i< users.length; i++) //cache data for each username
  13.          new Caching();
  14.     }
  15. }
  16.      
  17. MyCache.map1.put(username, new ConcurrentSkipListMap <Long, String> (map1Temp));
  18.      
  19. //...
  20.     switch (type) {
  21.             case "type1":
  22.                 list = new ArrayList<String>(MyCache.map1.get(username).subMap(start, end).values());
  23.                 break;
  24.  
  25.             case "type2":
  26.                 list = new ArrayList<String>(MyCache.map2.get(username).subMap(start, end).values());
  27.                 break;
  28.     // ...
  29.             case "type7":
  30.                 list = new ArrayList<String>(MyCache.map7.get(username).subMap(start, end).values());
  31.                 break;
  32. //and send the array as text over HTTP
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top