Search in sources :

Example 81 with DirectBuffer

use of org.agrona.DirectBuffer in project zeebe by zeebe-io.

the class POJOMappingBenchmark method performMappingCycleOptimalEncodedOrder.

@Benchmark
@Threads(1)
public void performMappingCycleOptimalEncodedOrder(POJOMappingContext ctx) throws Exception {
    final TaskEvent taskEvent = ctx.getTaskEvent();
    final DirectBuffer encodedTaskEvent = ctx.getOptimalOrderEncodedTaskEvent();
    final MutableDirectBuffer writeBuffer = ctx.getWriteBuffer();
    taskEvent.reset();
    taskEvent.wrap(encodedTaskEvent, 0, encodedTaskEvent.capacity());
    taskEvent.write(writeBuffer, 0);
}
Also used : MutableDirectBuffer(org.agrona.MutableDirectBuffer) DirectBuffer(org.agrona.DirectBuffer) TaskEvent(io.zeebe.broker.taskqueue.data.TaskEvent) MutableDirectBuffer(org.agrona.MutableDirectBuffer) Threads(org.openjdk.jmh.annotations.Threads) Benchmark(org.openjdk.jmh.annotations.Benchmark)

Example 82 with DirectBuffer

use of org.agrona.DirectBuffer in project zeebe by zeebe-io.

the class RaftConfigurationMetadata method getVotedFor.

public void getVotedFor(final SocketAddress votedFor) {
    votedFor.reset();
    final DirectBuffer votedForValue = votedForHostProp.getValue();
    final int votedForLength = votedForValue.capacity();
    if (votedForLength > 0) {
        votedFor.host(votedForValue, 0, votedForLength);
        votedFor.port(votedForPortProp.getValue());
    }
}
Also used : DirectBuffer(org.agrona.DirectBuffer)

Example 83 with DirectBuffer

use of org.agrona.DirectBuffer in project zeebe by zeebe-io.

the class RaftConfigurationMetadata method getMembers.

public List<SocketAddress> getMembers() {
    final List<SocketAddress> members = new ArrayList<>();
    final Iterator<RaftConfigurationMetadataMember> iterator = membersProp.iterator();
    while (iterator.hasNext()) {
        final RaftConfigurationMetadataMember configurationMember = iterator.next();
        final DirectBuffer hostBuffer = configurationMember.getHost();
        final SocketAddress member = new SocketAddress().host(hostBuffer, 0, hostBuffer.capacity()).port(configurationMember.getPort());
        members.add(member);
    }
    return members;
}
Also used : DirectBuffer(org.agrona.DirectBuffer) ArrayList(java.util.ArrayList) SocketAddress(io.zeebe.transport.SocketAddress)

Example 84 with DirectBuffer

use of org.agrona.DirectBuffer in project zeebe by zeebe-io.

the class PartitionManagerImpl method createPartitionRemote.

@Override
public ActorFuture<ClientResponse> createPartitionRemote(SocketAddress remote, DirectBuffer topicName, int partitionId) {
    final DirectBuffer nameBuffer = BufferUtil.cloneBuffer(topicName);
    messageWriter.partitionId(partitionId).topicName(nameBuffer);
    final RemoteAddress remoteAddress = transport.registerRemoteAddress(remote);
    Loggers.SYSTEM_LOGGER.info("Creating partition {}/{} at {}", BufferUtil.bufferAsString(topicName), partitionId, remote);
    return transport.getOutput().sendRequest(remoteAddress, messageWriter, Duration.ofSeconds(5));
}
Also used : DirectBuffer(org.agrona.DirectBuffer)

Example 85 with DirectBuffer

use of org.agrona.DirectBuffer in project zeebe by zeebe-io.

the class ClusterMemberListManager method onStateChange.

@Override
public void onStateChange(int partitionId, DirectBuffer topicName, SocketAddress socketAddress, RaftState raftState) {
    final DirectBuffer savedTopicName = BufferUtil.cloneBuffer(topicName);
    actor.call(() -> {
        if (raftState == RaftState.FOLLOWER) {
            updateTopologyOnRaftStateChangeForPartition(raftState, partitionId, savedTopicName);
        }
    });
}
Also used : DirectBuffer(org.agrona.DirectBuffer)

Aggregations

DirectBuffer (org.agrona.DirectBuffer)116 Header (io.aeron.logbuffer.Header)21 UnsafeBuffer (org.agrona.concurrent.UnsafeBuffer)21 MutableDirectBuffer (org.agrona.MutableDirectBuffer)20 File (java.io.File)19 MediaDriver (io.aeron.driver.MediaDriver)18 CountersReader (org.agrona.concurrent.status.CountersReader)15 ThreadingMode (io.aeron.driver.ThreadingMode)12 FragmentHandler (io.aeron.logbuffer.FragmentHandler)12 MappedByteBuffer (java.nio.MappedByteBuffer)12 ClusteredService (io.aeron.cluster.service.ClusteredService)10 InterruptAfter (io.aeron.test.InterruptAfter)10 Test (org.junit.jupiter.api.Test)10 ExtendWith (org.junit.jupiter.api.extension.ExtendWith)10 ParameterizedTest (org.junit.jupiter.params.ParameterizedTest)10 Publication (io.aeron.Publication)9 ClientSession (io.aeron.cluster.service.ClientSession)9 ClusteredServiceContainer (io.aeron.cluster.service.ClusteredServiceContainer)8 Assertions (org.junit.jupiter.api.Assertions)8 Mockito.mock (org.mockito.Mockito.mock)8