added a test for Mutex properties of the locking system
This commit is contained in:
parent
f14265fe5b
commit
8a513164ab
4 changed files with 86 additions and 13 deletions
|
|
@ -124,12 +124,12 @@ class ProcessController {
|
|||
try {
|
||||
this.input.close();
|
||||
this.output.close();
|
||||
this.outputScanner.close();
|
||||
this.process.destroy();
|
||||
} catch (IOException e) {
|
||||
// streams already closed
|
||||
}
|
||||
|
||||
process.destroy();
|
||||
|
||||
this.killedManually = true;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -225,10 +225,11 @@ class ProcessManager {
|
|||
/*
|
||||
* getLock()
|
||||
* Locks access to this.processQueue
|
||||
* Waits for a predefined timeout period and then grabs the mutex
|
||||
* Waits for a predefined timeout period for mutex to be avail.
|
||||
* Synchronized so two things cannot grab lock at once.
|
||||
* Throws TimeoutException when it fails to get the lock.
|
||||
*/
|
||||
private void getLock() throws TimeoutException {
|
||||
protected synchronized void getLock() throws TimeoutException {
|
||||
Future<Object> future = this.threadPool.submit(this.lockCallable);
|
||||
|
||||
try {
|
||||
|
|
@ -266,7 +267,7 @@ class ProcessManager {
|
|||
* releaseLock()
|
||||
* releases mutex so other threads can operate on processqueue
|
||||
*/
|
||||
private void releaseLock() {
|
||||
protected void releaseLock() {
|
||||
this.processQueueMutex = false;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue