Java Code Examples for org.apache.nifi.controller.repository.FlowFileSwapManager

The following examples show how to use org.apache.nifi.controller.repository.FlowFileSwapManager. These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source Project: localization_nifi   Source File: StandardFlowFileQueue.java    License: Apache License 2.0 6 votes vote down vote up
public StandardFlowFileQueue(final String identifier, final Connection connection, final FlowFileRepository flowFileRepo, final ProvenanceEventRepository provRepo,
    final ResourceClaimManager resourceClaimManager, final ProcessScheduler scheduler, final FlowFileSwapManager swapManager, final EventReporter eventReporter, final int swapThreshold) {
    activeQueue = new PriorityQueue<>(20, new Prioritizer(new ArrayList<FlowFilePrioritizer>()));
    priorities = new ArrayList<>();
    swapQueue = new ArrayList<>();
    this.eventReporter = eventReporter;
    this.swapManager = swapManager;
    this.flowFileRepository = flowFileRepo;
    this.provRepository = provRepo;
    this.resourceClaimManager = resourceClaimManager;

    this.identifier = identifier;
    this.swapThreshold = swapThreshold;
    this.scheduler = scheduler;
    this.connection = connection;

    readLock = new TimedLock(this.lock.readLock(), identifier + " Read Lock", 100);
    writeLock = new TimedLock(this.lock.writeLock(), identifier + " Write Lock", 100);
}
 
Example 2
Source Project: nifi   Source File: SwappablePriorityQueue.java    License: Apache License 2.0 6 votes vote down vote up
public SwappablePriorityQueue(final FlowFileSwapManager swapManager, final int swapThreshold, final EventReporter eventReporter, final FlowFileQueue flowFileQueue,
    final DropFlowFileAction dropAction, final String swapPartitionName) {
    this.swapManager = swapManager;
    this.swapThreshold = swapThreshold;

    this.activeQueue = new PriorityQueue<>(20, new QueuePrioritizer(Collections.emptyList()));
    this.swapQueue = new ArrayList<>();
    this.eventReporter = eventReporter;
    this.flowFileQueue = flowFileQueue;
    this.dropAction = dropAction;
    this.swapPartitionName = swapPartitionName;

    final ReentrantReadWriteLock lock = new ReentrantReadWriteLock(true);
    readLock = new TimedLock(lock.readLock(), flowFileQueue.getIdentifier() + " Read Lock", 100);
    writeLock = new TimedLock(lock.writeLock(), flowFileQueue.getIdentifier() + " Write Lock", 100);
}
 
Example 3
Source Project: nifi   Source File: StandardExtensionDiscoveringManager.java    License: Apache License 2.0 6 votes vote down vote up
public StandardExtensionDiscoveringManager() {
    definitionMap.put(Processor.class, new HashSet<>());
    definitionMap.put(FlowFilePrioritizer.class, new HashSet<>());
    definitionMap.put(ReportingTask.class, new HashSet<>());
    definitionMap.put(ControllerService.class, new HashSet<>());
    definitionMap.put(Authorizer.class, new HashSet<>());
    definitionMap.put(UserGroupProvider.class, new HashSet<>());
    definitionMap.put(AccessPolicyProvider.class, new HashSet<>());
    definitionMap.put(LoginIdentityProvider.class, new HashSet<>());
    definitionMap.put(ProvenanceRepository.class, new HashSet<>());
    definitionMap.put(ComponentStatusRepository.class, new HashSet<>());
    definitionMap.put(FlowFileRepository.class, new HashSet<>());
    definitionMap.put(FlowFileSwapManager.class, new HashSet<>());
    definitionMap.put(ContentRepository.class, new HashSet<>());
    definitionMap.put(StateProvider.class, new HashSet<>());
    definitionMap.put(StatusAnalyticsModel.class, new HashSet<>());
}
 
Example 4
Source Project: localization_nifi   Source File: FlowController.java    License: Apache License 2.0 5 votes vote down vote up
private static FlowFileSwapManager createSwapManager(final NiFiProperties properties) {
    final String implementationClassName = properties.getProperty(NiFiProperties.FLOWFILE_SWAP_MANAGER_IMPLEMENTATION, DEFAULT_SWAP_MANAGER_IMPLEMENTATION);
    if (implementationClassName == null) {
        return null;
    }

    try {
        return NarThreadContextClassLoader.createInstance(implementationClassName, FlowFileSwapManager.class, properties);
    } catch (final Exception e) {
        throw new RuntimeException(e);
    }
}
 
Example 5
Source Project: nifi   Source File: FlowController.java    License: Apache License 2.0 5 votes vote down vote up
public FlowFileSwapManager createSwapManager() {
    final String implementationClassName = nifiProperties.getProperty(NiFiProperties.FLOWFILE_SWAP_MANAGER_IMPLEMENTATION, DEFAULT_SWAP_MANAGER_IMPLEMENTATION);
    if (implementationClassName == null) {
        return null;
    }

    try {
        final FlowFileSwapManager swapManager = NarThreadContextClassLoader.createInstance(extensionManager, implementationClassName, FlowFileSwapManager.class, nifiProperties);

        final EventReporter eventReporter = createEventReporter();
        try (final NarCloseable narCloseable = NarCloseable.withNarLoader()) {
            final SwapManagerInitializationContext initializationContext = new SwapManagerInitializationContext() {
                @Override
                public ResourceClaimManager getResourceClaimManager() {
                    return resourceClaimManager;
                }

                @Override
                public FlowFileRepository getFlowFileRepository() {
                    return flowFileRepository;
                }

                @Override
                public EventReporter getEventReporter() {
                    return eventReporter;
                }
            };

            swapManager.initialize(initializationContext);
        }

        return swapManager;
    } catch (final Exception e) {
        throw new RuntimeException(e);
    }
}
 
Example 6
Source Project: nifi   Source File: StandardRebalancingPartition.java    License: Apache License 2.0 5 votes vote down vote up
public StandardRebalancingPartition(final FlowFileSwapManager swapManager, final int swapThreshold, final EventReporter eventReporter,
                                    final LoadBalancedFlowFileQueue flowFileQueue, final DropFlowFileAction dropAction) {

    this.queue = new BlockingSwappablePriorityQueue(swapManager, swapThreshold, eventReporter, flowFileQueue, dropAction, SWAP_PARTITION_NAME);
    this.queueIdentifier = flowFileQueue.getIdentifier();
    this.flowFileQueue = flowFileQueue;
    this.description = "RebalancingPartition[queueId=" + queueIdentifier + "]";
}
 
Example 7
Source Project: nifi   Source File: StandardFlowFileQueue.java    License: Apache License 2.0 5 votes vote down vote up
public StandardFlowFileQueue(final String identifier, final ConnectionEventListener eventListener, final FlowFileRepository flowFileRepo, final ProvenanceEventRepository provRepo,
                             final ResourceClaimManager resourceClaimManager, final ProcessScheduler scheduler, final FlowFileSwapManager swapManager, final EventReporter eventReporter,
                             final int swapThreshold, final long defaultBackPressureObjectThreshold, final String defaultBackPressureDataSizeThreshold) {

    super(identifier, scheduler, flowFileRepo, provRepo, resourceClaimManager);
    this.swapManager = swapManager;
    this.queue = new SwappablePriorityQueue(swapManager, swapThreshold, eventReporter, this, this::drop, null);
    this.eventListener = eventListener;

    writeLock = new TimedLock(this.lock.writeLock(), getIdentifier() + " Write Lock", 100);

    setBackPressureDataSizeThreshold(defaultBackPressureDataSizeThreshold);
    setBackPressureObjectThreshold(defaultBackPressureObjectThreshold);
}
 
Example 8
Source Project: nifi   Source File: ClusteredSwapFileIT.java    License: Apache License 2.0 5 votes vote down vote up
protected FlowFileQueue createFlowFileQueue(final String uuid) {
    final ProcessScheduler processScheduler = getFlowController().getProcessScheduler();
    final ResourceClaimManager resourceClaimManager = getFlowController().getResourceClaimManager();
    final FlowFileSwapManager swapManager = getFlowController().createSwapManager();

    final AsyncLoadBalanceClientRegistry clientRegistry = Mockito.mock(AsyncLoadBalanceClientRegistry.class);

    return new SocketLoadBalancedFlowFileQueue(uuid, ConnectionEventListener.NOP_EVENT_LISTENER, processScheduler, getFlowFileRepository(), getProvenanceRepository(),
        getContentRepository(), resourceClaimManager, getClusterCoordinator(), clientRegistry, swapManager, 20000, EventReporter.NO_OP);
}
 
Example 9
Source Project: localization_nifi   Source File: FlowController.java    License: Apache License 2.0 4 votes vote down vote up
/**
 * Creates a connection between two Connectable objects.
 *
 * @param id required ID of the connection
 * @param name the name of the connection, or <code>null</code> to leave the
 * connection unnamed
 * @param source required source
 * @param destination required destination
 * @param relationshipNames required collection of relationship names
 * @return
 *
 * @throws NullPointerException if the ID, source, destination, or set of
 * relationships is null.
 * @throws IllegalArgumentException if <code>relationships</code> is an
 * empty collection
 */
public Connection createConnection(final String id, final String name, final Connectable source, final Connectable destination, final Collection<String> relationshipNames) {
    final StandardConnection.Builder builder = new StandardConnection.Builder(processScheduler);

    final List<Relationship> relationships = new ArrayList<>();
    for (final String relationshipName : requireNonNull(relationshipNames)) {
        relationships.add(new Relationship.Builder().name(relationshipName).build());
    }

    // Create and initialize a FlowFileSwapManager for this connection
    final FlowFileSwapManager swapManager = createSwapManager(nifiProperties);
    final EventReporter eventReporter = createEventReporter(getBulletinRepository());

    try (final NarCloseable narCloseable = NarCloseable.withNarLoader()) {
        final SwapManagerInitializationContext initializationContext = new SwapManagerInitializationContext() {
            @Override
            public ResourceClaimManager getResourceClaimManager() {
                return resourceClaimManager;
            }

            @Override
            public FlowFileRepository getFlowFileRepository() {
                return flowFileRepository;
            }

            @Override
            public EventReporter getEventReporter() {
                return eventReporter;
            }
        };

        swapManager.initialize(initializationContext);
    }

    return builder.id(requireNonNull(id).intern())
            .name(name == null ? null : name.intern())
            .relationships(relationships)
            .source(requireNonNull(source))
            .destination(destination)
            .swapManager(swapManager)
            .queueSwapThreshold(nifiProperties.getQueueSwapThreshold())
            .eventReporter(eventReporter)
            .resourceClaimManager(resourceClaimManager)
            .flowFileRepository(flowFileRepository)
            .provenanceRepository(provenanceRepository)
            .build();
}
 
Example 10
Source Project: nifi   Source File: FlowController.java    License: Apache License 2.0 4 votes vote down vote up
/**
 * Creates a connection between two Connectable objects.
 *
 * @param id                required ID of the connection
 * @param name              the name of the connection, or <code>null</code> to leave the
 *                          connection unnamed
 * @param source            required source
 * @param destination       required destination
 * @param relationshipNames required collection of relationship names
 * @return the connection
 * @throws NullPointerException     if the ID, source, destination, or set of relationships is null.
 * @throws IllegalArgumentException if <code>relationships</code> is an empty collection
 */
public Connection createConnection(final String id, final String name, final Connectable source, final Connectable destination, final Collection<String> relationshipNames) {
    final StandardConnection.Builder builder = new StandardConnection.Builder(processScheduler);

    final List<Relationship> relationships = new ArrayList<>();
    for (final String relationshipName : requireNonNull(relationshipNames)) {
        relationships.add(new Relationship.Builder().name(relationshipName).build());
    }

    // Create and initialize a FlowFileSwapManager for this connection
    final FlowFileSwapManager swapManager = createSwapManager();
    final EventReporter eventReporter = createEventReporter();

    try (final NarCloseable narCloseable = NarCloseable.withNarLoader()) {
        final SwapManagerInitializationContext initializationContext = new SwapManagerInitializationContext() {
            @Override
            public ResourceClaimManager getResourceClaimManager() {
                return resourceClaimManager;
            }

            @Override
            public FlowFileRepository getFlowFileRepository() {
                return flowFileRepository;
            }

            @Override
            public EventReporter getEventReporter() {
                return eventReporter;
            }
        };

        swapManager.initialize(initializationContext);
    }

    final FlowFileQueueFactory flowFileQueueFactory = new FlowFileQueueFactory() {
        @Override
        public FlowFileQueue createFlowFileQueue(final LoadBalanceStrategy loadBalanceStrategy, final String partitioningAttribute, final ConnectionEventListener eventListener) {
            final FlowFileQueue flowFileQueue;

            if (clusterCoordinator == null) {
                flowFileQueue = new StandardFlowFileQueue(id, eventListener, flowFileRepository, provenanceRepository, resourceClaimManager, processScheduler, swapManager,
                        eventReporter, nifiProperties.getQueueSwapThreshold(), nifiProperties.getDefaultBackPressureObjectThreshold(), nifiProperties.getDefaultBackPressureDataSizeThreshold());
            } else {
                flowFileQueue = new SocketLoadBalancedFlowFileQueue(id, eventListener, processScheduler, flowFileRepository, provenanceRepository, contentRepository, resourceClaimManager,
                        clusterCoordinator, loadBalanceClientRegistry, swapManager, nifiProperties.getQueueSwapThreshold(), eventReporter);

                flowFileQueue.setBackPressureObjectThreshold(nifiProperties.getDefaultBackPressureObjectThreshold());
                flowFileQueue.setBackPressureDataSizeThreshold(nifiProperties.getDefaultBackPressureDataSizeThreshold());
            }

            return flowFileQueue;
        }
    };

    final Connection connection = builder.id(requireNonNull(id).intern())
            .name(name == null ? null : name.intern())
            .relationships(relationships)
            .source(requireNonNull(source))
            .destination(destination)
            .flowFileQueueFactory(flowFileQueueFactory)
            .build();

    return connection;
}
 
Example 11
Source Project: nifi   Source File: BlockingSwappablePriorityQueue.java    License: Apache License 2.0 4 votes vote down vote up
public BlockingSwappablePriorityQueue(final FlowFileSwapManager swapManager, final int swapThreshold, final EventReporter eventReporter, final FlowFileQueue flowFileQueue,
    final DropFlowFileAction dropAction, final String partitionName) {

    super(swapManager, swapThreshold, eventReporter, flowFileQueue, dropAction, partitionName);
}
 
Example 12
Source Project: nifi   Source File: SocketLoadBalancedFlowFileQueue.java    License: Apache License 2.0 4 votes vote down vote up
public SocketLoadBalancedFlowFileQueue(final String identifier, final ConnectionEventListener eventListener, final ProcessScheduler scheduler, final FlowFileRepository flowFileRepo,
                                       final ProvenanceEventRepository provRepo, final ContentRepository contentRepo, final ResourceClaimManager resourceClaimManager,
                                       final ClusterCoordinator clusterCoordinator, final AsyncLoadBalanceClientRegistry clientRegistry, final FlowFileSwapManager swapManager,
                                       final int swapThreshold, final EventReporter eventReporter) {

    super(identifier, scheduler, flowFileRepo, provRepo, resourceClaimManager);
    this.eventListener = eventListener;
    this.eventReporter = eventReporter;
    this.swapManager = swapManager;
    this.flowFileRepo = flowFileRepo;
    this.provRepo = provRepo;
    this.contentRepo = contentRepo;
    this.clusterCoordinator = clusterCoordinator;
    this.clientRegistry = clientRegistry;

    localPartition = new SwappablePriorityQueueLocalPartition(swapManager, swapThreshold, eventReporter, this, this::drop);
    rebalancingPartition = new StandardRebalancingPartition(swapManager, swapThreshold, eventReporter, this, this::drop);

    // Create a RemoteQueuePartition for each node
    nodeIdentifiers = clusterCoordinator == null ? Collections.emptySet() : clusterCoordinator.getNodeIdentifiers();

    final List<NodeIdentifier> sortedNodeIdentifiers = new ArrayList<>(nodeIdentifiers);
    sortedNodeIdentifiers.sort(Comparator.comparing(NodeIdentifier::getApiAddress));

    if (sortedNodeIdentifiers.isEmpty()) {
        // No Node Identifiers are known yet. Just create the partitions using the local partition.
        queuePartitions = new QueuePartition[] { localPartition };
    } else {
        // The node identifiers are known. Create the partitions using the local partition and 1 Remote Partition for each node
        // that is not the local node identifier. If the Local Node Identifier is not yet known, that's okay. When it becomes known,
        // the queuePartitions array will be recreated with the appropriate partitions.
        final List<QueuePartition> partitionList = new ArrayList<>();

        final NodeIdentifier localNodeId = clusterCoordinator.getLocalNodeIdentifier();
        for (final NodeIdentifier nodeId : sortedNodeIdentifiers) {
            if (nodeId.equals(localNodeId)) {
                partitionList.add(localPartition);
            } else {
                partitionList.add(createRemotePartition(nodeId));
            }
        }

        // Ensure that our list of queue partitions always contains the local partition.
        if (!partitionList.contains(localPartition)) {
            partitionList.add(localPartition);
        }

        queuePartitions = partitionList.toArray(new QueuePartition[0]);
    }

    partitioner = new LocalPartitionPartitioner();

    if (clusterCoordinator != null) {
        clusterCoordinator.registerEventListener(new ClusterEventListener());
    }

    rebalancingPartition.start(partitioner);
}
 
Example 13
Source Project: nifi   Source File: SwappablePriorityQueueLocalPartition.java    License: Apache License 2.0 4 votes vote down vote up
public SwappablePriorityQueueLocalPartition(final FlowFileSwapManager swapManager, final int swapThreshold, final EventReporter eventReporter,
        final FlowFileQueue flowFileQueue, final DropFlowFileAction dropAction) {
    this.priorityQueue = new SwappablePriorityQueue(swapManager, swapThreshold, eventReporter, flowFileQueue, dropAction, SWAP_PARTITION_NAME);
    this.flowFileQueue = flowFileQueue;
    this.description = "SwappablePriorityQueueLocalPartition[queueId=" + flowFileQueue.getIdentifier() + "]";
}
 
Example 14
Source Project: nifi   Source File: ContentRepositoryScanTask.java    License: Apache License 2.0 4 votes vote down vote up
@Override
public DiagnosticsDumpElement captureDump(final boolean verbose) {
    if (!verbose) {
        // This task is very expensive, as it must scan the contents of the Content Repository. As such, it will not
        // run at all if verbose output is disabled.
        return null;
    }

    final ContentRepository contentRepository = flowController.getRepositoryContextFactory().getContentRepository();
    if (!contentRepository.isActiveResourceClaimsSupported()) {
        return new StandardDiagnosticsDumpElement("Content Repository Scan", Collections.singletonList("Current Content Repository does not support scanning for in-use content"));
    }

    final FlowFileRepository flowFileRepository = flowController.getRepositoryContextFactory().getFlowFileRepository();
    final ResourceClaimManager resourceClaimManager = flowController.getResourceClaimManager();
    final FlowFileSwapManager swapManager = flowController.createSwapManager();

    final List<String> details = new ArrayList<>();

    for (final String containerName : contentRepository.getContainerNames()) {
        try {
            final Set<ResourceClaim> resourceClaims = contentRepository.getActiveResourceClaims(containerName);

            final Map<ResourceClaim, Set<ResourceClaimReference>> referenceMap = flowFileRepository.findResourceClaimReferences(resourceClaims, swapManager);

            for (final ResourceClaim resourceClaim : resourceClaims) {
                final int claimCount = resourceClaimManager.getClaimantCount(resourceClaim);
                final boolean inUse = resourceClaim.isInUse();
                final boolean destructable = resourceClaimManager.isDestructable(resourceClaim);

                final Set<ResourceClaimReference> references = referenceMap == null ? Collections.emptySet() : referenceMap.getOrDefault(resourceClaim, Collections.emptySet());

                final String path = resourceClaim.getContainer() + "/" + resourceClaim.getSection() + "/" + resourceClaim.getId();
                details.add(String.format("%1$s, Claimant Count = %2$d, In Use = %3$b, Awaiting Destruction = %4$b, References (%5$d) = %6$s",
                    path, claimCount, inUse, destructable,  references.size(), references.toString()));
            }
        } catch (final Exception e) {
            logger.error("Failed to obtain listing of Active Resource Claims for container {}", containerName, e);
            details.add("Failed to obtain listing of Active Resource Claims in container " + containerName);
        }
    }


    return new StandardDiagnosticsDumpElement("Content Repository Scan", details);
}
 
Example 15
Source Project: nifi   Source File: FrameworkIntegrationTest.java    License: Apache License 2.0 4 votes vote down vote up
protected final void initialize(final NiFiProperties nifiProperties) throws IOException {
    this.nifiProperties = nifiProperties;

    final FlowFileEventRepository flowFileEventRepository = new RingBufferEventRepository(5);

    final BulletinRepository bulletinRepo = new VolatileBulletinRepository();
    flowEngine = new FlowEngine(4, "unit test flow engine");
    extensionManager = new DirectInjectionExtensionManager();

    extensionManager.injectExtensionType(FlowFileRepository.class, WriteAheadFlowFileRepository.class);
    extensionManager.injectExtensionType(ContentRepository.class, FileSystemRepository.class);
    extensionManager.injectExtensionType(ProvenanceRepository.class, WriteAheadProvenanceRepository.class);
    extensionManager.injectExtensionType(StateProvider.class, WriteAheadLocalStateProvider.class);
    extensionManager.injectExtensionType(ComponentStatusRepository.class, VolatileComponentStatusRepository.class);
    extensionManager.injectExtensionType(FlowFileSwapManager.class, FileSystemSwapManager.class);

    extensionManager.injectExtensionType(Processor.class, BiConsumerProcessor.class);
    extensionManager.injectExtensionType(Processor.class, GenerateProcessor.class);
    extensionManager.injectExtensionType(Processor.class, TerminateOnce.class);
    extensionManager.injectExtensionType(Processor.class, TerminateAll.class);
    extensionManager.injectExtensionType(Processor.class, NopProcessor.class);
    extensionManager.injectExtensionType(Processor.class, UsernamePasswordProcessor.class);

    injectExtensionTypes(extensionManager);
    systemBundle = SystemBundle.create(nifiProperties);
    extensionManager.discoverExtensions(systemBundle, Collections.emptySet());

    final StringEncryptor encryptor = StringEncryptor.createEncryptor("PBEWITHMD5AND256BITAES-CBC-OPENSSL", "BC", "unit-test");
    final Authorizer authorizer = new AlwaysAuthorizedAuthorizer();
    final AuditService auditService = new NopAuditService();

    if (isClusteredTest()) {
        final File zookeeperDir = new File("target/state/zookeeper");
        final File version2Dir =  new File(zookeeperDir, "version-2");

        if (!version2Dir.exists()) {
            assertTrue(version2Dir.mkdirs());
        }

        final File[] children = version2Dir.listFiles();
        if (children != null) {
            for (final File file : children) {
                FileUtils.deleteFile(file, true);
            }
        }

        clusterCoordinator = Mockito.mock(ClusterCoordinator.class);
        final HeartbeatMonitor heartbeatMonitor = Mockito.mock(HeartbeatMonitor.class);
        final NodeProtocolSender protocolSender = Mockito.mock(NodeProtocolSender.class);
        final LeaderElectionManager leaderElectionManager = new CuratorLeaderElectionManager(2, nifiProperties);

        final NodeIdentifier localNodeId = new NodeIdentifier(UUID.randomUUID().toString(), "localhost", 8111, "localhost", 8081,
            "localhost", 8082, "localhost", 8083, 8084, false, Collections.emptySet());
        final NodeIdentifier node2Id = new NodeIdentifier(UUID.randomUUID().toString(), "localhost", 8222, "localhost", 8081,
            "localhost", 8082, "localhost", 8083, 8084, false, Collections.emptySet());

        final Set<NodeIdentifier> nodeIdentifiers = new HashSet<>();
        nodeIdentifiers.add(localNodeId);
        nodeIdentifiers.add(node2Id);
        Mockito.when(clusterCoordinator.getNodeIdentifiers()).thenReturn(nodeIdentifiers);
        Mockito.when(clusterCoordinator.getLocalNodeIdentifier()).thenReturn(localNodeId);

        flowController = FlowController.createClusteredInstance(flowFileEventRepository, nifiProperties, authorizer, auditService, encryptor, protocolSender, bulletinRepo, clusterCoordinator,
            heartbeatMonitor, leaderElectionManager, VariableRegistry.ENVIRONMENT_SYSTEM_REGISTRY, flowRegistryClient, extensionManager);

        flowController.setClustered(true, UUID.randomUUID().toString());
        flowController.setNodeId(localNodeId);

        flowController.setConnectionStatus(new NodeConnectionStatus(localNodeId, NodeConnectionState.CONNECTED));
    } else {
        flowController = FlowController.createStandaloneInstance(flowFileEventRepository, nifiProperties, authorizer, auditService, encryptor, bulletinRepo,
            VariableRegistry.ENVIRONMENT_SYSTEM_REGISTRY, flowRegistryClient, extensionManager);
    }

    processScheduler = new StandardProcessScheduler(flowEngine, flowController, encryptor, flowController.getStateManagerProvider(), nifiProperties);

    final RepositoryContextFactory repositoryContextFactory = flowController.getRepositoryContextFactory();
    final SchedulingAgent timerDrivenSchedulingAgent = new TimerDrivenSchedulingAgent(flowController, flowEngine, repositoryContextFactory, encryptor, nifiProperties);
    processScheduler.setSchedulingAgent(SchedulingStrategy.TIMER_DRIVEN, timerDrivenSchedulingAgent);

    flowFileSwapManager = flowController.createSwapManager();
    resourceClaimManager = flowController.getResourceClaimManager();
}