Class StandardProcessorNode
- All Implemented Interfaces:
Authorizable,ComponentAuthorizable,VersionedComponent,Connectable,Positionable,ComponentNode,Triggerable,GroupedComponent
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final Map<Thread, ActiveTask> private BackoffMechanismprivate LogLevelprivate final AtomicReference<String> private final AtomicIntegerprivate final Map<org.apache.nifi.processor.Relationship, Set<Connection>> static final Stringstatic final TimeUnitstatic final Stringprivate ScheduledStateprivate final Map<Connection, Connectable> private org.apache.nifi.scheduling.ExecutionNodeprivate booleanprivate final intprivate final Stringprivate final AtomicReference<List<Connection>> private static final org.slf4j.Loggerprivate final AtomicBooleanprivate Stringprivate List<ParameterReference> private final AtomicReference<String> private final AtomicReference<Position> private final AtomicReference<ProcessGroup> private final AtomicReference<ProcessorDetails> private final ProcessSchedulerprivate intprivate static final Stringprivate longprivate final AtomicLongprivate final AtomicReference<String> private org.apache.nifi.scheduling.SchedulingStrategyprivate final AtomicReference<List<CompletableFuture<Void>>> private final AtomicReference<Map<String, String>> private final AtomicReference<Set<org.apache.nifi.processor.Relationship>> private final AtomicReference<String> private final AtomicLongprivate longprivate final AtomicReference<String> Fields inherited from class org.apache.nifi.controller.ProcessorNode
DEFAULT_BACKOFF_MECHANISM, DEFAULT_MAX_BACKOFF_PERIOD, DEFAULT_RETRY_COUNT, scheduledStateFields inherited from interface org.apache.nifi.controller.Triggerable
MINIMUM_SCHEDULING_NANOS -
Constructor Summary
ConstructorsConstructorDescriptionStandardProcessorNode(LoggableComponent<org.apache.nifi.processor.Processor> processor, String uuid, ValidationContextFactory validationContextFactory, ProcessScheduler scheduler, ControllerServiceProvider controllerServiceProvider, String componentType, String componentCanonicalClass, ReloadComponent reloadComponent, ExtensionManager extensionManager, ValidationTrigger validationTrigger, boolean isExtensionMissing) StandardProcessorNode(LoggableComponent<org.apache.nifi.processor.Processor> processor, String uuid, ValidationContextFactory validationContextFactory, ProcessScheduler scheduler, ControllerServiceProvider controllerServiceProvider, ReloadComponent reloadComponent, ExtensionManager extensionManager, ValidationTrigger validationTrigger) -
Method Summary
Modifier and TypeMethodDescriptionprivate voidvoidaddConnection(Connection connection) private voidaddStopFuture(CompletableFuture<Void> future) Adds the given CompletableFuture to the list of those that will completed whenever the processor has fully stoppedprivate voidMarks the processor as fully stopped, and completes any futures that are to be completed as a resultprotected Collection<ValidationResult> computeValidationErrors(ValidationContext validationContext) private voidvoiddisable()voidenable()booleanEstablishes node equality (based on the processor's identifier)evaluateParameters(String value) intgetActiveThreads(ThreadDetails threadDetails) Set<org.apache.nifi.processor.Relationship> Class<?> getConnections(org.apache.nifi.processor.Relationship relationship) org.apache.nifi.scheduling.ExecutionNode(package private) List<Connection> org.apache.nifi.annotation.behavior.InputRequirement.Requirementintprotected ParameterContextlonggetPenalizationPeriod(TimeUnit timeUnit) org.apache.nifi.processor.Processororg.apache.nifi.processor.RelationshipgetRelationship(String relationshipName) Collection<org.apache.nifi.processor.Relationship> intlonggetRunDuration(TimeUnit timeUnit) longgetSchedulingPeriod(TimeUnit timeUnit) org.apache.nifi.scheduling.SchedulingStrategygetStyle()intSet<org.apache.nifi.processor.Relationship> longlonggetYieldPeriod(TimeUnit timeUnit) inthashCode()booleanprivate voidinitiateStart(ScheduledExecutorService taskScheduler, long administrativeYieldMillis, long timeoutMillis, AtomicLong startupAttemptCount, Supplier<org.apache.nifi.processor.ProcessContext> processContextFactory, SchedulingAgentCallback schedulingAgentCallback, boolean triggerLifecycleMethods) booleanisAutoTerminated(org.apache.nifi.processor.Relationship relationship) booleanbooleanIndicates whether the processor's executionNode configuration is restricted to run only in primary nodebooleanbooleanbooleanisRelationshipRetried(org.apache.nifi.processor.Relationship relationship) booleanbooleanbooleanbooleanbooleanisTerminated(Thread thread) booleanbooleanbooleanbooleanvoidmigrateConfiguration(Map<String, String> rawPropertyValues, ControllerServiceFactory serviceFactory) private voidmigrateProperties(Map<String, String> originalPropertyValues, ControllerServiceFactory serviceFactory) private voidprivate voidmonitorAsyncTask(Future<?> taskFuture, Future<?> monitoringFuture, long completionTimestamp) voidnotifyPrimaryNodeChanged(org.apache.nifi.annotation.notification.PrimaryNodeState nodeState, LifecycleState lifecycleState) voidonConfigurationRestored(org.apache.nifi.processor.ProcessContext context) voidonTrigger(org.apache.nifi.processor.ProcessContext context, org.apache.nifi.processor.ProcessSessionFactory sessionFactory) voidvoidremoveConnection(Connection connection) private voidrun(ScheduledExecutorService taskScheduler, long administrativeYieldMillis, long timeoutMillis, Supplier<org.apache.nifi.processor.ProcessContext> processContextFactory, SchedulingAgentCallback schedulingAgentCallback, boolean failIfStopping, ScheduledState desiredState, ScheduledState scheduledState, boolean triggerLifecycleMethods) voidrunOnce(ScheduledExecutorService taskScheduler, long administrativeYieldMillis, long timeoutMillis, Supplier<org.apache.nifi.processor.ProcessContext> processContextFactory, SchedulingAgentCallback schedulingAgentCallback) Similar tostart(ScheduledExecutorService, long, long, Supplier, SchedulingAgentCallback, boolean, boolean), except for the following: Once theProcessor.onTrigger(ProcessContext, ProcessSessionFactory)method has been invoked successfully, the processor is scehduled to be stopped immediately.voidsetAnnotationData(String data) voidsetAutoTerminatedRelationships(Set<org.apache.nifi.processor.Relationship> terminate) voidsetBackoffMechanism(BackoffMechanism backoffMechanism) voidsetBulletinLevel(LogLevel level) voidsetComments(String comments) voidsetExecutionNode(org.apache.nifi.scheduling.ExecutionNode executionNode) private voidsetIncomingConnections(List<Connection> incoming) voidsetLossTolerant(boolean lossTolerant) Indicates whether flow file content made by this processor must be persistedvoidsetMaxBackoffPeriod(String maxBackoffPeriod) voidsetMaxConcurrentTasks(int taskCount) Determines the number of concurrent tasks that may be running for this processor.voidvoidsetPenalizationPeriod(String penalizationPeriod) voidsetPosition(Position position) voidsetProcessGroup(ProcessGroup group) voidsetProcessor(LoggableComponent<org.apache.nifi.processor.Processor> processor) voidsetRetriedRelationships(Set<String> retriedRelationships) voidsetRetryCount(Integer retryCount) voidsetRunDuration(long duration, TimeUnit timeUnit) voidsetSchedulingPeriod(String schedulingPeriod) voidsetSchedulingStrategy(org.apache.nifi.scheduling.SchedulingStrategy schedulingStrategy) Updates the Scheduling Strategy used for this ProcessorvoidvoidsetVersionedComponentId(String versionedComponentId) voidsetYieldPeriod(String yieldPeriod) voidstart(ScheduledExecutorService taskScheduler, long administrativeYieldMillis, long timeoutMillis, Supplier<org.apache.nifi.processor.ProcessContext> processContextFactory, SchedulingAgentCallback schedulingAgentCallback, boolean failIfStopping, boolean triggerLifecycleMethods) Will idempotently start the processor using the following sequence: Validate Processor's state (e.g., PropertyDescriptors, ControllerServices etc.) Transition (atomically) Processor's scheduled state form STOPPED to STARTING.stop(ProcessScheduler processScheduler, ScheduledExecutorService executor, org.apache.nifi.processor.ProcessContext processContext, SchedulingAgent schedulingAgent, LifecycleState lifecycleState, boolean triggerLifecycleMethods) Will idempotently stop the processor using the following sequence: Transition (atomically) Processor's scheduled state from RUNNING to STOPPING.inttoString()voidupdateConnection(Connection connection) private voidvoidvoidvoidverifyCanDelete(boolean ignoreConnections) voidvoidvoidvoidvoidvoidverifyConfiguration(org.apache.nifi.processor.ProcessContext context, ComponentLog logger, Map<String, String> attributes, ExtensionManager extensionManager) voidprivate voidvoidyield()Causes the processor not to be scheduled for some period of time.voidMethods inherited from class org.apache.nifi.controller.ProcessorNode
getPhysicalScheduledState, getScheduledState, performFlowAnalysisOnThis, verifyCanPerformVerificationMethods inherited from class org.apache.nifi.controller.AbstractComponentNode
decrementReferenceCounts, determineClasloaderIsolationKey, getAdditionalClasspathResources, getAdditionalClasspathResources, getAdditionalClasspathResources, getAnnotationData, getCanonicalClassName, getComponentType, getControllerServiceProvider, getEffectivePropertyValue, getEffectivePropertyValues, getExtensionManager, getName, getProperties, getProperty, getPropertyDescriptor, getPropertyDescriptors, getRawPropertyValue, getRawPropertyValues, getReferencedAttributeNames, getReferencedParameterNames, getReloadComponent, getValidationContext, getValidationContextFactory, getValidationErrors, getValidationState, getValidationStatus, getValidationStatus, incrementReferenceCounts, isClasspathDifferent, isExtensionMissing, isReferencingParameter, isReferencingParameter, isReloadAdditionalResourcesNecessary, isSensitiveDynamicProperty, mapRawValueToEffectiveValue, onParametersModified, onPropertyModified, overwriteProperties, pauseValidationTrigger, performValidation, performValidation, performValidation, refreshProperties, reloadAdditionalResourcesIfNecessary, resetValidationState, resumeValidationTrigger, setAdditionalResourcesFingerprint, setExtensionMissing, setProperties, validateReferencedControllerServices, verifyCanUpdateBundle, verifyCanUpdateProperties, verifyConfigMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface org.apache.nifi.authorization.resource.Authorizable
authorize, checkAuthorization, getRequestedResource, isAuthorizedMethods inherited from interface org.apache.nifi.controller.ComponentNode
authorize, checkAuthorization, getClassLoaderIsolationKey, isSupportsSensitiveDynamicProperties, setPropertiesMethods inherited from interface org.apache.nifi.connectable.Connectable
getComponentType, getNameMethods inherited from interface org.apache.nifi.controller.Triggerable
getScheduledState
-
Field Details
-
LOG
private static final org.slf4j.Logger LOG -
DEFAULT_TIME_UNIT
-
DEFAULT_YIELD_PERIOD
- See Also:
-
DEFAULT_PENALIZATION_PERIOD
- See Also:
-
RUN_SCHEDULE
- See Also:
-
processGroup
-
processorRef
-
identifier
-
destinations
-
connections
-
undefinedRelationshipsToTerminate
private final AtomicReference<Set<org.apache.nifi.processor.Relationship>> undefinedRelationshipsToTerminate -
incomingConnections
-
lossTolerant
-
comments
-
position
-
schedulingPeriod
-
yieldPeriod
-
penalizationPeriod
-
style
-
concurrentTaskCount
-
yieldExpiration
-
schedulingNanos
-
versionedComponentId
-
processScheduler
-
runNanos
private long runNanos -
yieldNanos
private volatile long yieldNanos -
desiredState
-
bulletinLevel
-
parameterReferences
-
stopFutures
-
schedulingStrategy
private org.apache.nifi.scheduling.SchedulingStrategy schedulingStrategy -
executionNode
private org.apache.nifi.scheduling.ExecutionNode executionNode -
activeThreads
-
hashCode
private final int hashCode -
hasActiveThreads
private volatile boolean hasActiveThreads -
retryCount
private volatile int retryCount -
retriedRelationships
-
backoffMechanism
-
maxBackoffPeriod
-
-
Constructor Details
-
StandardProcessorNode
public StandardProcessorNode(LoggableComponent<org.apache.nifi.processor.Processor> processor, String uuid, ValidationContextFactory validationContextFactory, ProcessScheduler scheduler, ControllerServiceProvider controllerServiceProvider, ReloadComponent reloadComponent, ExtensionManager extensionManager, ValidationTrigger validationTrigger) -
StandardProcessorNode
public StandardProcessorNode(LoggableComponent<org.apache.nifi.processor.Processor> processor, String uuid, ValidationContextFactory validationContextFactory, ProcessScheduler scheduler, ControllerServiceProvider controllerServiceProvider, String componentType, String componentCanonicalClass, ReloadComponent reloadComponent, ExtensionManager extensionManager, ValidationTrigger validationTrigger, boolean isExtensionMissing)
-
-
Method Details
-
getComponent
- Specified by:
getComponentin interfaceComponentNode
-
getLogger
- Specified by:
getLoggerin interfaceComponentNode
-
getRunnableComponent
- Specified by:
getRunnableComponentin interfaceConnectable
-
getBundleCoordinate
- Specified by:
getBundleCoordinatein interfaceComponentNode
-
getComments
- Specified by:
getCommentsin interfaceConnectable
-
getParentAuthorizable
- Specified by:
getParentAuthorizablein interfaceAuthorizable
-
getResource
- Specified by:
getResourcein interfaceAuthorizable
-
isRestricted
public boolean isRestricted()- Specified by:
isRestrictedin interfaceComponentNode
-
getComponentClass
- Specified by:
getComponentClassin interfaceComponentNode
-
isDeprecated
public boolean isDeprecated()- Specified by:
isDeprecatedin interfaceComponentNode
-
setComments
- Specified by:
setCommentsin interfaceConnectable
-
getPosition
- Specified by:
getPositionin interfacePositionable
-
setPosition
- Specified by:
setPositionin interfacePositionable
-
getStyle
- Specified by:
getStylein classProcessorNode
-
setStyle
- Specified by:
setStylein classProcessorNode
-
getIdentifier
- Specified by:
getIdentifierin interfaceComponentAuthorizable- Specified by:
getIdentifierin interfaceComponentNode- Specified by:
getIdentifierin interfaceConnectable- Overrides:
getIdentifierin classAbstractComponentNode
-
isLossTolerant
public boolean isLossTolerant()- Specified by:
isLossTolerantin interfaceConnectable- Returns:
- if true flow file content generated by this processor is considered loss tolerant
-
isIsolated
public boolean isIsolated()- Specified by:
isIsolatedin interfaceConnectable- Specified by:
isIsolatedin classProcessorNode
-
isTriggerWhenEmpty
public boolean isTriggerWhenEmpty()- Specified by:
isTriggerWhenEmptyin interfaceConnectable- Returns:
- true if the processor has the
TriggerWhenEmptyannotation, false otherwise.
-
isSideEffectFree
public boolean isSideEffectFree()- Specified by:
isSideEffectFreein interfaceConnectable- Specified by:
isSideEffectFreein classProcessorNode- Returns:
- true if the processor has the
SideEffectFreeannotation, false otherwise.
-
isSessionBatchingSupported
public boolean isSessionBatchingSupported()- Specified by:
isSessionBatchingSupportedin interfaceConnectable
-
isTriggerWhenAnyDestinationAvailable
public boolean isTriggerWhenAnyDestinationAvailable()- Specified by:
isTriggerWhenAnyDestinationAvailablein interfaceConnectable- Specified by:
isTriggerWhenAnyDestinationAvailablein classProcessorNode- Returns:
- true if the processor has the
TriggerWhenAnyDestinationAvailableannotation, false otherwise.
-
isExecutionNodeRestricted
public boolean isExecutionNodeRestricted()Indicates whether the processor's executionNode configuration is restricted to run only in primary node- Specified by:
isExecutionNodeRestrictedin classProcessorNode
-
setLossTolerant
public void setLossTolerant(boolean lossTolerant) Indicates whether flow file content made by this processor must be persisted- Specified by:
setLossTolerantin interfaceConnectable- Parameters:
lossTolerant- tolerant
-
isAutoTerminated
public boolean isAutoTerminated(org.apache.nifi.processor.Relationship relationship) - Specified by:
isAutoTerminatedin interfaceConnectable
-
setAutoTerminatedRelationships
- Specified by:
setAutoTerminatedRelationshipsin classProcessorNode
-
getAutoTerminatedRelationships
- Specified by:
getAutoTerminatedRelationshipsin classProcessorNode- Returns:
- an unmodifiable Set that contains all of the ProcessorRelationship objects that are configured to be auto-terminated
-
setName
- Specified by:
setNamein interfaceComponentNode- Specified by:
setNamein interfaceConnectable- Overrides:
setNamein classAbstractComponentNode
-
getSchedulingPeriod
- Specified by:
getSchedulingPeriodin interfaceTriggerable- Parameters:
timeUnit- determines the unit of time to represent the scheduling period.- Returns:
- the schedule period that should elapse before subsequent cycles of this processor's tasks
-
setSchedulingStrategy
public void setSchedulingStrategy(org.apache.nifi.scheduling.SchedulingStrategy schedulingStrategy) Updates the Scheduling Strategy used for this Processor- Specified by:
setSchedulingStrategyin classProcessorNode- Parameters:
schedulingStrategy- strategy- Throws:
IllegalArgumentException- if the SchedulingStrategy is not not applicable for this Processor
-
getSchedulingStrategy
public org.apache.nifi.scheduling.SchedulingStrategy getSchedulingStrategy()- Specified by:
getSchedulingStrategyin interfaceConnectable- Specified by:
getSchedulingStrategyin classProcessorNode- Returns:
- the currently configured scheduling strategy
-
getSchedulingPeriod
- Specified by:
getSchedulingPeriodin interfaceTriggerable
-
setSchedulingPeriod
- Specified by:
setSchedulingPeriodin interfaceTriggerable
-
setExecutionNode
public void setExecutionNode(org.apache.nifi.scheduling.ExecutionNode executionNode) - Specified by:
setExecutionNodein classProcessorNode
-
getExecutionNode
public org.apache.nifi.scheduling.ExecutionNode getExecutionNode()- Specified by:
getExecutionNodein classProcessorNode
-
getRunDuration
- Specified by:
getRunDurationin interfaceConnectable- Specified by:
getRunDurationin classProcessorNode
-
setRunDuration
- Specified by:
setRunDurationin classProcessorNode
-
getYieldPeriod
- Specified by:
getYieldPeriodin interfaceConnectable
-
getYieldPeriod
- Specified by:
getYieldPeriodin interfaceConnectable
-
setYieldPeriod
- Specified by:
setYieldPeriodin interfaceConnectable
-
yield
public void yield()Causes the processor not to be scheduled for some period of time. This duration can be obtained and set via thegetYieldPeriod(TimeUnit)andsetYieldPeriod(String).- Specified by:
yieldin interfaceConnectable
-
yield
- Specified by:
yieldin interfaceConnectable- Specified by:
yieldin classProcessorNode
-
getYieldExpiration
public long getYieldExpiration()- Specified by:
getYieldExpirationin interfaceConnectable- Returns:
- the number of milliseconds since Epoch at which time this processor is to once again be scheduled.
-
getPenalizationPeriod
- Specified by:
getPenalizationPeriodin interfaceConnectable
-
getPenalizationPeriod
- Specified by:
getPenalizationPeriodin interfaceConnectable
-
setPenalizationPeriod
- Specified by:
setPenalizationPeriodin interfaceConnectable
-
setMaxConcurrentTasks
public void setMaxConcurrentTasks(int taskCount) Determines the number of concurrent tasks that may be running for this processor.- Specified by:
setMaxConcurrentTasksin interfaceTriggerable- Parameters:
taskCount- a number of concurrent tasks this processor may have running- Throws:
IllegalArgumentException- if the given value is less than 1
-
isTriggeredSerially
public boolean isTriggeredSerially()- Specified by:
isTriggeredSeriallyin classProcessorNode
-
getMaxConcurrentTasks
public int getMaxConcurrentTasks()- Specified by:
getMaxConcurrentTasksin interfaceTriggerable- Returns:
- the number of tasks that may execute concurrently for this processor
-
getBulletinLevel
- Specified by:
getBulletinLevelin classProcessorNode
-
setBulletinLevel
- Specified by:
setBulletinLevelin classProcessorNode
-
getConnections
- Specified by:
getConnectionsin interfaceConnectable
-
getIncomingConnections
- Specified by:
getIncomingConnectionsin interfaceConnectable
-
getConnections
- Specified by:
getConnectionsin interfaceConnectable
-
addConnection
- Specified by:
addConnectionin interfaceConnectable
-
hasIncomingConnection
public boolean hasIncomingConnection()- Specified by:
hasIncomingConnectionin interfaceConnectable
-
updateConnection
- Specified by:
updateConnectionin interfaceConnectable- Throws:
IllegalStateException
-
removeConnection
- Specified by:
removeConnectionin interfaceConnectable
-
setIncomingConnections
-
getRelationship
- Specified by:
getRelationshipin interfaceConnectable- Parameters:
relationshipName- name- Returns:
- the relationship for this nodes processor for the given name or creates a new relationship for the given name
-
getProcessor
public org.apache.nifi.processor.Processor getProcessor()- Specified by:
getProcessorin classProcessorNode
-
setProcessor
- Specified by:
setProcessorin classProcessorNode
-
reload
- Specified by:
reloadin interfaceComponentNode- Throws:
ProcessorInstantiationException
-
getDestinations
- Returns:
- the Set of destination processors for all relationships excluding any destinations that are this processor itself (self-loops)
-
getUndefinedRelationships
-
isRunning
public boolean isRunning()- Specified by:
isRunningin interfaceTriggerable
-
isValidationNecessary
public boolean isValidationNecessary()- Specified by:
isValidationNecessaryin interfaceComponentNode
-
getParentProcessGroup
- Specified by:
getParentProcessGroupin interfaceComponentNode
-
getActiveThreadCount
public int getActiveThreadCount()- Specified by:
getActiveThreadCountin classProcessorNode
-
getIncomingNonLoopConnections
List<Connection> getIncomingNonLoopConnections() -
verifyConfiguration
public List<ConfigVerificationResult> verifyConfiguration(org.apache.nifi.processor.ProcessContext context, ComponentLog logger, Map<String, String> attributes, ExtensionManager extensionManager) - Specified by:
verifyConfigurationin classProcessorNode
-
getValidationErrors
- Specified by:
getValidationErrorsin interfaceComponentNode- Specified by:
getValidationErrorsin interfaceConnectable- Overrides:
getValidationErrorsin classAbstractComponentNode
-
computeValidationErrors
- Overrides:
computeValidationErrorsin classAbstractComponentNode
-
validateConfig
- Specified by:
validateConfigin classAbstractComponentNode
-
getInputRequirement
public org.apache.nifi.annotation.behavior.InputRequirement.Requirement getInputRequirement()- Specified by:
getInputRequirementin classProcessorNode
-
equals
Establishes node equality (based on the processor's identifier)- Overrides:
equalsin classAbstractComponentNode- Parameters:
other- node- Returns:
- true if equal
-
hashCode
public int hashCode()- Overrides:
hashCodein classAbstractComponentNode
-
getRelationships
- Specified by:
getRelationshipsin interfaceConnectable
-
toString
- Overrides:
toStringin classAbstractComponentNode
-
getProcessGroup
- Specified by:
getProcessGroupin interfaceConnectable- Specified by:
getProcessGroupin interfaceGroupedComponent
-
getParameterContext
- Specified by:
getParameterContextin classAbstractComponentNode
-
getParameterLookup
- Specified by:
getParameterLookupin interfaceComponentNode
-
setProcessGroup
- Specified by:
setProcessGroupin interfaceConnectable
-
onTrigger
public void onTrigger(org.apache.nifi.processor.ProcessContext context, org.apache.nifi.processor.ProcessSessionFactory sessionFactory) - Specified by:
onTriggerin interfaceTriggerable
-
getConnectableType
- Specified by:
getConnectableTypein interfaceConnectable
-
setAnnotationData
- Specified by:
setAnnotationDatain interfaceComponentNode- Overrides:
setAnnotationDatain classAbstractComponentNode
-
verifyCanDelete
- Specified by:
verifyCanDeletein interfaceConnectable- Throws:
IllegalStateException
-
verifyCanDelete
public void verifyCanDelete(boolean ignoreConnections) - Specified by:
verifyCanDeletein interfaceConnectable
-
verifyCanStart
public void verifyCanStart()- Specified by:
verifyCanStartin interfaceConnectable
-
verifyCanStop
public void verifyCanStop()- Specified by:
verifyCanStopin interfaceConnectable
-
verifyCanUpdate
public void verifyCanUpdate()- Specified by:
verifyCanUpdatein interfaceConnectable
-
verifyCanEnable
public void verifyCanEnable()- Specified by:
verifyCanEnablein interfaceConnectable
-
verifyCanDisable
public void verifyCanDisable()- Specified by:
verifyCanDisablein interfaceConnectable
-
verifyCanClearState
- Specified by:
verifyCanClearStatein interfaceConnectable- Throws:
IllegalStateException
-
verifyNoActiveThreads
- Throws:
IllegalStateException
-
verifyModifiable
- Specified by:
verifyModifiablein classAbstractComponentNode- Throws:
IllegalStateException
-
enable
public void enable()- Specified by:
enablein classProcessorNode
-
disable
public void disable()- Specified by:
disablein classProcessorNode
-
start
public void start(ScheduledExecutorService taskScheduler, long administrativeYieldMillis, long timeoutMillis, Supplier<org.apache.nifi.processor.ProcessContext> processContextFactory, SchedulingAgentCallback schedulingAgentCallback, boolean failIfStopping, boolean triggerLifecycleMethods) Will idempotently start the processor using the following sequence:- Validate Processor's state (e.g., PropertyDescriptors, ControllerServices etc.)
- Transition (atomically) Processor's scheduled state form STOPPED to STARTING. If the above state transition succeeds, then execute the start task (asynchronously) which will be re-tried until @OnScheduled is executed successfully and "schedulingAgentCallback' is invoked, or until STOP operation is initiated on this processor. If state transition fails it means processor is already being started and WARN message will be logged explaining it.
Any exception thrown while invoking operations annotated with @OnSchedule will be caught and logged after which @OnUnscheduled operation will be invoked (quietly) and the start sequence will be repeated (re-try) after delay provided by 'administrativeYieldMillis'.
Upon successful completion of start sequence (@OnScheduled -> 'schedulingAgentCallback') the attempt will be made to transition processor's scheduling state to RUNNING at which point processor is considered to be fully started and functioning. If upon successful invocation of @OnScheduled operation the processor can not be transitioned to RUNNING state (e.g., STOP operation was invoked on the processor while it's @OnScheduled operation was executing), the processor's @OnUnscheduled operation will be invoked and its scheduling state will be set to STOPPED at which point the processor is considered to be fully stopped.
- Specified by:
startin classProcessorNode
-
runOnce
public void runOnce(ScheduledExecutorService taskScheduler, long administrativeYieldMillis, long timeoutMillis, Supplier<org.apache.nifi.processor.ProcessContext> processContextFactory, SchedulingAgentCallback schedulingAgentCallback) Similar tostart(ScheduledExecutorService, long, long, Supplier, SchedulingAgentCallback, boolean, boolean), except for the following:-
Once the
Processor.onTrigger(ProcessContext, ProcessSessionFactory)method has been invoked successfully, the processor is scehduled to be stopped immediately. All appropriate lifecycle methods will be executed as well. - The processor's desired state is going to be set to STOPPED right away. This usually doesn't prevent the processor to run once, unless NiFi is restarted before it can finish. In that case the processor will stay STOPPED after the restart.
- Specified by:
runOncein classProcessorNode
-
Once the
-
run
private void run(ScheduledExecutorService taskScheduler, long administrativeYieldMillis, long timeoutMillis, Supplier<org.apache.nifi.processor.ProcessContext> processContextFactory, SchedulingAgentCallback schedulingAgentCallback, boolean failIfStopping, ScheduledState desiredState, ScheduledState scheduledState, boolean triggerLifecycleMethods) -
notifyPrimaryNodeChanged
public void notifyPrimaryNodeChanged(org.apache.nifi.annotation.notification.PrimaryNodeState nodeState, LifecycleState lifecycleState) - Specified by:
notifyPrimaryNodeChangedin classProcessorNode
-
activateThread
private void activateThread() -
deactivateThread
private void deactivateThread() -
getActiveThreads
- Specified by:
getActiveThreadsin classProcessorNode
-
getTerminatedThreadCount
public int getTerminatedThreadCount()- Specified by:
getTerminatedThreadCountin classProcessorNode
-
terminate
public int terminate()- Specified by:
terminatein classProcessorNode
-
isTerminated
- Specified by:
isTerminatedin classProcessorNode
-
verifyCanTerminate
public void verifyCanTerminate()- Specified by:
verifyCanTerminatein classProcessorNode
-
initiateStart
private void initiateStart(ScheduledExecutorService taskScheduler, long administrativeYieldMillis, long timeoutMillis, AtomicLong startupAttemptCount, Supplier<org.apache.nifi.processor.ProcessContext> processContextFactory, SchedulingAgentCallback schedulingAgentCallback, boolean triggerLifecycleMethods) -
stop
public CompletableFuture<Void> stop(ProcessScheduler processScheduler, ScheduledExecutorService executor, org.apache.nifi.processor.ProcessContext processContext, SchedulingAgent schedulingAgent, LifecycleState lifecycleState, boolean triggerLifecycleMethods) Will idempotently stop the processor using the following sequence:- Transition (atomically) Processor's scheduled state from RUNNING to
STOPPING. If the above state transition succeeds, then invoke any method
on the Processor with the
OnUnscheduledannotation. Once those methods have been called and returned (either normally or exceptionally), start checking to see if all of the Processor's active threads have finished. If not, check again every 100 milliseconds until they have. Once all after threads have completed, the processor's @OnStopped operation will be invoked and its scheduled state is set to STOPPED which completes processor stop sequence.
If for some reason processor's scheduled state can not be transitioned to STOPPING (e.g., the processor didn't finish @OnScheduled operation when stop was called), the attempt will be made to transition processor's scheduled state from STARTING to STOPPING which will allow
start(ScheduledExecutorService, long, long, Supplier, SchedulingAgentCallback, boolean, boolean)method to initiate processor's shutdown upon exiting @OnScheduled operation, otherwise the processor's scheduled state will remain unchanged ensuring that multiple calls to this method are idempotent.- Specified by:
stopin classProcessorNode
- Transition (atomically) Processor's scheduled state from RUNNING to
STOPPING. If the above state transition succeeds, then invoke any method
on the Processor with the
-
completeStopAction
private void completeStopAction()Marks the processor as fully stopped, and completes any futures that are to be completed as a result -
addStopFuture
Adds the given CompletableFuture to the list of those that will completed whenever the processor has fully stopped- Parameters:
future- the future to add
-
getDesiredState
- Specified by:
getDesiredStatein classProcessorNode
-
getRetryCount
public int getRetryCount()- Specified by:
getRetryCountin interfaceConnectable
-
setRetryCount
- Specified by:
setRetryCountin interfaceConnectable
-
getRetriedRelationships
- Specified by:
getRetriedRelationshipsin interfaceConnectable
-
setRetriedRelationships
- Specified by:
setRetriedRelationshipsin interfaceConnectable
-
isRelationshipRetried
public boolean isRelationshipRetried(org.apache.nifi.processor.Relationship relationship) - Specified by:
isRelationshipRetriedin interfaceConnectable
-
getBackoffMechanism
- Specified by:
getBackoffMechanismin interfaceConnectable
-
setBackoffMechanism
- Specified by:
setBackoffMechanismin interfaceConnectable
-
getMaxBackoffPeriod
- Specified by:
getMaxBackoffPeriodin interfaceConnectable
-
setMaxBackoffPeriod
- Specified by:
setMaxBackoffPeriodin interfaceConnectable
-
evaluateParameters
- Specified by:
evaluateParametersin interfaceConnectable
-
monitorAsyncTask
-
getProcessGroupIdentifier
- Specified by:
getProcessGroupIdentifierin interfaceComponentAuthorizable
-
getVersionedComponentId
- Specified by:
getVersionedComponentIdin interfaceVersionedComponent
-
setVersionedComponentId
- Specified by:
setVersionedComponentIdin interfaceVersionedComponent
-
onConfigurationRestored
public void onConfigurationRestored(org.apache.nifi.processor.ProcessContext context) - Specified by:
onConfigurationRestoredin classProcessorNode
-
migrateConfiguration
public void migrateConfiguration(Map<String, String> rawPropertyValues, ControllerServiceFactory serviceFactory) - Specified by:
migrateConfigurationin classProcessorNode
-
migrateProperties
private void migrateProperties(Map<String, String> originalPropertyValues, ControllerServiceFactory serviceFactory) -
migrateRelationships
private void migrateRelationships() -
updateControllerServiceReferences
private void updateControllerServiceReferences()
-