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);
}
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());
}
}
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;
}
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));
}
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);
}
});
}
Aggregations