GitHub user olegz opened a pull request:
https://github.com/apache/nifi/pull/141
NIFI-1164 Fixed race condition and refactored
Changed ControllerServiceNode by adding enable(..), disable(..) and
isActive() operations. See javadocs for more details in both
ControllerServiceNode and StandardControllerServiceNode
Refactored service enable/disable logic in StandardProcessScheduler and
StandardControllerServiceNode . Below are some of the notes:
- No need for resetting class loader since its going to derive from the
class loader of the service. In other words any classes that arenât loaded
and will be loaded within the scope of the already loaded service will be
loaded by the class lower of that service
- No need to control 'scheduleState.isScheduled()â since the logic has
changed to use CAS operation on state update and the service state change is
now atomic.
- Removed Thread.sleep(..) and while(true) loop in favor of rescheduling
re-tries achieving better thread utilization since the thread that would
normally block in Thread.sleep(..) is now reused.
- Added tests and validated that the race condition no longer happening
Added additional logic that allows the initiation of the service disabling
while it is in ENABLING state. See javadoc of
StandardProcessScheduler.enable/disable for more details.
You can merge this pull request into a Git repository by running:
$ git pull https://github.com/olegz/nifi NIFI-1164
Alternatively you can review and apply these changes as the patch at:
https://github.com/apache/nifi/pull/141.patch
To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:
This closes #141
----
commit 0727b2d31e1b552436c6c16df25dcbfcfcec5a3b
Author: Oleg Zhurakousky <[email protected]>
Date: 2015-12-15T18:21:00Z
NIFI-1164 Fixed race condition and refactored
Changed ControllerServiceNode by adding enable(..), disable(..) and
isActive() operations. See javadocs for more details in both
ControllerServiceNode and StandardControllerServiceNode
Refactored service enable/disable logic in StandardProcessScheduler and
StandardControllerServiceNode . Below are some of the notes:
- No need for resetting class loader since its going to derive from the
class loader of the service. In other words any classes that arenât loaded
and will be loaded within the scope of the already loaded service will be
loaded by the class lower of that service
- No need to control 'scheduleState.isScheduled()â since the logic has
changed to use CAS operation on state update and the service state change is
now atomic.
- Removed Thread.sleep(..) and while(true) loop in favor of rescheduling
re-tries achieving better thread utilization since the thread that would
normally block in Thread.sleep(..) is now reused.
- Added tests and validated that the race condition no longer happening
Added additional logic that allows the initiation of the service disabling
while it is in ENABLING state. See javadoc of
StandardProcessScheduler.enable/disable for more details.
----
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---