Search in sources :

Example 21 with Synchronized

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);
}
Also used : ClientConnection(io.pravega.client.netty.impl.ClientConnection) Synchronized(lombok.Synchronized)

Example 22 with Synchronized

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();
}
Also used : EndOfSegmentException(io.pravega.client.segment.impl.EndOfSegmentException) SegmentTruncatedException(io.pravega.client.segment.impl.SegmentTruncatedException) ByteBuffer(java.nio.ByteBuffer) Synchronized(lombok.Synchronized)

Aggregations

Synchronized (lombok.Synchronized)22 IOException (java.io.IOException)6 Segment (io.pravega.client.segment.impl.Segment)4 ArrayList (java.util.ArrayList)4 S3Exception (com.emc.object.s3.S3Exception)3 CreateSegment (io.pravega.shared.protocol.netty.WireCommands.CreateSegment)3 DeleteSegment (io.pravega.shared.protocol.netty.WireCommands.DeleteSegment)3 ScheduledReporter (com.codahale.metrics.ScheduledReporter)2 Stream (io.pravega.client.stream.Stream)2 StreamImpl (io.pravega.client.stream.impl.StreamImpl)2 PravegaNodeUri (io.pravega.shared.protocol.netty.PravegaNodeUri)2 ByteArrayInputStream (java.io.ByteArrayInputStream)2 InputStream (java.io.InputStream)2 ByteBuffer (java.nio.ByteBuffer)2 FileChannel (java.nio.channels.FileChannel)2 Path (java.nio.file.Path)2 SneakyThrows (lombok.SneakyThrows)2 PersistentNode (org.apache.curator.framework.recipes.nodes.PersistentNode)2 ChainingMetadataResolver (org.opensaml.saml.metadata.resolver.ChainingMetadataResolver)2 JmxReporter (com.codahale.metrics.JmxReporter)1