Example #1
0
 public static void main(String[] args) {
   System.setProperty("UserCacheInvoker", "ICE");
   try {
     UserCacheAdapter<DefaultUserCache> adapter =
         new UserCacheAdapter<DefaultUserCache>(new DefaultUserCacheFactory());
     List<Integer> ids = new ArrayList<Integer>();
     ids.add(68126);
     Map<Integer, DefaultUserCache> map = adapter.getUserCacheMap(ids);
     for (Entry<Integer, DefaultUserCache> entry : map.entrySet()) {
       System.out.println(entry.getKey() + " " + entry.getValue().getName());
       System.out.println("gender: " + entry.getValue().getGender());
     }
   } catch (Exception e) {
     Oce.getLogger().error(e);
   }
   System.exit(0);
 }
Example #2
0
  public Map<Integer, List<T>> getVipFullInfoSeqMap(List<Integer> ids, List<Integer> types) {
    TimeCost cost =
        TimeCost.begin("VipFullInfoReaderAdapter.getVipFullInfoSeqMap id size: " + ids.size());
    VipFullDataReaderPrx prx = null;
    Map<Integer, VipFullDataN[]> data;

    try {
      prx = getVipFullDataReaderPrx(0);
      data = prx.getVipFullDataNSeqMap(MathUtil.list2array(ids), MathUtil.list2array(types));
      Map<Integer, List<T>> res = new HashMap<Integer, List<T>>();
      for (Entry<Integer, VipFullDataN[]> ent : data.entrySet()) {
        List<T> dataList = new ArrayList<T>();
        for (VipFullDataN sData : ent.getValue()) {
          T o = _fullFactory.create();
          P p = _memberFactory.create();
          p.parse(sData.memberData);
          o.setMemberInfo(p);

          o.setId(sData.id);
          o.setIconUrl(sData.iconUrl);
          o.setHatUrl(sData.hatUrl);
          o.setHatStatus(sData.hatStatus);
          dataList.add(o);
        }
        res.put(ent.getKey(), dataList);
      }
      return res;
    } catch (TimeoutException e) {
      Oce.getLogger()
          .error(
              this.getClass().getName()
                  + ".getVipFullInfoSeqMap ["
                  + prx
                  + "] id="
                  + " Ice.TimeoutException");
      throw e;
    } finally {
      cost.endFinally();
    }
  }