GitHub user ahgittin opened a pull request:
https://github.com/apache/brooklyn-server/pull/835
Tasks subsystem improvements - adjuncts, names, efficiency, GC
* Adjuncts' tasks run in their context with tag so can be found more easily
* Better naming of tasks across the board (so the look nicer in the UI)
* More tidies to same-thread execution and run more things in same thread
* Tidied task GC code, and changed to GC less aggressively
* Fix race in initialization tasks
This increases the number of tasks kept around because sensor events are
actually interesting (previously they were always garbage collected). However
this may impact performance at scale: that deserves some investigation. There
may be a balance to be had re which tasks to keep around and for how long.
NB this builds on #816, review that first
You can merge this pull request into a Git repository by running:
$ git pull https://github.com/ahgittin/brooklyn-server tasks-better-tree
Alternatively you can review and apply these changes as the patch at:
https://github.com/apache/brooklyn-server/pull/835.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 #835
----
commit a11af34c33c69ef00adeb8906bb81d0776915c6b
Author: Alex Heneveld <[email protected]>
Date: 2017-09-08T15:00:29Z
don't repeat task tracking code between scheduled and non-scheduled code
paths
commit 438846c2967a64e109395a258effbf5b4db2cfd4
Author: Alex Heneveld <[email protected]>
Date: 2017-09-12T21:11:56Z
optimization: skip tags copy on common simple lookups
commit 9d2faf0eddcd37ed0ec31cf1b9856a95b5702e14
Author: Alex Heneveld <[email protected]>
Date: 2017-09-11T07:40:31Z
more bookkeeping for immediate/same-thread tasks
commit 4c2468d0f001bfdde74dd5b48c90935d0d746981
Author: Alex Heneveld <[email protected]>
Date: 2017-09-11T10:04:08Z
mark task names needing tidy as TODO and tidy some
commit 784bc960f926823be374fa05d3df3fd542ee857a
Author: Alex Heneveld <[email protected]>
Date: 2017-09-11T17:00:11Z
use new public class MaybeSupplier for Maybe instances backed by supplier
so callers can access the supplier in cases where it might also provide
other info such as Identifiable
commit 9a105e05dbe0d8019a7b4f3c3abd523e66a24a84
Author: Alex Heneveld <[email protected]>
Date: 2017-09-11T17:03:37Z
remove soft refs in tasks in favour of lookup
soft refs are expensive in the GC phase -- improves speed by 20% in some
cases
commit 8983bf2cdae3e1b3bbc00d12cfb4baf09fb732fe
Author: Alex Heneveld <[email protected]>
Date: 2017-09-11T22:15:50Z
add support for same-thread execution
submitting and blocking is unnecessary overhead in many places
commit 934cf4ccbed5719f1b22ff032af77583c1cf6ad2
Author: Alex Heneveld <[email protected]>
Date: 2017-09-12T11:12:00Z
diff task submisson paths share code about how to end, and tidy listeners
fix bug where some where executed and GC'd before the child had actually
run,
by ensuring listeners don't run until the task recognizes the cancellation.
also tidy how end code is shared, and remove deprecation
commit 18a908bd42f5a09da838c2f90bd6f79b5cd14766
Author: Alex Heneveld <[email protected]>
Date: 2017-09-12T16:31:42Z
add and use builder for ScheduledTask
commit a341cceddb303d0076b9632b3fa64e3a7ffaa4f9
Author: Alex Heneveld <[email protected]>
Date: 2017-09-12T16:36:28Z
remove interim TODO comments about checking that things work
commit c1f78bb2ba82504b2f0bfc1aa4831564d1f314b4
Author: Alex Heneveld <[email protected]>
Date: 2017-09-15T08:21:29Z
tidy BasicExecutionManagement constructors
commit 5e19dec5180cc22066f91a4c229974e09a9d1ac1
Author: Alex Heneveld <[email protected]>
Date: 2017-09-15T09:52:15Z
more testing of task cancel (in response to jenkins failure)
commit 7c2c8e1aa9a7a2c0be9476c93bd5f8c46c77e1ae
Author: Alex Heneveld <[email protected]>
Date: 2017-09-15T17:30:11Z
improve task cancellation code
consistently notify listeners and update maps and counts, and remove
deprecated internal listeners class;
add logging and speed increase to related tests (and Asserts.eventually can
wait on on object to speed things up!)
commit 62359c60e54feebe0c38146d8eb6bfb055d8962a
Author: Alex Heneveld <[email protected]>
Date: 2017-09-16T01:54:25Z
Merge branch 'master' into tasks-better
conflict in adjacent line changes in Poller, fixed
commit 26dffef47d5d443b538d0b5a16dc133f01960372
Author: Alex Heneveld <[email protected]>
Date: 2017-09-15T16:43:58Z
more tests for edge case where cancel doesn't cause listeners to run, and
more tests for cancel
commit 24250a5e2c4e380b06e72fc9db52d3e5989fd00e
Author: Alex Heneveld <[email protected]>
Date: 2017-09-16T03:43:31Z
preserve errors as much as possible when submitted to run in same thread
commit ab480ed288e7ccca90f8c05c06a817169cedd659
Author: Alex Heneveld <[email protected]>
Date: 2017-09-17T11:47:10Z
tidy how cross-context submitted, and use simple tasks in more places
commit 2bdcf1ac81853410100920968f92a82c41b1f5b6
Author: Alex Heneveld <[email protected]>
Date: 2017-09-18T11:49:51Z
apply context-switching task wrapper for same-thread and immediate tasks
now behave same as submitted tasks. add tests, and comments about limits of
getImmediately.
commit 37b6b11452b9619decde71376f95b73eab0836b4
Author: Alex Heneveld <[email protected]>
Date: 2017-09-12T10:49:51Z
task visibility: validation of config
commit 7f4d7bd87e0e0e1d98ed49d875e601a21e0635c8
Author: Alex Heneveld <[email protected]>
Date: 2017-09-12T14:01:09Z
task visibility: entity mgmt create and startup wrapped in its own task
commit 4430f769077210bf253a8d70a69482c1c2119d39
Author: Alex Heneveld <[email protected]>
Date: 2017-09-15T10:07:27Z
task optimization: some queued-or-submitted tasks use foreground for
executing
commit 8ecf3950ac1c158e6cac815c596ae0906439363b
Author: Alex Heneveld <[email protected]>
Date: 2017-09-15T10:24:43Z
task visibility: better names for config retrieval tasks
commit 84d24d1a949275e6bad3bbabefe6bf422f9fade7
Author: Alex Heneveld <[email protected]>
Date: 2017-09-19T12:09:39Z
fix visibility: entity init runs in same thread
commit d4c9fe12ecfdf884ea8e1945e51cc07e026d7610
Author: Alex Heneveld <[email protected]>
Date: 2017-09-19T12:10:17Z
entity adjuncts have extra tag for execution context, used in subscription
delivery
commit 0a1acecbe7b70ca752e0636605b34317f24a5a8e
Author: Alex Heneveld <[email protected]>
Date: 2017-09-19T12:09:59Z
fix deadlock in initial publication of sensors on setting up a subscription
commit e1f948ad583af01138519a17a9d79d400ad0511a
Author: Alex Heneveld <[email protected]>
Date: 2017-09-19T12:19:39Z
task visibility: entity initialization
commit b0556decc88a1d5bdc1c45500ceeb7c2eb558716
Author: Alex Heneveld <[email protected]>
Date: 2017-09-19T13:30:19Z
include adjunct info as a subscription description
description could be used for more things, exposed more broadly, but this
is needed for now to make sense of those tasks
commit aeecd3e90e049064e7c4cdfdaf9b40404032815a
Author: Alex Heneveld <[email protected]>
Date: 2017-09-20T08:09:08Z
task GC and visibility: tidy GC code, don't delete some things eg
subscriptions quite so aggressively
commit 79cc9bccf0ca80816ecd09846ec385d5cad3fbf8
Author: Alex Heneveld <[email protected]>
Date: 2017-09-20T09:09:05Z
task visibility: ensure all tasks have a name, updating exec.submit()
methods to take name
commit 130a29b906da83f108ae1ea6cebef94c0c5f6a6f
Author: Alex Heneveld <[email protected]>
Date: 2017-09-20T12:37:21Z
fix tests that asserted specific tasks (as there are now more)
----
---