InfocLog.smali

.class public Lcom/cmcm/support/util/InfocLog;
.super Ljava/lang/Object;
.source "InfocLog.java"


# annotations
.annotation system Ldalvik/annotation/MemberClasses;
    value = {
        Lcom/cmcm/support/util/InfocLog$LogItem;
    }
.end annotation


# static fields
.field private static final LOG_FILE_NAME_FIRST:Ljava/lang/String; = "log.0"

.field private static final LOG_FILE_NAME_SECOND:Ljava/lang/String; = "log.1"

.field private static final LOG_FMT:Ljava/lang/String; = "%s!@#$#@!%s!@#$#@!%s!@#$#@!%s\n"

.field private static final LogDirPath:Ljava/lang/String; = "/infoc/log"

.field private static final MAX_FILE_SIZE:J = 0x80000L

.field private static final THREAD_RETAIN_TIME:J = 0x7530L

.field private static mInstance:Lcom/cmcm/support/util/InfocLog;

.field private static final mSem:[B

.field private static final nDateFormatLock:Ljava/lang/Object;


# instance fields
.field private filesDirPath:Ljava/lang/String;

.field private mCurrentLogFile:Ljava/io/File;

.field private final mDateFormat:Ljava/text/SimpleDateFormat;

.field private final mLogItemList:Ljava/util/LinkedList;
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "Ljava/util/LinkedList",
            "<",
            "Lcom/cmcm/support/util/InfocLog$LogItem;",
            ">;"
        }
    .end annotation
.end field

.field private mRunnable:Ljava/lang/Runnable;

.field private mWriteThread:Ljava/lang/Thread;


# direct methods
.method static constructor <clinit>()V
    .registers 1

    .prologue
    .line 30
    const/4 v0, 0x1

    new-array v0, v0, [B

    sput-object v0, Lcom/cmcm/support/util/InfocLog;->mSem:[B

    .line 31
    new-instance v0, Ljava/lang/Object;

    invoke-direct {v0}, Ljava/lang/Object;-><init>()V

    sput-object v0, Lcom/cmcm/support/util/InfocLog;->nDateFormatLock:Ljava/lang/Object;

    .line 33
    new-instance v0, Lcom/cmcm/support/util/InfocLog;

    invoke-direct {v0}, Lcom/cmcm/support/util/InfocLog;-><init>()V

    sput-object v0, Lcom/cmcm/support/util/InfocLog;->mInstance:Lcom/cmcm/support/util/InfocLog;

    return-void
.end method

.method private constructor <init>()V
    .registers 4

    .prologue
    const/4 v2, 0x0

    .line 46
    invoke-direct {p0}, Ljava/lang/Object;-><init>()V

    .line 28
    new-instance v0, Ljava/text/SimpleDateFormat;

    const-string v1, "yyyy-MM-dd HH:mm:ss"

    invoke-direct {v0, v1}, Ljava/text/SimpleDateFormat;-><init>(Ljava/lang/String;)V

    iput-object v0, p0, Lcom/cmcm/support/util/InfocLog;->mDateFormat:Ljava/text/SimpleDateFormat;

    .line 42
    iput-object v2, p0, Lcom/cmcm/support/util/InfocLog;->mWriteThread:Ljava/lang/Thread;

    .line 82
    new-instance v0, Lcom/cmcm/support/util/InfocLog$1;

    invoke-direct {v0, p0}, Lcom/cmcm/support/util/InfocLog$1;-><init>(Lcom/cmcm/support/util/InfocLog;)V

    iput-object v0, p0, Lcom/cmcm/support/util/InfocLog;->mRunnable:Ljava/lang/Runnable;

    .line 187
    iput-object v2, p0, Lcom/cmcm/support/util/InfocLog;->mCurrentLogFile:Ljava/io/File;

    .line 47
    new-instance v0, Ljava/util/LinkedList;

    invoke-direct {v0}, Ljava/util/LinkedList;-><init>()V

    iput-object v0, p0, Lcom/cmcm/support/util/InfocLog;->mLogItemList:Ljava/util/LinkedList;

    .line 48
    return-void
.end method

.method static synthetic access$000(Lcom/cmcm/support/util/InfocLog;)Lcom/cmcm/support/util/InfocLog$LogItem;
    .registers 2

    .prologue
    .line 17
    invoke-direct {p0}, Lcom/cmcm/support/util/InfocLog;->getItemFromList()Lcom/cmcm/support/util/InfocLog$LogItem;

    move-result-object v0

    return-object v0
.end method

.method static synthetic access$100(Lcom/cmcm/support/util/InfocLog;)V
    .registers 1

    .prologue
    .line 17
    invoke-direct {p0}, Lcom/cmcm/support/util/InfocLog;->waitForNewWrite()V

    return-void
.end method

.method static synthetic access$200(Lcom/cmcm/support/util/InfocLog;Lcom/cmcm/support/util/InfocLog$LogItem;)V
    .registers 2

    .prologue
    .line 17
    invoke-direct {p0, p1}, Lcom/cmcm/support/util/InfocLog;->writeDataToFile(Lcom/cmcm/support/util/InfocLog$LogItem;)V

    return-void
.end method

.method private closeFileChannel(Ljava/nio/channels/FileChannel;)V
    .registers 3

    .prologue
    .line 168
    if-eqz p1, :cond_5

    .line 170
    :try_start_2
    invoke-virtual {p1}, Ljava/nio/channels/FileChannel;->close()V
    :try_end_5
    .catch Ljava/io/IOException; {:try_start_2 .. :try_end_5} :catch_6

    .line 176
    :cond_5
    :goto_5
    return-void

    .line 172
    :catch_6
    move-exception v0

    .line 173
    invoke-virtual {v0}, Ljava/io/IOException;->printStackTrace()V

    goto :goto_5
.end method

.method private closeFileLock(Ljava/nio/channels/FileLock;)V
    .registers 3

    .prologue
    .line 157
    if-eqz p1, :cond_5

    .line 159
    :try_start_2
    invoke-virtual {p1}, Ljava/nio/channels/FileLock;->release()V
    :try_end_5
    .catch Ljava/io/IOException; {:try_start_2 .. :try_end_5} :catch_6

    .line 165
    :cond_5
    :goto_5
    return-void

    .line 161
    :catch_6
    move-exception v0

    .line 162
    invoke-virtual {v0}, Ljava/io/IOException;->printStackTrace()V

    goto :goto_5
.end method

.method private closeOutputStream(Ljava/io/OutputStream;)V
    .registers 3

    .prologue
    .line 179
    if-nez p1, :cond_3

    .line 185
    :goto_2
    return-void

    .line 181
    :cond_3
    :try_start_3
    invoke-virtual {p1}, Ljava/io/OutputStream;->close()V
    :try_end_6
    .catch Ljava/lang/Exception; {:try_start_3 .. :try_end_6} :catch_7

    goto :goto_2

    .line 182
    :catch_7
    move-exception v0

    .line 183
    invoke-virtual {v0}, Ljava/lang/Exception;->printStackTrace()V

    goto :goto_2
.end method

.method private getItemFromList()Lcom/cmcm/support/util/InfocLog$LogItem;
    .registers 4

    .prologue
    .line 103
    const/4 v0, 0x0

    .line 104
    iget-object v1, p0, Lcom/cmcm/support/util/InfocLog;->mLogItemList:Ljava/util/LinkedList;

    monitor-enter v1

    .line 105
    :try_start_4
    iget-object v2, p0, Lcom/cmcm/support/util/InfocLog;->mLogItemList:Ljava/util/LinkedList;

    invoke-virtual {v2}, Ljava/util/LinkedList;->isEmpty()Z

    move-result v2

    if-nez v2, :cond_14

    .line 106
    iget-object v0, p0, Lcom/cmcm/support/util/InfocLog;->mLogItemList:Ljava/util/LinkedList;

    invoke-virtual {v0}, Ljava/util/LinkedList;->remove()Ljava/lang/Object;

    move-result-object v0

    check-cast v0, Lcom/cmcm/support/util/InfocLog$LogItem;

    .line 107
    :cond_14
    monitor-exit v1

    .line 108
    return-object v0

    .line 107
    :catchall_16
    move-exception v0

    monitor-exit v1
    :try_end_18
    .catchall {:try_start_4 .. :try_end_18} :catchall_16

    throw v0
.end method

.method private getLogFile()Ljava/io/File;
    .registers 3

    .prologue
    .line 190
    iget-object v0, p0, Lcom/cmcm/support/util/InfocLog;->mCurrentLogFile:Ljava/io/File;

    if-eqz v0, :cond_f

    iget-object v0, p0, Lcom/cmcm/support/util/InfocLog;->mCurrentLogFile:Ljava/io/File;

    invoke-virtual {v0}, Ljava/io/File;->canWrite()Z

    move-result v0

    if-eqz v0, :cond_f

    .line 191
    iget-object v0, p0, Lcom/cmcm/support/util/InfocLog;->mCurrentLogFile:Ljava/io/File;

    .line 198
    :goto_e
    return-object v0

    .line 194
    :cond_f
    new-instance v0, Ljava/lang/StringBuilder;

    invoke-direct {v0}, Ljava/lang/StringBuilder;-><init>()V

    sget-object v1, Lcom/cmcm/support/util/InfocLog;->mInstance:Lcom/cmcm/support/util/InfocLog;

    iget-object v1, v1, Lcom/cmcm/support/util/InfocLog;->filesDirPath:Ljava/lang/String;

    invoke-virtual {v0, v1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v0

    const-string v1, "/infoc/log"

    invoke-virtual {v0, v1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v0

    invoke-virtual {v0}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v0

    .line 195
    invoke-direct {p0, v0}, Lcom/cmcm/support/util/InfocLog;->parentDirsExist(Ljava/lang/String;)Z

    move-result v1

    if-nez v1, :cond_2e

    const/4 v0, 0x0

    goto :goto_e

    .line 197
    :cond_2e
    invoke-direct {p0, v0}, Lcom/cmcm/support/util/InfocLog;->getRightLogFile(Ljava/lang/String;)Ljava/io/File;

    move-result-object v0

    iput-object v0, p0, Lcom/cmcm/support/util/InfocLog;->mCurrentLogFile:Ljava/io/File;

    .line 198
    iget-object v0, p0, Lcom/cmcm/support/util/InfocLog;->mCurrentLogFile:Ljava/io/File;

    goto :goto_e
.end method

.method private getRightLogFile(Ljava/lang/String;)Ljava/io/File;
    .registers 5

    .prologue
    .line 210
    new-instance v0, Ljava/io/File;

    const-string v1, "log.0"

    invoke-direct {v0, p1, v1}, Ljava/io/File;-><init>(Ljava/lang/String;Ljava/lang/String;)V

    .line 211
    invoke-direct {p0, v0}, Lcom/cmcm/support/util/InfocLog;->isLogFileValid(Ljava/io/File;)Z

    move-result v1

    .line 212
    if-eqz v1, :cond_e

    .line 232
    :goto_d
    return-object v0

    .line 215
    :cond_e
    new-instance v1, Ljava/io/File;

    const-string v2, "log.1"

    invoke-direct {v1, p1, v2}, Ljava/io/File;-><init>(Ljava/lang/String;Ljava/lang/String;)V

    .line 216
    invoke-direct {p0, v1}, Lcom/cmcm/support/util/InfocLog;->isLogFileValid(Ljava/io/File;)Z

    move-result v2

    .line 217
    if-eqz v2, :cond_1d

    move-object v0, v1

    .line 218
    goto :goto_d

    .line 221
    :cond_1d
    invoke-direct {p0, v0}, Lcom/cmcm/support/util/InfocLog;->isFileOverSize(Ljava/io/File;)Z

    move-result v2

    if-eqz v2, :cond_32

    invoke-direct {p0, v1}, Lcom/cmcm/support/util/InfocLog;->isFileOverSize(Ljava/io/File;)Z

    move-result v2

    if-eqz v2, :cond_32

    .line 222
    invoke-virtual {v0}, Ljava/io/File;->delete()Z

    .line 223
    invoke-virtual {v1, v0}, Ljava/io/File;->renameTo(Ljava/io/File;)Z

    .line 225
    :try_start_2f
    invoke-virtual {v1}, Ljava/io/File;->createNewFile()Z
    :try_end_32
    .catch Ljava/io/IOException; {:try_start_2f .. :try_end_32} :catch_34

    :cond_32
    move-object v0, v1

    .line 232
    goto :goto_d

    .line 226
    :catch_34
    move-exception v0

    .line 227
    invoke-virtual {v0}, Ljava/io/IOException;->printStackTrace()V

    .line 228
    const/4 v0, 0x0

    goto :goto_d
.end method

.method private isFileOverSize(Ljava/io/File;)Z
    .registers 6

    .prologue
    .line 237
    if-eqz p1, :cond_15

    invoke-virtual {p1}, Ljava/io/File;->exists()Z

    move-result v0

    if-eqz v0, :cond_15

    invoke-virtual {p1}, Ljava/io/File;->length()J

    move-result-wide v0

    const-wide/32 v2, 0x80000

    cmp-long v0, v0, v2

    if-ltz v0, :cond_15

    const/4 v0, 0x1

    :goto_14
    return v0

    :cond_15
    const/4 v0, 0x0

    goto :goto_14
.end method

.method private isLogFileValid(Ljava/io/File;)Z
    .registers 8

    .prologue
    const/4 v0, 0x0

    .line 242
    if-nez p1, :cond_4

    .line 253
    :cond_3
    :goto_3
    return v0

    .line 244
    :cond_4
    invoke-virtual {p1}, Ljava/io/File;->exists()Z

    move-result v1

    if-nez v1, :cond_d

    .line 246
    :try_start_a
    invoke-virtual {p1}, Ljava/io/File;->createNewFile()Z
    :try_end_d
    .catch Ljava/io/IOException; {:try_start_a .. :try_end_d} :catch_20

    .line 253
    :cond_d
    invoke-virtual {p1}, Ljava/io/File;->exists()Z

    move-result v1

    if-eqz v1, :cond_3

    invoke-virtual {p1}, Ljava/io/File;->length()J

    move-result-wide v2

    const-wide/32 v4, 0x80000

    cmp-long v1, v2, v4

    if-gez v1, :cond_3

    const/4 v0, 0x1

    goto :goto_3

    .line 247
    :catch_20
    move-exception v1

    .line 248
    invoke-virtual {v1}, Ljava/io/IOException;->printStackTrace()V

    goto :goto_3
.end method

.method public static log(Landroid/content/Context;Ljava/lang/String;Ljava/lang/String;Z)V
    .registers 9

    .prologue
    .line 51
    invoke-static {p1}, Landroid/text/TextUtils;->isEmpty(Ljava/lang/CharSequence;)Z

    move-result v0

    if-nez v0, :cond_c

    invoke-static {p2}, Landroid/text/TextUtils;->isEmpty(Ljava/lang/CharSequence;)Z

    move-result v0

    if-eqz v0, :cond_d

    .line 69
    :cond_c
    :goto_c
    return-void

    .line 54
    :cond_d
    sget-object v0, Lcom/cmcm/support/util/InfocLog;->mInstance:Lcom/cmcm/support/util/InfocLog;

    iget-object v1, v0, Lcom/cmcm/support/util/InfocLog;->mLogItemList:Ljava/util/LinkedList;

    monitor-enter v1

    .line 55
    :try_start_12
    new-instance v2, Lcom/cmcm/support/util/InfocLog$LogItem;

    invoke-direct {v2}, Lcom/cmcm/support/util/InfocLog$LogItem;-><init>()V

    .line 56
    iput-object p1, v2, Lcom/cmcm/support/util/InfocLog$LogItem;->tableName:Ljava/lang/String;

    .line 57
    iput-object p2, v2, Lcom/cmcm/support/util/InfocLog$LogItem;->data:Ljava/lang/String;

    .line 59
    if-eqz p3, :cond_58

    const-string v0, "force"

    .line 60
    :goto_1f
    new-instance v3, Ljava/lang/StringBuilder;

    invoke-direct {v3}, Ljava/lang/StringBuilder;-><init>()V

    const-string v4, "plugin  "

    invoke-virtual {v3, v4}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v3

    invoke-virtual {v3, v0}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v0

    invoke-virtual {v0}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v0

    iput-object v0, v2, Lcom/cmcm/support/util/InfocLog$LogItem;->src:Ljava/lang/String;

    .line 61
    sget-object v0, Lcom/cmcm/support/util/InfocLog;->mInstance:Lcom/cmcm/support/util/InfocLog;

    iget-object v0, v0, Lcom/cmcm/support/util/InfocLog;->mLogItemList:Ljava/util/LinkedList;

    invoke-virtual {v0, v2}, Ljava/util/LinkedList;->addLast(Ljava/lang/Object;)V

    .line 62
    monitor-exit v1
    :try_end_3c
    .catchall {:try_start_12 .. :try_end_3c} :catchall_5b

    .line 64
    sget-object v0, Lcom/cmcm/support/util/InfocLog;->mInstance:Lcom/cmcm/support/util/InfocLog;

    iget-object v0, v0, Lcom/cmcm/support/util/InfocLog;->filesDirPath:Ljava/lang/String;

    invoke-static {v0}, Landroid/text/TextUtils;->isEmpty(Ljava/lang/CharSequence;)Z

    move-result v0

    if-eqz v0, :cond_52

    .line 65
    sget-object v0, Lcom/cmcm/support/util/InfocLog;->mInstance:Lcom/cmcm/support/util/InfocLog;

    invoke-virtual {p0}, Landroid/content/Context;->getFilesDir()Ljava/io/File;

    move-result-object v1

    invoke-virtual {v1}, Ljava/io/File;->getAbsolutePath()Ljava/lang/String;

    move-result-object v1

    iput-object v1, v0, Lcom/cmcm/support/util/InfocLog;->filesDirPath:Ljava/lang/String;

    .line 68
    :cond_52
    sget-object v0, Lcom/cmcm/support/util/InfocLog;->mInstance:Lcom/cmcm/support/util/InfocLog;

    invoke-virtual {v0}, Lcom/cmcm/support/util/InfocLog;->sendWriteLogMsg()V

    goto :goto_c

    .line 59
    :cond_58
    :try_start_58
    const-string v0, "unForce"

    goto :goto_1f

    .line 62
    :catchall_5b
    move-exception v0

    monitor-exit v1
    :try_end_5d
    .catchall {:try_start_58 .. :try_end_5d} :catchall_5b

    throw v0
.end method

.method private parentDirsExist(Ljava/lang/String;)Z
    .registers 5

    .prologue
    const/4 v0, 0x0

    .line 202
    invoke-static {p1}, Landroid/text/TextUtils;->isEmpty(Ljava/lang/CharSequence;)Z

    move-result v1

    if-eqz v1, :cond_8

    .line 205
    :cond_7
    :goto_7
    return v0

    .line 204
    :cond_8
    new-instance v1, Ljava/io/File;

    invoke-direct {v1, p1}, Ljava/io/File;-><init>(Ljava/lang/String;)V

    .line 205
    invoke-virtual {v1}, Ljava/io/File;->exists()Z

    move-result v2

    if-nez v2, :cond_19

    invoke-virtual {v1}, Ljava/io/File;->mkdirs()Z

    move-result v1

    if-eqz v1, :cond_7

    :cond_19
    const/4 v0, 0x1

    goto :goto_7
.end method

.method private waitForNewWrite()V
    .registers 5

    .prologue
    .line 112
    sget-object v1, Lcom/cmcm/support/util/InfocLog;->mSem:[B

    monitor-enter v1

    .line 114
    :try_start_3
    sget-object v0, Lcom/cmcm/support/util/InfocLog;->mSem:[B

    const-wide/16 v2, 0x7530

    invoke-virtual {v0, v2, v3}, Ljava/lang/Object;->wait(J)V
    :try_end_a
    .catch Ljava/lang/InterruptedException; {:try_start_3 .. :try_end_a} :catch_c
    .catchall {:try_start_3 .. :try_end_a} :catchall_11

    .line 118
    :goto_a
    :try_start_a
    monitor-exit v1

    .line 119
    return-void

    .line 115
    :catch_c
    move-exception v0

    .line 116
    invoke-virtual {v0}, Ljava/lang/InterruptedException;->printStackTrace()V

    goto :goto_a

    .line 118
    :catchall_11
    move-exception v0

    monitor-exit v1
    :try_end_13
    .catchall {:try_start_a .. :try_end_13} :catchall_11

    throw v0
.end method

.method private writeDataToFile(Lcom/cmcm/support/util/InfocLog$LogItem;)V
    .registers 10

    .prologue
    const/4 v1, 0x0

    .line 124
    invoke-direct {p0}, Lcom/cmcm/support/util/InfocLog;->getLogFile()Ljava/io/File;

    move-result-object v0

    .line 125
    if-nez v0, :cond_8

    .line 154
    :goto_7
    return-void

    .line 128
    :cond_8
    sget-object v2, Lcom/cmcm/support/util/InfocLog;->nDateFormatLock:Ljava/lang/Object;

    monitor-enter v2

    .line 129
    :try_start_b
    iget-object v3, p0, Lcom/cmcm/support/util/InfocLog;->mDateFormat:Ljava/text/SimpleDateFormat;

    new-instance v4, Ljava/util/Date;

    invoke-direct {v4}, Ljava/util/Date;-><init>()V

    invoke-virtual {v3, v4}, Ljava/text/SimpleDateFormat;->format(Ljava/util/Date;)Ljava/lang/String;

    move-result-object v3

    .line 130
    monitor-exit v2
    :try_end_17
    .catchall {:try_start_b .. :try_end_17} :catchall_6a

    .line 132
    const-string v2, "%s!@#$#@!%s!@#$#@!%s!@#$#@!%s\n"

    const/4 v4, 0x4

    new-array v4, v4, [Ljava/lang/Object;

    const/4 v5, 0x0

    aput-object v3, v4, v5

    const/4 v3, 0x1

    iget-object v5, p1, Lcom/cmcm/support/util/InfocLog$LogItem;->tableName:Ljava/lang/String;

    aput-object v5, v4, v3

    const/4 v3, 0x2

    iget-object v5, p1, Lcom/cmcm/support/util/InfocLog$LogItem;->data:Ljava/lang/String;

    aput-object v5, v4, v3

    const/4 v3, 0x3

    iget-object v5, p1, Lcom/cmcm/support/util/InfocLog$LogItem;->src:Ljava/lang/String;

    aput-object v5, v4, v3

    invoke-static {v2, v4}, Ljava/lang/String;->format(Ljava/lang/String;[Ljava/lang/Object;)Ljava/lang/String;

    move-result-object v3

    .line 137
    :try_start_32
    new-instance v2, Ljava/io/RandomAccessFile;

    const-string v4, "rw"

    invoke-direct {v2, v0, v4}, Ljava/io/RandomAccessFile;-><init>(Ljava/io/File;Ljava/lang/String;)V

    .line 138
    invoke-virtual {v2}, Ljava/io/RandomAccessFile;->length()J

    move-result-wide v4

    invoke-virtual {v2, v4, v5}, Ljava/io/RandomAccessFile;->seek(J)V

    .line 140
    invoke-virtual {v2}, Ljava/io/RandomAccessFile;->getChannel()Ljava/nio/channels/FileChannel;
    :try_end_43
    .catch Ljava/lang/Exception; {:try_start_32 .. :try_end_43} :catch_6d
    .catchall {:try_start_32 .. :try_end_43} :catchall_79

    move-result-object v2

    .line 141
    :try_start_44
    invoke-virtual {v2}, Ljava/nio/channels/FileChannel;->lock()Ljava/nio/channels/FileLock;

    move-result-object v1

    .line 142
    const-string v4, "utf-8"

    invoke-virtual {v3, v4}, Ljava/lang/String;->getBytes(Ljava/lang/String;)[B

    move-result-object v3

    invoke-static {v3}, Ljava/nio/ByteBuffer;->wrap([B)Ljava/nio/ByteBuffer;

    move-result-object v3

    invoke-virtual {v2, v3}, Ljava/nio/channels/FileChannel;->write(Ljava/nio/ByteBuffer;)I

    .line 144
    invoke-virtual {v0}, Ljava/io/File;->length()J

    move-result-wide v4

    const-wide/32 v6, 0x80000

    cmp-long v0, v4, v6

    if-ltz v0, :cond_63

    .line 146
    const/4 v0, 0x0

    iput-object v0, p0, Lcom/cmcm/support/util/InfocLog;->mCurrentLogFile:Ljava/io/File;
    :try_end_63
    .catch Ljava/lang/Exception; {:try_start_44 .. :try_end_63} :catch_84
    .catchall {:try_start_44 .. :try_end_63} :catchall_82

    .line 151
    :cond_63
    invoke-direct {p0, v1}, Lcom/cmcm/support/util/InfocLog;->closeFileLock(Ljava/nio/channels/FileLock;)V

    .line 152
    invoke-direct {p0, v2}, Lcom/cmcm/support/util/InfocLog;->closeFileChannel(Ljava/nio/channels/FileChannel;)V

    goto :goto_7

    .line 130
    :catchall_6a
    move-exception v0

    :try_start_6b
    monitor-exit v2
    :try_end_6c
    .catchall {:try_start_6b .. :try_end_6c} :catchall_6a

    throw v0

    .line 148
    :catch_6d
    move-exception v0

    move-object v2, v1

    .line 149
    :goto_6f
    :try_start_6f
    invoke-virtual {v0}, Ljava/lang/Exception;->printStackTrace()V
    :try_end_72
    .catchall {:try_start_6f .. :try_end_72} :catchall_82

    .line 151
    invoke-direct {p0, v1}, Lcom/cmcm/support/util/InfocLog;->closeFileLock(Ljava/nio/channels/FileLock;)V

    .line 152
    invoke-direct {p0, v2}, Lcom/cmcm/support/util/InfocLog;->closeFileChannel(Ljava/nio/channels/FileChannel;)V

    goto :goto_7

    .line 151
    :catchall_79
    move-exception v0

    move-object v2, v1

    :goto_7b
    invoke-direct {p0, v1}, Lcom/cmcm/support/util/InfocLog;->closeFileLock(Ljava/nio/channels/FileLock;)V

    .line 152
    invoke-direct {p0, v2}, Lcom/cmcm/support/util/InfocLog;->closeFileChannel(Ljava/nio/channels/FileChannel;)V

    throw v0

    .line 151
    :catchall_82
    move-exception v0

    goto :goto_7b

    .line 148
    :catch_84
    move-exception v0

    goto :goto_6f
.end method


# virtual methods
.method public declared-synchronized sendWriteLogMsg()V
    .registers 4

    .prologue
    .line 72
    monitor-enter p0

    :try_start_1
    iget-object v0, p0, Lcom/cmcm/support/util/InfocLog;->mWriteThread:Ljava/lang/Thread;

    if-eqz v0, :cond_d

    iget-object v0, p0, Lcom/cmcm/support/util/InfocLog;->mWriteThread:Ljava/lang/Thread;

    invoke-virtual {v0}, Ljava/lang/Thread;->isAlive()Z

    move-result v0

    if-nez v0, :cond_1d

    .line 73
    :cond_d
    new-instance v0, Ljava/lang/Thread;

    iget-object v1, p0, Lcom/cmcm/support/util/InfocLog;->mRunnable:Ljava/lang/Runnable;

    const-string v2, "InfocLog:writeThread"

    invoke-direct {v0, v1, v2}, Ljava/lang/Thread;-><init>(Ljava/lang/Runnable;Ljava/lang/String;)V

    iput-object v0, p0, Lcom/cmcm/support/util/InfocLog;->mWriteThread:Ljava/lang/Thread;

    .line 74
    iget-object v0, p0, Lcom/cmcm/support/util/InfocLog;->mWriteThread:Ljava/lang/Thread;

    invoke-virtual {v0}, Ljava/lang/Thread;->start()V

    .line 77
    :cond_1d
    sget-object v1, Lcom/cmcm/support/util/InfocLog;->mSem:[B

    monitor-enter v1
    :try_end_20
    .catchall {:try_start_1 .. :try_end_20} :catchall_2b

    .line 78
    :try_start_20
    sget-object v0, Lcom/cmcm/support/util/InfocLog;->mSem:[B

    invoke-virtual {v0}, Ljava/lang/Object;->notifyAll()V

    .line 79
    monitor-exit v1
    :try_end_26
    .catchall {:try_start_20 .. :try_end_26} :catchall_28

    .line 80
    monitor-exit p0

    return-void

    .line 79
    :catchall_28
    move-exception v0

    :try_start_29
    monitor-exit v1
    :try_end_2a
    .catchall {:try_start_29 .. :try_end_2a} :catchall_28

    :try_start_2a
    throw v0
    :try_end_2b
    .catchall {:try_start_2a .. :try_end_2b} :catchall_2b

    .line 72
    :catchall_2b
    move-exception v0

    monitor-exit p0

    throw v0
.end method