@Override public void onAllConsumersRegistered() { // can safely load query optimizer in separate thread here _queryOptimizerRef.requestLoad(); }
/** * Requests an asynchronous load of the lazy reference. If not already * loaded, this will cause another thread to load the reference, typically * to make it immediately available for later evaluation. */ public void requestLoad() { requestLoad(null); }
/** * Requests an asynchronous load of the lazy reference. If not already * loaded, this will cause another thread to load the reference, typically * to make it immediately available for later evaluation. */ public void requestLoad() { requestLoad(null); }
public void initialize() { // can safely load query optimizer in separate thread here _queryOptimizerRef.requestLoad(); }
@Override public AnalysisResultFuture dispatchJob(final AnalysisJob job, final DistributedJobContext context) throws Exception { // determine endpoint url final int index = context.getJobDivisionIndex(); final String slaveEndpoint = _slaveEndpoints.get(index); // write the job as XML final JaxbJobWriter jobWriter = new JaxbJobWriter(context.getMasterConfiguration()); final ByteArrayOutputStream baos = new ByteArrayOutputStream(); jobWriter.write(job, baos); final byte[] bytes = baos.toByteArray(); // send the request in another thread final List<Throwable> errors = new LinkedList<>(); final String slaveJobUuid = UUID.randomUUID().toString(); final LazyRef<AnalysisResult> resultRef = sendExecuteRequest(slaveEndpoint, bytes, errors, slaveJobUuid); resultRef.requestLoad(errors::add); return new LazyRefAnalysisResultFuture(resultRef, errors) { @Override public void cancel() { sendCancelRequest(slaveEndpoint, slaveJobUuid); } }; }
@Override public AnalysisResultFuture dispatchJob(AnalysisJob job, DistributedJobContext context) throws Exception { // determine endpoint url final int index = context.getJobDivisionIndex(); final String slaveEndpoint = _slaveEndpoints.get(index); // write the job as XML final JaxbJobWriter jobWriter = new JaxbJobWriter(context.getMasterConfiguration()); final ByteArrayOutputStream baos = new ByteArrayOutputStream(); jobWriter.write(job, baos); final byte[] bytes = baos.toByteArray(); // send the request in another thread final List<Throwable> errors = new LinkedList<Throwable>(); final String slaveJobUuid = UUID.randomUUID().toString(); final LazyRef<AnalysisResult> resultRef = sendExecuteRequest(slaveEndpoint, bytes, errors, slaveJobUuid); resultRef.requestLoad(new Action<Throwable>() { @Override public void run(Throwable error) throws Exception { errors.add(error); } }); return new LazyRefAnalysisResultFuture(resultRef, errors) { @Override public void cancel() { sendCancelRequest(slaveEndpoint, slaveJobUuid); } }; }