Package com.atlassian.jira.index
Class PeriodicIndexWriterCommitScheduler
java.lang.Object
com.atlassian.jira.index.PeriodicIndexWriterCommitScheduler
Responsible for scheduling cyclical writer commit operation, storing uncommitted writers, and performing the actual commit calls.
-
Field Summary
-
Constructor Summary
ConstructorDescriptionPeriodicIndexWriterCommitScheduler
(PeriodicIndexWriterCommitObserver commitObserver, ApplicationProperties applicationProperties, BarrierFactory barrierFactory, com.atlassian.event.api.EventPublisher eventPublisher) -
Method Summary
Modifier and TypeMethodDescriptionprotected void
Moves uncommitted writers from commit queue and attempts to commit them.void
Forces an immediate write of Lucene files to disk.void
onPluginFrameworkShutdownEvent
(com.atlassian.plugin.event.events.PluginFrameworkShutdownEvent event) void
onPluginFrameworkStartedEvent
(com.atlassian.plugin.event.events.PluginFrameworkStartedEvent event) void
Add writer to commit queue.
-
Field Details
-
PERIODIC_COMMIT_BARRIER
- See Also:
-
-
Constructor Details
-
PeriodicIndexWriterCommitScheduler
public PeriodicIndexWriterCommitScheduler(PeriodicIndexWriterCommitObserver commitObserver, ApplicationProperties applicationProperties, BarrierFactory barrierFactory, com.atlassian.event.api.EventPublisher eventPublisher)
-
-
Method Details
-
onPluginFrameworkStartedEvent
@EventListener public void onPluginFrameworkStartedEvent(com.atlassian.plugin.event.events.PluginFrameworkStartedEvent event) -
onPluginFrameworkShutdownEvent
@EventListener public void onPluginFrameworkShutdownEvent(com.atlassian.plugin.event.events.PluginFrameworkShutdownEvent event) -
forceImmediateCommit
public void forceImmediateCommit() throws ExecutionException, InterruptedException, TimeoutExceptionForces an immediate write of Lucene files to disk. This is not necessary to make changes visible to Jira's search. It must be only used before producing an index snapshot, when we need everything to be physically on the disk before building an archive.- Throws:
ExecutionException
- will never happenInterruptedException
TimeoutException
- when 5 minutes is not enough to write to a disk - indicates a seriously overloaded machine
-
scheduleForCommit
Add writer to commit queue. It s 'commit' method will be called during next iteration ofcommitWriters()
- Parameters:
writer
-
-
commitWriters
protected void commitWriters()Moves uncommitted writers from commit queue and attempts to commit them. Calls commitObserver on corresponding phases, even if the queue does not contain any writers to commit at the beginning of execution. Never throws anThrowable
. In case any exceptions are thrown internally before operation was completed, moves all scheduled writers back to queue.
-