use of org.agrona.concurrent.AgentRunner in project aeron by real-logic.
the class DedicatedModeArchiveConductor method onStart.
public void onStart() {
super.onStart();
recorderAgentRunner = new AgentRunner(ctx.idleStrategy(), errorHandler, ctx.errorCounter(), recorder);
replayerAgentRunner = new AgentRunner(ctx.idleStrategy(), errorHandler, ctx.errorCounter(), replayer);
AgentRunner.startOnThread(replayerAgentRunner, ctx.threadFactory());
AgentRunner.startOnThread(recorderAgentRunner, ctx.threadFactory());
}
use of org.agrona.concurrent.AgentRunner in project zeebe by zeebe-io.
the class SubscriptionManager method startSubscriptionExecution.
private void startSubscriptionExecution(int numThreads) {
for (int i = 0; i < numThreads; i++) {
final SubscriptionExecutor executor = new SubscriptionExecutor(topicSubscribers, taskSubscribers);
final AgentRunner agentRunner = initAgentRunner(executor);
AgentRunner.startOnThread(agentRunner);
agentRunners.add(agentRunner);
}
}
use of org.agrona.concurrent.AgentRunner in project aeron by real-logic.
the class EventLogAgent method agent.
@SuppressWarnings("Indendation")
private static void agent(final boolean shouldRedefine, final Instrumentation instrumentation) {
if (EventConfiguration.ENABLED_EVENT_CODES == 0) {
return;
}
EventLogAgent.instrumentation = instrumentation;
readerAgentRunner = new AgentRunner(new SleepingMillisIdleStrategy(SLEEP_PERIOD_MS), Throwable::printStackTrace, null, EVENT_LOG_READER_AGENT);
logTransformer = new AgentBuilder.Default(new ByteBuddy().with(TypeValidation.DISABLED)).with(LISTENER).disableClassFormatChanges().with(shouldRedefine ? AgentBuilder.RedefinitionStrategy.RETRANSFORMATION : AgentBuilder.RedefinitionStrategy.DISABLED).type(nameEndsWith("DriverConductor")).transform((builder, typeDescription, classLoader, javaModule) -> builder.visit(to(CleanupInterceptor.CleanupImage.class).on(named("cleanupImage"))).visit(to(CleanupInterceptor.CleanupPublication.class).on(named("cleanupPublication"))).visit(to(CleanupInterceptor.CleanupSubscriptionLink.class).on(named("cleanupSubscriptionLink")))).type(nameEndsWith("ClientCommandAdapter")).transform((builder, typeDescription, classLoader, javaModule) -> builder.visit(to(CmdInterceptor.class).on(named("onMessage")))).type(nameEndsWith("ClientProxy")).transform((builder, typeDescription, classLoader, javaModule) -> builder.visit(to(CmdInterceptor.class).on(named("transmit")))).type(nameEndsWith("SenderProxy")).transform((builder, typeDescription, classLoader, javaModule) -> builder.visit(to(ChannelEndpointInterceptor.SenderProxyInterceptor.RegisterSendChannelEndpoint.class).on(named("registerSendChannelEndpoint"))).visit(to(ChannelEndpointInterceptor.SenderProxyInterceptor.CloseSendChannelEndpoint.class).on(named("closeSendChannelEndpoint")))).type(nameEndsWith("ReceiverProxy")).transform((builder, typeDescription, classLoader, javaModule) -> builder.visit(to(ChannelEndpointInterceptor.ReceiverProxyInterceptor.RegisterReceiveChannelEndpoint.class).on(named("registerReceiveChannelEndpoint"))).visit(to(ChannelEndpointInterceptor.ReceiverProxyInterceptor.CloseReceiveChannelEndpoint.class).on(named("closeReceiveChannelEndpoint")))).type(inheritsAnnotation(EventLog.class)).transform((builder, typeDescription, classLoader, javaModule) -> builder.visit(to(ChannelEndpointInterceptor.SendChannelEndpointInterceptor.Presend.class).on(named("presend"))).visit(to(ChannelEndpointInterceptor.ReceiveChannelEndpointInterceptor.SendTo.class).on(named("sendTo"))).visit(to(ChannelEndpointInterceptor.SendChannelEndpointInterceptor.OnStatusMessage.class).on(named("onStatusMessage"))).visit(to(ChannelEndpointInterceptor.SendChannelEndpointInterceptor.OnNakMessage.class).on(named("onNakMessage"))).visit(to(ChannelEndpointInterceptor.SendChannelEndpointInterceptor.OnRttMeasurement.class).on(named("onRttMeasurement"))).visit(to(ChannelEndpointInterceptor.ReceiveChannelEndpointInterceptor.OnDataPacket.class).on(named("onDataPacket"))).visit(to(ChannelEndpointInterceptor.ReceiveChannelEndpointInterceptor.OnSetupMessage.class).on(named("onSetupMessage"))).visit(to(ChannelEndpointInterceptor.ReceiveChannelEndpointInterceptor.OnRttMeasurement.class).on(named("onRttMeasurement")))).installOn(instrumentation);
final Thread thread = new Thread(readerAgentRunner);
thread.setName("event log reader");
thread.setDaemon(true);
thread.start();
}
use of org.agrona.concurrent.AgentRunner in project Aeron by real-logic.
the class AgentBuilderListener method startLogging.
private static synchronized void startLogging(final AgentBuilder.RedefinitionStrategy redefinitionStrategy, final Instrumentation instrumentation, final EnumMap<ConfigOption, String> configOptions) {
if (null != logTransformer) {
throw new IllegalStateException("agent already instrumented");
}
EventConfiguration.init(configOptions.get(ENABLED_DRIVER_EVENT_CODES), configOptions.get(DISABLED_DRIVER_EVENT_CODES), configOptions.get(ENABLED_ARCHIVE_EVENT_CODES), configOptions.get(DISABLED_ARCHIVE_EVENT_CODES), configOptions.get(ENABLED_CLUSTER_EVENT_CODES), configOptions.get(DISABLED_CLUSTER_EVENT_CODES));
if (DRIVER_EVENT_CODES.isEmpty() && ARCHIVE_EVENT_CODES.isEmpty() && CLUSTER_EVENT_CODES.isEmpty()) {
return;
}
EventLogAgent.instrumentation = instrumentation;
readerAgentRunner = new AgentRunner(new SleepingMillisIdleStrategy(SLEEP_PERIOD_MS), Throwable::printStackTrace, null, newReaderAgent(configOptions));
AgentBuilder agentBuilder = new AgentBuilder.Default(new ByteBuddy().with(TypeValidation.DISABLED)).disableClassFormatChanges().with(new AgentBuilderListener()).with(redefinitionStrategy);
agentBuilder = addDriverInstrumentation(agentBuilder);
agentBuilder = addArchiveInstrumentation(agentBuilder);
agentBuilder = addClusterInstrumentation(agentBuilder);
logTransformer = agentBuilder.installOn(instrumentation);
thread = new Thread(readerAgentRunner);
thread.setName("event-log-reader");
thread.setDaemon(true);
thread.start();
}
Aggregations