예제 #1
0
파일: RPC.java 프로젝트: baeeq/hadoop-20
 public void readFields(DataInput in) throws IOException {
   methodName = UTF8.readString(in);
   parameters = new Object[in.readInt()];
   parameterClasses = new Class[parameters.length];
   ObjectWritable objectWritable = new ObjectWritable();
   for (int i = 0; i < parameters.length; i++) {
     parameters[i] = ObjectWritable.readObject(in, objectWritable, this.conf);
     parameterClasses[i] = objectWritable.getDeclaredClass();
   }
 }
  @Override
  public void map(Text key, ObjectWritable value, Context context)
      throws IOException, InterruptedException {

    System.out.println("map");

    // key == site_url

    //		//하나의 터치데이터 묶음
    //		String str = value.toString();
    //
    //		//키값 추출 (url, device)
    //		int chk=0;
    //		int i;
    //		for(i=0;i<str.length();i++){
    //			if(str.charAt(i) == ','){
    //				chk++;
    //				if(chk == 2)
    //					break;
    //			}
    //		}
    //
    //		System.out.println("		-	map : " + str);
    //
    //		PageData page = new PageData();

    //		System.out.println(key.toString() + " direct");

    PathData ptd = null;
    if (value.getDeclaredClass() == PathData.class) {
      //			System.out.println("pagedata");
      ptd = (PathData) value.get();
      System.out.println("key = " + key.toString());
      System.out.println("url = " + ptd.site_url);
    }
    //		else
    //			System.out.println("not pagedata");

    //		PageData pd = (PageData) value.get();
    //		if(pd == null){
    //			System.out.println("null?!");
    //		}
    //
    //		System.out.println(pd.country + "  " + pd.date);

    //	PageData pp = new PageData();
    // System.out.println("map");
    // reduce로 넘기기
    context.write(new Text(ptd.site_url), new ObjectWritable(ptd));

    // output.collect(value, new Text ("v" + value.toString()));

  }
예제 #3
0
 @SuppressWarnings("deprecation")
 public void readFields(DataInput in) throws IOException {
   rpcVersion = in.readLong();
   declaringClassProtocolName = UTF8.readString(in);
   methodName = UTF8.readString(in);
   clientVersion = in.readLong();
   clientMethodsHash = in.readInt();
   parameters = new Object[in.readInt()];
   parameterClasses = new Class[parameters.length];
   ObjectWritable objectWritable = new ObjectWritable();
   for (int i = 0; i < parameters.length; i++) {
     parameters[i] = ObjectWritable.readObject(in, objectWritable, this.conf);
     parameterClasses[i] = objectWritable.getDeclaredClass();
   }
 }