Java Code Examples for org.apache.flink.core.fs.FSDataOutputStream#getPos()

The following examples show how to use org.apache.flink.core.fs.FSDataOutputStream#getPos() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: BlockingCheckpointOutputStream.java    From Flink-CEPplus with Apache License 2.0 6 votes vote down vote up
public BlockingCheckpointOutputStream(
	@Nullable FSDataOutputStream delegate,
	@Nullable OneShotLatch waitForBlocking,
	@Nullable OneShotLatch triggerUnblock,
	long blockAtPosition) {

	this.delegate = delegate;
	this.triggerUnblock = triggerUnblock;
	this.waitForBlocking = waitForBlocking;
	this.blockAtPosition = blockAtPosition;
	if (delegate != null) {
		try {
			this.position = delegate.getPos();
		} catch (IOException e) {
			throw new RuntimeException(e);
		}
	} else {
		this.position = 0;
	}
	this.closed = new AtomicBoolean(false);
}
 
Example 2
Source File: BlockingCheckpointOutputStream.java    From flink with Apache License 2.0 6 votes vote down vote up
public BlockingCheckpointOutputStream(
	@Nullable FSDataOutputStream delegate,
	@Nullable OneShotLatch waitForBlocking,
	@Nullable OneShotLatch triggerUnblock,
	long blockAtPosition) {

	this.delegate = delegate;
	this.triggerUnblock = triggerUnblock;
	this.waitForBlocking = waitForBlocking;
	this.blockAtPosition = blockAtPosition;
	if (delegate != null) {
		try {
			this.position = delegate.getPos();
		} catch (IOException e) {
			throw new RuntimeException(e);
		}
	} else {
		this.position = 0;
	}
	this.closed = new AtomicBoolean(false);
}
 
Example 3
Source File: BlockingCheckpointOutputStream.java    From flink with Apache License 2.0 6 votes vote down vote up
public BlockingCheckpointOutputStream(
	@Nullable FSDataOutputStream delegate,
	@Nullable OneShotLatch waitForBlocking,
	@Nullable OneShotLatch triggerUnblock,
	long blockAtPosition) {

	this.delegate = delegate;
	this.triggerUnblock = triggerUnblock;
	this.waitForBlocking = waitForBlocking;
	this.blockAtPosition = blockAtPosition;
	if (delegate != null) {
		try {
			this.position = delegate.getPos();
		} catch (IOException e) {
			throw new RuntimeException(e);
		}
	} else {
		this.position = 0;
	}
	this.closed = new AtomicBoolean(false);
}
 
Example 4
Source File: PartitionableListState.java    From Flink-CEPplus with Apache License 2.0 5 votes vote down vote up
public long[] write(FSDataOutputStream out) throws IOException {

		long[] partitionOffsets = new long[internalList.size()];

		DataOutputView dov = new DataOutputViewStreamWrapper(out);

		for (int i = 0; i < internalList.size(); ++i) {
			S element = internalList.get(i);
			partitionOffsets[i] = out.getPos();
			getStateMetaInfo().getPartitionStateSerializer().serialize(element, dov);
		}

		return partitionOffsets;
	}
 
Example 5
Source File: HeapBroadcastState.java    From Flink-CEPplus with Apache License 2.0 5 votes vote down vote up
@Override
public long write(FSDataOutputStream out) throws IOException {
	long partitionOffset = out.getPos();

	DataOutputView dov = new DataOutputViewStreamWrapper(out);
	dov.writeInt(backingMap.size());
	for (Map.Entry<K, V> entry: backingMap.entrySet()) {
		getStateMetaInfo().getKeySerializer().serialize(entry.getKey(), dov);
		getStateMetaInfo().getValueSerializer().serialize(entry.getValue(), dov);
	}

	return partitionOffset;
}
 
Example 6
Source File: PartitionableListState.java    From flink with Apache License 2.0 5 votes vote down vote up
public long[] write(FSDataOutputStream out) throws IOException {

		long[] partitionOffsets = new long[internalList.size()];

		DataOutputView dov = new DataOutputViewStreamWrapper(out);

		for (int i = 0; i < internalList.size(); ++i) {
			S element = internalList.get(i);
			partitionOffsets[i] = out.getPos();
			getStateMetaInfo().getPartitionStateSerializer().serialize(element, dov);
		}

		return partitionOffsets;
	}
 
Example 7
Source File: HeapBroadcastState.java    From flink with Apache License 2.0 5 votes vote down vote up
@Override
public long write(FSDataOutputStream out) throws IOException {
	long partitionOffset = out.getPos();

	DataOutputView dov = new DataOutputViewStreamWrapper(out);
	dov.writeInt(backingMap.size());
	for (Map.Entry<K, V> entry: backingMap.entrySet()) {
		getStateMetaInfo().getKeySerializer().serialize(entry.getKey(), dov);
		getStateMetaInfo().getValueSerializer().serialize(entry.getValue(), dov);
	}

	return partitionOffset;
}
 
Example 8
Source File: PartitionableListState.java    From flink with Apache License 2.0 5 votes vote down vote up
public long[] write(FSDataOutputStream out) throws IOException {

		long[] partitionOffsets = new long[internalList.size()];

		DataOutputView dov = new DataOutputViewStreamWrapper(out);

		for (int i = 0; i < internalList.size(); ++i) {
			S element = internalList.get(i);
			partitionOffsets[i] = out.getPos();
			getStateMetaInfo().getPartitionStateSerializer().serialize(element, dov);
		}

		return partitionOffsets;
	}
 
Example 9
Source File: HeapBroadcastState.java    From flink with Apache License 2.0 5 votes vote down vote up
@Override
public long write(FSDataOutputStream out) throws IOException {
	long partitionOffset = out.getPos();

	DataOutputView dov = new DataOutputViewStreamWrapper(out);
	dov.writeInt(backingMap.size());
	for (Map.Entry<K, V> entry: backingMap.entrySet()) {
		getStateMetaInfo().getKeySerializer().serialize(entry.getKey(), dov);
		getStateMetaInfo().getValueSerializer().serialize(entry.getValue(), dov);
	}

	return partitionOffset;
}