publishSync 메소드는 생성의 성공 여부에 상관없이
원격 문서 생성이 완료된 경우에만
리턴됩니다. 메소드가 리턴되면 결과 코드를 확인하여 상태를 판별할 수 있습니다. 다른 확인 옵션은
비동기적인 publish 메소드를 사용하는 것입니다.
그런 다음, 클라이언트 스레드에서 스레드가 완료될 때까지
대기한 다음 생성기의 getStatus 메소드를 사용하여 상태를 검사하십시오.
publishSync 메소드 사용
RRDGEngine.EngineStatus status = generator.publishSync(docSpec, previewQuery한계);
// At this point all is done ( successfully or not) and the job status is in the status variable
publish 메소드 사용
대부분의 경우,
publishSync 메소드가 가장 편리한 메소드입니다.
publish 메소드는
클라이언트 코드가 작업이 완료되기를 기다리지 않는 경우, 특히, 원격 문서 생성 시나리오에서 사용할 수 있습니다.
따라서 검증으로 인해 클라이언트 애플리케이션이 잠기지 않습니다.
비동기 작업의 경우, 플로우는 다음과 같습니다.
- 작업 시작
- 작업이 완료되었는지 확인하기 위해 정기적으로 작업 폴링
Thread t = generator.publish(docSpec, previewQuery한계);
// this reeturns almost immediately and at this point the docgen is usually still running so the client code needs to wait for it
// wait for the job to finish
try
{
t.join();
// here the job is finished and it status can be obtaine with
RRDGEngine.EngineStatus status = generator.getStatus();
}
catch (InterruptedException e)
{
throw new RPEException(e);
}