/** * First publish the metadata via {@link DataPublisher#publishMetadata(WorkUnitState)}, and then publish the output data * via the {@link DataPublisher#publishData(WorkUnitState)} method. * * @param state is a {@link WorkUnitState}. * @throws IOException if there is a problem with publishing the metadata or the data. */ public void publish(WorkUnitState state) throws IOException { publishMetadata(state); publishData(state); }
private void publishTaskData() throws IOException { Closer closer = Closer.create(); try { Class<? extends DataPublisher> dataPublisherClass = getTaskPublisherClass(); SingleTaskDataPublisher publisher = closer.register(SingleTaskDataPublisher.getInstance(dataPublisherClass, this.taskState)); LOG.info("Publishing data from task " + this.taskId); publisher.publish(this.taskState); } catch (ClassCastException e) { LOG.error(String.format("To publish data in task, the publisher class must extend %s", SingleTaskDataPublisher.class.getSimpleName()), e); this.taskState.setTaskFailureException(e); throw closer.rethrow(e); } catch (Throwable t) { this.taskState.setTaskFailureException(t); throw closer.rethrow(t); } finally { closer.close(); } }
private void publishTaskData() throws IOException { Closer closer = Closer.create(); try { Class<? extends DataPublisher> dataPublisherClass = getTaskPublisherClass(); SingleTaskDataPublisher publisher = closer.register(SingleTaskDataPublisher.getInstance(dataPublisherClass, this.taskState)); LOG.info("Publishing data from task " + this.taskId); publisher.publish(this.taskState); } catch (ClassCastException e) { LOG.error(String.format("To publish data in task, the publisher class must extend %s", SingleTaskDataPublisher.class.getSimpleName()), e); this.taskState.setTaskFailureException(e); throw closer.rethrow(e); } catch (Throwable t) { this.taskState.setTaskFailureException(t); throw closer.rethrow(t); } finally { closer.close(); } }
/** * First publish the metadata via {@link DataPublisher#publishMetadata(WorkUnitState)}, and then publish the output data * via the {@link DataPublisher#publishData(WorkUnitState)} method. * * @param state is a {@link WorkUnitState}. * @throws IOException if there is a problem with publishing the metadata or the data. */ public void publish(WorkUnitState state) throws IOException { publishMetadata(state); publishData(state); }