use of lombok.Synchronized in project pravega by pravega.
the class MockConnectionFactoryImpl method establishConnection.
@Override
@Synchronized
public CompletableFuture<ClientConnection> establishConnection(PravegaNodeUri location, ReplyProcessor rp) {
ClientConnection connection = connections.get(location);
Preconditions.checkState(connection != null, "Unexpected Endpoint");
processors.put(location, rp);
return CompletableFuture.completedFuture(connection);
}
use of lombok.Synchronized in project pravega by pravega.
the class MockSegmentIoStreams method read.
@Override
@Synchronized
public ByteBuffer read(long timeout) throws EndOfSegmentException, SegmentTruncatedException {
if (readIndex >= eventsWritten) {
throw new EndOfSegmentException();
}
if (readOffset < startingOffset) {
throw new SegmentTruncatedException("Data below " + startingOffset + " has been truncated");
}
ByteBuffer buffer = dataWritten.get(readIndex);
readIndex++;
readOffset += buffer.remaining() + WireCommands.TYPE_PLUS_LENGTH_SIZE;
return buffer.slice();
}
Aggregations