public class StandardProcessorNode extends ProcessorNode implements Connectable
scheduledStateMINIMUM_SCHEDULING_NANOS| Constructor and Description |
|---|
StandardProcessorNode(LoggableComponent<Processor> processor,
String uuid,
ValidationContextFactory validationContextFactory,
ProcessScheduler scheduler,
ControllerServiceProvider controllerServiceProvider,
ComponentVariableRegistry variableRegistry,
ReloadComponent reloadComponent,
ExtensionManager extensionManager,
ValidationTrigger validationTrigger) |
StandardProcessorNode(LoggableComponent<Processor> processor,
String uuid,
ValidationContextFactory validationContextFactory,
ProcessScheduler scheduler,
ControllerServiceProvider controllerServiceProvider,
String componentType,
String componentCanonicalClass,
ComponentVariableRegistry variableRegistry,
ReloadComponent reloadComponent,
ExtensionManager extensionManager,
ValidationTrigger validationTrigger,
boolean isExtensionMissing) |
getPhysicalScheduledState, getScheduledStategetAdditionalClasspathResources, getAnnotationData, getCanonicalClassName, getComponentType, getControllerServiceProvider, getEffectivePropertyValue, getEffectivePropertyValues, getExtensionManager, getName, getProperties, getProperty, getPropertyDescriptor, getPropertyDescriptors, getRawPropertyValue, getRawPropertyValues, getReferencedParameterNames, getReloadComponent, getValidationContext, getValidationContextFactory, getValidationErrors, getValidationState, getValidationStatus, getValidationStatus, getVariableRegistry, isExtensionMissing, isReferencingParameter, onParametersModified, onPropertyModified, pauseValidationTrigger, performValidation, performValidation, performValidation, refreshProperties, reloadAdditionalResourcesIfNecessary, resetValidationState, resumeValidationTrigger, setAdditionalResourcesFingerprint, setExtensionMissing, setProperties, validateReferencedControllerServices, verifyCanUpdateBundle, verifyCanUpdatePropertiesclone, finalize, getClass, notify, notifyAll, wait, wait, waitgetComponentType, getNamegetScheduledStateauthorize, authorize, checkAuthorization, checkAuthorization, getRequestedResource, isAuthorizedauthorize, checkAuthorization, setPropertiesprivate static final org.slf4j.Logger LOG
public static final String BULLETIN_OBSERVER_ID
public static final TimeUnit DEFAULT_TIME_UNIT
public static final String DEFAULT_YIELD_PERIOD
public static final String DEFAULT_PENALIZATION_PERIOD
private final AtomicReference<ProcessGroup> processGroup
private final AtomicReference<ProcessorDetails> processorRef
private final AtomicReference<String> identifier
private final Map<Connection,Connectable> destinations
private final Map<Relationship,Set<Connection>> connections
private final AtomicReference<Set<Relationship>> undefinedRelationshipsToTerminate
private final AtomicReference<List<Connection>> incomingConnections
private final AtomicBoolean lossTolerant
private final AtomicReference<String> comments
private final AtomicReference<Position> position
private final AtomicReference<String> schedulingPeriod
private final AtomicReference<String> yieldPeriod
private final AtomicReference<String> penalizationPeriod
private final AtomicReference<Map<String,String>> style
private final AtomicInteger concurrentTaskCount
private final AtomicLong yieldExpiration
private final AtomicLong schedulingNanos
private final AtomicReference<String> versionedComponentId
private final ProcessScheduler processScheduler
private long runNanos
private volatile long yieldNanos
private volatile ScheduledState desiredState
private volatile LogLevel bulletinLevel
private SchedulingStrategy schedulingStrategy
private ExecutionNode executionNode
private final Map<Thread,ActiveTask> activeThreads
private final int hashCode
private volatile boolean hasActiveThreads
public StandardProcessorNode(LoggableComponent<Processor> processor, String uuid, ValidationContextFactory validationContextFactory, ProcessScheduler scheduler, ControllerServiceProvider controllerServiceProvider, ComponentVariableRegistry variableRegistry, ReloadComponent reloadComponent, ExtensionManager extensionManager, ValidationTrigger validationTrigger)
public StandardProcessorNode(LoggableComponent<Processor> processor, String uuid, ValidationContextFactory validationContextFactory, ProcessScheduler scheduler, ControllerServiceProvider controllerServiceProvider, String componentType, String componentCanonicalClass, ComponentVariableRegistry variableRegistry, ReloadComponent reloadComponent, ExtensionManager extensionManager, ValidationTrigger validationTrigger, boolean isExtensionMissing)
public ConfigurableComponent getComponent()
getComponent in interface ComponentNodepublic TerminationAwareLogger getLogger()
getLogger in interface ComponentNodepublic Object getRunnableComponent()
getRunnableComponent in interface Connectablepublic BundleCoordinate getBundleCoordinate()
getBundleCoordinate in interface ComponentNodepublic String getComments()
getComments in interface Connectablepublic Authorizable getParentAuthorizable()
getParentAuthorizable in interface Authorizablepublic Resource getResource()
getResource in interface Authorizablepublic boolean isRestricted()
isRestricted in interface ComponentNodepublic Class<?> getComponentClass()
getComponentClass in interface ComponentNodepublic boolean isDeprecated()
isDeprecated in interface ComponentNodepublic void setComments(String comments)
setComments in interface Connectablecomments - new commentspublic Position getPosition()
getPosition in interface Positionablepublic void setPosition(Position position)
setPosition in interface Positionablepublic Map<String,String> getStyle()
getStyle in class ProcessorNodepublic void setStyle(Map<String,String> style)
setStyle in class ProcessorNodepublic String getIdentifier()
getIdentifier in interface ComponentAuthorizablegetIdentifier in interface ConnectablegetIdentifier in interface ComponentNodegetIdentifier in class AbstractComponentNodepublic boolean isLossTolerant()
isLossTolerant in interface Connectablepublic boolean isIsolated()
isIsolated in interface ConnectableisIsolated in class ProcessorNodepublic boolean isTriggerWhenEmpty()
isTriggerWhenEmpty in interface ConnectableTriggerWhenEmpty
annotation, false otherwise.public boolean isSideEffectFree()
isSideEffectFree in interface ConnectableisSideEffectFree in class ProcessorNodeSideEffectFree annotation,
false otherwise.public boolean isSessionBatchingSupported()
isSessionBatchingSupported in interface Connectablepublic boolean isTriggerWhenAnyDestinationAvailable()
isTriggerWhenAnyDestinationAvailable in interface ConnectableisTriggerWhenAnyDestinationAvailable in class ProcessorNodeTriggerWhenAnyDestinationAvailable annotation, false
otherwise.public boolean isExecutionNodeRestricted()
isExecutionNodeRestricted in class ProcessorNodepublic void setLossTolerant(boolean lossTolerant)
setLossTolerant in interface ConnectablelossTolerant - tolerantpublic boolean isAutoTerminated(Relationship relationship)
isAutoTerminated in interface Connectablepublic void setAutoTerminatedRelationships(Set<Relationship> terminate)
setAutoTerminatedRelationships in class ProcessorNodepublic Set<Relationship> getAutoTerminatedRelationships()
getAutoTerminatedRelationships in class ProcessorNodepublic String getProcessorDescription()
CapabilityDescription
annotation, if one exists, else null.public void setName(String name)
setName in interface ConnectablesetName in interface ComponentNodesetName in class AbstractComponentNodepublic long getSchedulingPeriod(TimeUnit timeUnit)
getSchedulingPeriod in interface TriggerabletimeUnit - determines the unit of time to represent the scheduling period.public boolean isEventDrivenSupported()
isEventDrivenSupported in class ProcessorNodepublic void setSchedulingStrategy(SchedulingStrategy schedulingStrategy)
setSchedulingStrategy in class ProcessorNodeschedulingStrategy - strategyIllegalArgumentException - if the SchedulingStrategy is not not applicable for this
Processorpublic SchedulingStrategy getSchedulingStrategy()
getSchedulingStrategy in interface ConnectablegetSchedulingStrategy in class ProcessorNodepublic String getSchedulingPeriod()
getSchedulingPeriod in interface Triggerablepublic void setScheduldingPeriod(String schedulingPeriod)
setScheduldingPeriod in interface Triggerablepublic void setExecutionNode(ExecutionNode executionNode)
setExecutionNode in class ProcessorNodepublic ExecutionNode getExecutionNode()
getExecutionNode in class ProcessorNodepublic long getRunDuration(TimeUnit timeUnit)
getRunDuration in interface ConnectablegetRunDuration in class ProcessorNodepublic void setRunDuration(long duration,
TimeUnit timeUnit)
setRunDuration in class ProcessorNodepublic long getYieldPeriod(TimeUnit timeUnit)
getYieldPeriod in interface Connectablepublic String getYieldPeriod()
getYieldPeriod in interface Connectablepublic void setYieldPeriod(String yieldPeriod)
setYieldPeriod in interface Connectablepublic void yield()
getYieldPeriod(TimeUnit) and
setYieldPeriod(String).yield in interface Connectablepublic void yield(long period,
TimeUnit timeUnit)
yield in interface Connectableyield in class ProcessorNodepublic long getYieldExpiration()
getYieldExpiration in interface Connectablepublic long getPenalizationPeriod(TimeUnit timeUnit)
getPenalizationPeriod in interface Connectablepublic String getPenalizationPeriod()
getPenalizationPeriod in interface Connectablepublic void setPenalizationPeriod(String penalizationPeriod)
setPenalizationPeriod in interface Connectablepublic void setMaxConcurrentTasks(int taskCount)
setMaxConcurrentTasks in interface TriggerabletaskCount - a number of concurrent tasks this processor may have runningIllegalArgumentException - if the given value is less than 1public boolean isTriggeredSerially()
isTriggeredSerially in class ProcessorNodepublic int getMaxConcurrentTasks()
getMaxConcurrentTasks in interface Triggerablepublic LogLevel getBulletinLevel()
getBulletinLevel in class ProcessorNodepublic void setBulletinLevel(LogLevel level)
setBulletinLevel in class ProcessorNodepublic Set<Connection> getConnections()
getConnections in interface Connectablepublic List<Connection> getIncomingConnections()
getIncomingConnections in interface Connectablepublic Set<Connection> getConnections(Relationship relationship)
getConnections in interface Connectablepublic void addConnection(Connection connection)
addConnection in interface Connectablepublic boolean hasIncomingConnection()
hasIncomingConnection in interface Connectablepublic void updateConnection(Connection connection) throws IllegalStateException
updateConnection in interface ConnectableIllegalStateExceptionpublic void removeConnection(Connection connection)
removeConnection in interface Connectableprivate void setIncomingConnections(List<Connection> incoming)
public Relationship getRelationship(String relationshipName)
getRelationship in interface ConnectablerelationshipName - namepublic Processor getProcessor()
getProcessor in class ProcessorNodepublic void setProcessor(LoggableComponent<Processor> processor)
setProcessor in class ProcessorNodepublic void reload(Set<URL> additionalUrls) throws ProcessorInstantiationException
reload in interface ComponentNodeProcessorInstantiationExceptionpublic Set<Connectable> getDestinations()
public Set<Connectable> getDestinations(Relationship relationship)
public Set<Relationship> getUndefinedRelationships()
boolean isRelated(ProcessorNode node)
node - nodepublic boolean isRunning()
isRunning in interface Triggerablepublic boolean isValidationNecessary()
isValidationNecessary in interface ComponentNodepublic int getActiveThreadCount()
getActiveThreadCount in class ProcessorNodeList<Connection> getIncomingNonLoopConnections()
public Collection<ValidationResult> getValidationErrors()
getValidationErrors in interface ConnectablegetValidationErrors in interface ComponentNodegetValidationErrors in class AbstractComponentNodeprotected Collection<ValidationResult> computeValidationErrors(ValidationContext validationContext)
computeValidationErrors in class AbstractComponentNodepublic InputRequirement.Requirement getInputRequirement()
getInputRequirement in class ProcessorNodepublic boolean equals(Object other)
equals in class AbstractComponentNodeother - nodepublic int hashCode()
hashCode in class AbstractComponentNodepublic Collection<Relationship> getRelationships()
getRelationships in interface Connectablepublic String toString()
toString in class AbstractComponentNodepublic ProcessGroup getProcessGroup()
getProcessGroup in interface Connectableprotected ParameterContext getParameterContext()
getParameterContext in class AbstractComponentNodepublic ParameterLookup getParameterLookup()
getParameterLookup in interface ComponentNodepublic void setProcessGroup(ProcessGroup group)
setProcessGroup in interface Connectablepublic void onTrigger(ProcessContext context, ProcessSessionFactory sessionFactory)
onTrigger in interface Triggerablepublic ConnectableType getConnectableType()
getConnectableType in interface Connectablepublic void setAnnotationData(String data)
setAnnotationData in interface ComponentNodesetAnnotationData in class AbstractComponentNodepublic void verifyCanDelete()
throws IllegalStateException
verifyCanDelete in interface ConnectableIllegalStateExceptionpublic void verifyCanDelete(boolean ignoreConnections)
verifyCanDelete in interface Connectablepublic void verifyCanStart()
verifyCanStart in interface Connectablepublic void verifyCanStart(Set<ControllerServiceNode> ignoredReferences)
verifyCanStart in class ProcessorNodepublic void verifyCanStop()
verifyCanStop in interface Connectablepublic void verifyCanUpdate()
verifyCanUpdate in interface Connectablepublic void verifyCanEnable()
verifyCanEnable in interface Connectablepublic void verifyCanDisable()
verifyCanDisable in interface Connectablepublic void verifyCanClearState()
throws IllegalStateException
verifyCanClearState in interface ConnectableIllegalStateExceptionprivate void verifyNoActiveThreads()
throws IllegalStateException
IllegalStateExceptionpublic void verifyModifiable()
throws IllegalStateException
verifyModifiable in class AbstractComponentNodeIllegalStateExceptionpublic void enable()
enable in class ProcessorNodepublic void disable()
disable in class ProcessorNodepublic void start(ScheduledExecutorService taskScheduler, long administrativeYieldMillis, long timeoutMillis, Supplier<ProcessContext> processContextFactory, SchedulingAgentCallback schedulingAgentCallback, boolean failIfStopping)
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.
start in class ProcessorNodeprivate void activateThread()
private void deactivateThread()
public List<ActiveThreadInfo> getActiveThreads(ThreadDetails threadDetails)
getActiveThreads in class ProcessorNodepublic int getTerminatedThreadCount()
getTerminatedThreadCount in class ProcessorNodepublic int terminate()
terminate in class ProcessorNodepublic boolean isTerminated(Thread thread)
isTerminated in class ProcessorNodepublic void verifyCanTerminate()
verifyCanTerminate in class ProcessorNodeprivate void initiateStart(ScheduledExecutorService taskScheduler, long administrativeYieldMillis, long timeoutMilis, Supplier<ProcessContext> processContextFactory, SchedulingAgentCallback schedulingAgentCallback)
public CompletableFuture<Void> stop(ProcessScheduler processScheduler, ScheduledExecutorService executor, ProcessContext processContext, SchedulingAgent schedulingAgent, LifecycleState scheduleState)
OnUnscheduled annotation. 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)
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.
stop in class ProcessorNodepublic ScheduledState getDesiredState()
getDesiredState in class ProcessorNodeprivate void monitorAsyncTask(Future<?> taskFuture, Future<?> monitoringFuture, long completionTimestamp)
public String getProcessGroupIdentifier()
getProcessGroupIdentifier in interface ComponentAuthorizablepublic Optional<String> getVersionedComponentId()
getVersionedComponentId in interface VersionedComponentpublic void setVersionedComponentId(String versionedComponentId)
setVersionedComponentId in interface VersionedComponentCopyright © 2021 Apache NiFi Project. All rights reserved.