今奥全景相机
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

145 lines
4.1 KiB

.class public Lcom/viatech/database/DBHelper;
.super Ljava/lang/Object;
.source "DBHelper.java"
# instance fields
.field private lock:Ljava/util/concurrent/locks/ReadWriteLock;
.field private readLock:Ljava/util/concurrent/locks/Lock;
.field private writeLock:Ljava/util/concurrent/locks/Lock;
# direct methods
.method public constructor <init>()V
.locals 2
.prologue
.line 9
invoke-direct {p0}, Ljava/lang/Object;-><init>()V
.line 11
new-instance v0, Ljava/util/concurrent/locks/ReentrantReadWriteLock;
const/4 v1, 0x1
invoke-direct {v0, v1}, Ljava/util/concurrent/locks/ReentrantReadWriteLock;-><init>(Z)V
iput-object v0, p0, Lcom/viatech/database/DBHelper;->lock:Ljava/util/concurrent/locks/ReadWriteLock;
.line 12
iget-object v0, p0, Lcom/viatech/database/DBHelper;->lock:Ljava/util/concurrent/locks/ReadWriteLock;
invoke-interface {v0}, Ljava/util/concurrent/locks/ReadWriteLock;->readLock()Ljava/util/concurrent/locks/Lock;
move-result-object v0
iput-object v0, p0, Lcom/viatech/database/DBHelper;->readLock:Ljava/util/concurrent/locks/Lock;
.line 13
iget-object v0, p0, Lcom/viatech/database/DBHelper;->lock:Ljava/util/concurrent/locks/ReadWriteLock;
invoke-interface {v0}, Ljava/util/concurrent/locks/ReadWriteLock;->writeLock()Ljava/util/concurrent/locks/Lock;
move-result-object v0
iput-object v0, p0, Lcom/viatech/database/DBHelper;->writeLock:Ljava/util/concurrent/locks/Lock;
return-void
.end method
# virtual methods
.method public getReadableDataBase(Ljava/lang/String;Ljava/lang/String;)Landroid/database/sqlite/SQLiteDatabase;
.locals 3
.prologue
.line 17
iget-object v0, p0, Lcom/viatech/database/DBHelper;->readLock:Ljava/util/concurrent/locks/Lock;
invoke-interface {v0}, Ljava/util/concurrent/locks/Lock;->lock()V
.line 20
:try_start_0
invoke-virtual {p1, p2}, Ljava/lang/String;->concat(Ljava/lang/String;)Ljava/lang/String;
move-result-object v0
.line 22
const/4 v1, 0x0
const/16 v2, 0x10
invoke-static {v0, v1, v2}, Landroid/database/sqlite/SQLiteDatabase;->openDatabase(Ljava/lang/String;Landroid/database/sqlite/SQLiteDatabase$CursorFactory;I)Landroid/database/sqlite/SQLiteDatabase;
:try_end_0
.catchall {:try_start_0 .. :try_end_0} :catchall_0
move-result-object v0
.line 24
iget-object v1, p0, Lcom/viatech/database/DBHelper;->readLock:Ljava/util/concurrent/locks/Lock;
invoke-interface {v1}, Ljava/util/concurrent/locks/Lock;->unlock()V
.line 22
return-object v0
.line 24
:catchall_0
move-exception v0
iget-object v1, p0, Lcom/viatech/database/DBHelper;->readLock:Ljava/util/concurrent/locks/Lock;
invoke-interface {v1}, Ljava/util/concurrent/locks/Lock;->unlock()V
.line 25
throw v0
.end method
.method public getWritableDataBase(Ljava/lang/String;Ljava/lang/String;)Landroid/database/sqlite/SQLiteDatabase;
.locals 3
.prologue
.line 30
iget-object v0, p0, Lcom/viatech/database/DBHelper;->writeLock:Ljava/util/concurrent/locks/Lock;
invoke-interface {v0}, Ljava/util/concurrent/locks/Lock;->lock()V
.line 33
:try_start_0
invoke-virtual {p1, p2}, Ljava/lang/String;->concat(Ljava/lang/String;)Ljava/lang/String;
move-result-object v0
.line 35
const/4 v1, 0x0
const/16 v2, 0x10
invoke-static {v0, v1, v2}, Landroid/database/sqlite/SQLiteDatabase;->openDatabase(Ljava/lang/String;Landroid/database/sqlite/SQLiteDatabase$CursorFactory;I)Landroid/database/sqlite/SQLiteDatabase;
:try_end_0
.catchall {:try_start_0 .. :try_end_0} :catchall_0
move-result-object v0
.line 37
iget-object v1, p0, Lcom/viatech/database/DBHelper;->writeLock:Ljava/util/concurrent/locks/Lock;
invoke-interface {v1}, Ljava/util/concurrent/locks/Lock;->unlock()V
.line 35
return-object v0
.line 37
:catchall_0
move-exception v0
iget-object v1, p0, Lcom/viatech/database/DBHelper;->writeLock:Ljava/util/concurrent/locks/Lock;
invoke-interface {v1}, Ljava/util/concurrent/locks/Lock;->unlock()V
.line 38
throw v0
.end method