Thread system access
A pupil can be allowed side jobs: one kind, and only so many of them. The rule sheet always sets that number, because without one a pupil could start side jobs until the whole school stops.
A few moves of a side job can only be caught at the pupil's own desk. The teacher starts watching for those last, once the whole rule sheet is in place, and only between the privacy screens. A permitted aid that makes such a move for the pupil goes unseen.
For the fields an exercise author writes, see Thread system access in the instructor guide. This page is about how the domain is enforced.
Model
ThreadPermission, carrying the number of threads permitted and the class permitted to create
them.
Validation and normalisation
The count is bounded; a policy that permits threads without a bound lets a runaway submission exhaust the runner rather than failing its own test.
What it generates
Architecture and aspect-oriented programming (AOP) test cases.
Static enforcement
Matched against thread-manipulation-methods.txt.
Runtime enforcement
JavaInstrumentationAdviceThreadSystemToolbox. Object's final monitor methods cannot be
intercepted at the callee, so they need application call-site rewriting:
JavaInstrumentationAgent.registerThreadMonitorRestrictedPackage is called last in
JavaExecuter.executeTestCases, after the complete policy is installed, so a retransformed
class can never observe a partially configured policy.
Where the code lives
policy/policySubComponents/ThreadPermission.javaaop/java/instrumentation/advice/JavaInstrumentationAdviceThreadSystemToolbox.javaaop/java/instrumentation/JavaInstrumentationAgent.registerThreadMonitorRestrictedPackage
Known gaps
The call-site rewriting applies to the restricted package only, so monitor operations reached through a permitted library are not rewritten.