blob: a21bd9dd37955ed4f86ece7fa03120ec3b8ecf5e [file] [log] [blame]
/*******************************************************************************
* Copyright (c) 2007, 2012 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* IBM Corporation - initial API and implementation
*******************************************************************************/
package org.eclipse.core.tests.runtime.jobs;
import junit.framework.Assert;
import org.eclipse.core.runtime.jobs.LockListener;
/**
* A lock listener used for testing that ensures wait/release calls are correctly paired.
*/
public class TestLockListener extends LockListener {
private boolean waiting;
public synchronized void aboutToRelease() {
waiting = false;
}
public synchronized boolean aboutToWait(Thread lockOwner) {
waiting = true;
return false;
}
public synchronized void assertNotWaiting(String message) {
Assert.assertTrue(message, !waiting);
}
}