Android Open Source - sqldb Sql D B Threads






From Project

Back to project page sqldb.

License

The source code is released under:

MIT License

If you think the Android project sqldb listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package prj.sqldb.threading;
/*  w  ww .  ja v  a2 s  . c o  m*/
import java.util.concurrent.Executors;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.ScheduledFuture;
import java.util.concurrent.TimeUnit;

public class SqlDBThreads
{
    private static ScheduledExecutorService _dbWriter = Executors.newSingleThreadScheduledExecutor();
    private static ScheduledExecutorService _dbReader = Executors.newSingleThreadScheduledExecutor();

    public static ScheduledFuture<?> scheduleOnWriterDBExecutor(Runnable runnable)
    {
        ExceptionThrowingFutureTask task = new ExceptionThrowingFutureTask(runnable);
        return _dbWriter.schedule(task, 0, TimeUnit.MILLISECONDS);
    }

    public static ScheduledFuture<?> scheduleOnReaderDBExecutor(Runnable runnable)
    {
        ExceptionThrowingFutureTask task = new ExceptionThrowingFutureTask(runnable);
        return _dbReader.schedule(task, 0, TimeUnit.MILLISECONDS);
    }
}




Java Source Code List

prj.sqldb.CursorHandler.java
prj.sqldb.DBCallback.java
prj.sqldb.MultipleCursorHandler.java
prj.sqldb.QueryParams.java
prj.sqldb.QueryResult.java
prj.sqldb.SequentialCursorProcessor.java
prj.sqldb.SqlDb.java
prj.sqldb.threading.ExceptionThrowingFutureTask.java
prj.sqldb.threading.Later.java
prj.sqldb.threading.SqlDBThreads.java