Code example for ReentrantLock

Methods: newCondition

0
import com.octo.android.robospice.request.springandroid.SpringAndroidSpiceRequest; 
import com.octo.android.robospice.springandroid.test.model.json.Weather; 
 
public class SpringAndroidSpiceRequestStub extends 
    SpringAndroidSpiceRequest<Weather> { 
    private ReentrantLock reentrantLock = new ReentrantLock(); 
    private Condition loadDataFromNetworkHasBeenExecuted = reentrantLock 
        .newCondition(); 
 
    public SpringAndroidSpiceRequestStub(Class<Weather> clazz) { 
        super(clazz); 
    } 
 
    @Override 
    public Weather loadDataFromNetwork() throws Exception { 
        try { 
            reentrantLock.lock(); 
            loadDataFromNetworkHasBeenExecuted.signal(); 
        } finally { 
            reentrantLock.unlock(); 
        }