Thread System Access
A side job is something a pupil starts alongside their answer. The rule sheet can allow side jobs of one kind and say how many the pupil can start. Without a limit, one pupil can start thousands of them and halt the whole examination.
Some side jobs start without the pupil naming them, for example when they split a task into parts that run side by side, or take a short rest. Each of those has its own line on the rule sheet.
Position in the example policy file
The section documented on this page is marked in red. Every page in this section shows the same example file, so reading them in order walks it from top to bottom.
thisPolicyFileCompliesToThePolicyVersion: 1
regardingTheSupervisedCode:
theFollowingProgrammingLanguageConfigurationIsUsed: JAVA_USING_MAVEN_WALA_AND_ASPECTJ
theSupervisedCodeUsesTheFollowingPackage: "org.example"
theMainClassInsideThisPackageIs: "Main"
theFollowingClassesAreTestClasses:
- "org.example.PenguinTest"
theFollowingResourceAccessesArePermitted:
regardingFileSystemInteractions:
- onThisPathAndAllPathsBelow: "something.txt"
readAllFiles: true
overwriteAllFiles: true
createAllFiles: true
executeAllFiles: false
deleteAllFiles: false
regardingNetworkConnections:
- onTheHost: "www.example.com"
onThePort: 80
openConnections: true
sendData: true
receiveData: true
regardingCommandExecutions:
- executeTheCommand: "ls"
withTheseArguments:
- "-l"
regardingThreadCreations:
- createTheFollowingNumberOfThreads: 10
ofThisClass: "org.example.Worker"
regardingPackageImports:
- importTheFollowingPackage: "java.util"
regardingTimeouts:
- timeout: 120000
Fields
Implemented by ThreadPermission in
policy/policySubComponents/ThreadPermission.java.
| Field | Datatype | Explanation | Example | Regex or Range |
|---|---|---|---|---|
createTheFollowingNumberOfThreads | int | The maximum number of threads of this class that may be created. | 10 | Range 0 to Integer.MAX_VALUE. Negative values are rejected; 0 permits the class but no instances. |
ofThisClass | String | The thread class this entry governs. | org.example.Worker | THREAD_CLASS_PATTERN: a fully qualified Java class name, *, Lambda-Expression, or one of the implicit tokens <implicit-thread-op:parallelStream>, <implicit-thread-op:parallel>, <implicit-thread-op:Thread.sleep>, <implicit-thread-op:SubmissionPublisher.submit> and <implicit-thread-op:SubmissionPublisher.offer>. |
Notes
The implicit tokens exist because not every thread is created by name. A parallel stream, a Thread.sleep or a SubmissionPublisher submission all reach the threading machinery without the student ever writing new Thread(...), so each needs a token a policy can refer to.
Lambda-Expression covers a thread body supplied as a lambda, which has no nameable class.