use of org.apache.gobblin.dataset.DatasetDescriptor in project incubator-gobblin by apache.
the class LineageInfo method putDestination.
/**
* Put a {@link DatasetDescriptor} of a destination dataset to a state
*
* <p>
* Only the {@link org.apache.gobblin.writer.DataWriter} or {@link org.apache.gobblin.publisher.DataPublisher}
* is supposed to put the destination dataset information. Since different branches may concurrently put,
* the method is implemented to be threadsafe
* </p>
*/
public void putDestination(DatasetDescriptor destination, int branchId, State state) {
if (!hasLineageInfo(state)) {
log.warn("State has no lineage info but branch " + branchId + " puts a destination: " + GSON.toJson(destination));
return;
}
log.debug(String.format("Put destination %s for branch %d", GSON.toJson(destination), branchId));
synchronized (state.getProp(getKey(NAME_KEY))) {
DatasetDescriptor descriptor = resolver.resolve(destination, state);
if (descriptor == null) {
return;
}
state.setProp(getKey(BRANCH, branchId, LineageEventBuilder.DESTINATION), GSON.toJson(descriptor));
}
}
Aggregations