Skip to content
This repository has been archived by the owner on Aug 17, 2020. It is now read-only.

Commit

Permalink
Merge pull request #54 from square/jw/remove-worker-thread
Browse files Browse the repository at this point in the history
Comment out worker thread annotations for now.
  • Loading branch information
JakeWharton committed Sep 2, 2015
2 parents c52ccb8 + 65c4f39 commit c6db534
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 14 deletions.
23 changes: 11 additions & 12 deletions sqlbrite/src/main/java/com/squareup/sqlbrite/BriteDatabase.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
import android.support.annotation.IntDef;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.annotation.WorkerThread;
import com.squareup.sqlbrite.SqlBrite.Query;
import java.io.Closeable;
import java.io.IOException;
Expand Down Expand Up @@ -312,7 +311,7 @@ private QueryObservable createQuery(final Func1<Set<String>, Boolean> tableFilte
*
* @see SQLiteDatabase#rawQuery(String, String[])
*/
@CheckResult @WorkerThread
@CheckResult // TODO @WorkerThread
public Cursor query(@NonNull String sql, @NonNull String... args) {
if (logging) log("QUERY\n sql: %s\n args: %s", sql, Arrays.toString(args));
return getReadableDatabase().rawQuery(sql, args);
Expand All @@ -323,7 +322,7 @@ public Cursor query(@NonNull String sql, @NonNull String... args) {
*
* @see SQLiteDatabase#insert(String, String, ContentValues)
*/
@WorkerThread
// TODO @WorkerThread
public long insert(@NonNull String table, @NonNull ContentValues values) {
return insert(table, values, CONFLICT_NONE);
}
Expand All @@ -333,7 +332,7 @@ public long insert(@NonNull String table, @NonNull ContentValues values) {
*
* @see SQLiteDatabase#insertWithOnConflict(String, String, ContentValues, int)
*/
@WorkerThread
// TODO @WorkerThread
public long insert(@NonNull String table, @NonNull ContentValues values,
@ConflictAlgorithm int conflictAlgorithm) {
SQLiteDatabase db = getWriteableDatabase();
Expand All @@ -359,7 +358,7 @@ public long insert(@NonNull String table, @NonNull ContentValues values,
*
* @see SQLiteDatabase#delete(String, String, String[])
*/
@WorkerThread
// TODO @WorkerThread
public int delete(@NonNull String table, @Nullable String whereClause,
@Nullable String... whereArgs) {
SQLiteDatabase db = getWriteableDatabase();
Expand All @@ -385,7 +384,7 @@ public int delete(@NonNull String table, @Nullable String whereClause,
*
* @see SQLiteDatabase#update(String, ContentValues, String, String[])
*/
@WorkerThread
// TODO @WorkerThread
public int update(@NonNull String table, @NonNull ContentValues values,
@Nullable String whereClause, @Nullable String... whereArgs) {
return update(table, values, CONFLICT_NONE, whereClause, whereArgs);
Expand All @@ -397,7 +396,7 @@ public int update(@NonNull String table, @NonNull ContentValues values,
*
* @see SQLiteDatabase#updateWithOnConflict(String, ContentValues, String, String[], int)
*/
@WorkerThread
// TODO @WorkerThread
public int update(@NonNull String table, @NonNull ContentValues values,
@ConflictAlgorithm int conflictAlgorithm, @Nullable String whereClause,
@Nullable String... whereArgs) {
Expand Down Expand Up @@ -427,7 +426,7 @@ public interface Transaction extends Closeable {
*
* @see SQLiteDatabase#endTransaction()
*/
@WorkerThread
// TODO @WorkerThread
void end();

/**
Expand All @@ -438,7 +437,7 @@ public interface Transaction extends Closeable {
*
* @see SQLiteDatabase#setTransactionSuccessful()
*/
@WorkerThread
// TODO @WorkerThread
void markSuccessful();

/**
Expand All @@ -452,7 +451,7 @@ public interface Transaction extends Closeable {
*
* @see SQLiteDatabase#yieldIfContendedSafely()
*/
@WorkerThread
// TODO @WorkerThread
boolean yieldIfContendedSafely();

/**
Expand All @@ -469,13 +468,13 @@ public interface Transaction extends Closeable {
*
* @see SQLiteDatabase#yieldIfContendedSafely(long)
*/
@WorkerThread
// TODO @WorkerThread
boolean yieldIfContendedSafely(long sleepAmount, TimeUnit sleepUnit);

/**
* Equivalent to calling {@link #end()}
*/
@WorkerThread
// TODO @WorkerThread
@Override void close();
}

Expand Down
3 changes: 1 addition & 2 deletions sqlbrite/src/main/java/com/squareup/sqlbrite/SqlBrite.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
import android.database.sqlite.SQLiteOpenHelper;
import android.support.annotation.CheckResult;
import android.support.annotation.NonNull;
import android.support.annotation.WorkerThread;
import android.util.Log;
import rx.Observable;
import rx.Subscriber;
Expand Down Expand Up @@ -73,7 +72,7 @@ public BriteContentResolver wrapContentProvider(@NonNull ContentResolver content
/** An executable query. */
public static abstract class Query {
/** Execute the query on the underlying database and return the resulting cursor. */
@CheckResult @WorkerThread
@CheckResult // TODO @WorkerThread
// TODO Implementations might return null, which is gross. Throw?
public abstract Cursor run();

Expand Down

0 comments on commit c6db534

Please sign in to comment.