org.sqlite.TimeoutProgressCallback Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of sqlite-javacpp Show documentation
Show all versions of sqlite-javacpp Show documentation
JDBC Driver for SQLite using JavaCPP
The newest version!
/*
* The author disclaims copyright to this source code. In place of
* a legal notice, here is a blessing:
*
* May you do good and not evil.
* May you find forgiveness for yourself and forgive others.
* May you share freely, never taking more than you give.
*/
package org.sqlite;
import org.sqlite.SQLite.ProgressCallback;
/**
* Query Progress Callback.
* @see sqlite3_progress_handler
*/
public class TimeoutProgressCallback extends ProgressCallback {
private long expiration;
/**
* @return true
when the operation times out.
*/
@Override
protected boolean progress() {
if (expiration == 0 || System.currentTimeMillis() <= expiration) {
return false;
}
return true;
}
/**
* @param timeout in millis
*/
public void setTimeout(long timeout) {
if (timeout == 0) {
expiration = 0L;
return;
}
expiration = System.currentTimeMillis() + timeout;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy