빅데이터 하둡 프로그래밍 교육과정 ]Mapper 클래스의 메소드들




빅데이터 하둡 프로그래밍 교육과정 ]Mapper 클래스의 메소드들

실무개발자를위한 실무교육 전문교육센터학원

www.oraclejava.co.kr에 오시면 보다 다양한 강좌를 보실 수 있습니다.


Mapper 클래스의 메소드들


■ 앞서 본 map 메소드이외에도 다음 메소드들이 존재

  - public void setup(Mapper.Context context)

     * map 메소드에서 필요리소스를 여기서 할당 


  - public void cleanup(Mapper.Context context)

     * setup에서 할당한 리소스를 해제.


- public void run(Mapper.Context context)

     * 기본구현은 다음과 같다.



  public void run(Context context) throws IOException, InterruptedException {

    setup(context);

    while (context.nextKeyValue()) {

      map(context.getCurrentKey(), context.getCurrentValue(), context);

    }

    cleanup(context);

  }



+ Recent posts