当前位置: 首页>>代码示例>>Java>>正文


Java Log.d方法代码示例

本文整理汇总了Java中com.couchbase.lite.util.Log.d方法的典型用法代码示例。如果您正苦于以下问题:Java Log.d方法的具体用法?Java Log.d怎么用?Java Log.d使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.couchbase.lite.util.Log的用法示例。


在下文中一共展示了Log.d方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: _getDocument

import com.couchbase.lite.util.Log; //导入方法依赖的package包/类
/**
 * @note return value should not be null.
 */
private Document _getDocument(String docID) throws CouchbaseLiteException {
    Document doc;
    try {
        doc = forest.getDocument(docID, true);
    } catch (ForestException e) {
        Log.d(TAG, "ForestDB Warning: getDocument(docID, true) docID=[%s] error=[%s]",
                docID, e.toString());
        throw new CouchbaseLiteException(ForestBridge.err2status(e));
    }
    if (!doc.exists()) {
        doc.free();
        throw new CouchbaseLiteException(Status.NOT_FOUND);
    }
    return doc;
}
 
开发者ID:couchbaselabs,项目名称:couchbase-lite-java-forestdb,代码行数:19,代码来源:ForestDBStore.java

示例2: fireTrigger

import com.couchbase.lite.util.Log; //导入方法依赖的package包/类
/**
 * Fire a trigger to the state machine
 */
protected void fireTrigger(final ReplicationTrigger trigger) {
    Log.d(Log.TAG_SYNC, "%s [fireTrigger()] => " + trigger, this);
    // All state machine triggers need to happen on the replicator thread
    synchronized (executor) {
        if (!executor.isShutdown()) {
            executor.submit(new Runnable() {
                @Override
                public void run() {
                    try {
                        Log.d(Log.TAG_SYNC, "firing trigger: %s", trigger);
                        stateMachine.fire(trigger);
                    } catch (Exception e) {
                        Log.i(Log.TAG_SYNC, "Error in StateMachine.fire(trigger): %s", e.getMessage());
                        throw new RuntimeException(e);
                    }
                }
            });
        }
    }
}
 
开发者ID:couchbase,项目名称:couchbase-lite-java-core,代码行数:24,代码来源:ReplicationInternal.java

示例3: retryReplicationIfError

import com.couchbase.lite.util.Log; //导入方法依赖的package包/类
/**
 * Retry replication if previous attempt ends with error
 */
protected void retryReplicationIfError() {
    Log.d(TAG, "retryReplicationIfError() state=" + stateMachine.getState() +
            ", error=" + this.error +
            ", isContinuous()=" + isContinuous() +
            ", isTransientError()=" + Utils.isTransientError(this.error));

    // Make sure if state is IDLE, this method should be called when state becomes IDLE
    if (!stateMachine.getState().equals(ReplicationState.IDLE))
        return;

    if (this.error != null) {
        // IDLE_ERROR
        if (isContinuous()) {
            // 12/16/2014 - only retry if error is transient error 50x http error
            // It may need to retry for any kind of errors
            if (Utils.isTransientError(this.error)) {
                onBeforeScheduleRetry();
                cancelRetryFuture();
                scheduleRetryFuture();
            }
        }
    }
}
 
开发者ID:couchbase,项目名称:couchbase-lite-java-core,代码行数:27,代码来源:ReplicationInternal.java

示例4: receivedChange

import com.couchbase.lite.util.Log; //导入方法依赖的package包/类
public boolean receivedChange(final Map<String, Object> change) {
    // wait if paused flag is on.
    waitIfPaused();
    // check if still running
    if (running) {
        Object seq = change.get("seq");
        if (seq == null) {
            return false;
        }
        //pass the change to the client on the thread that created this change tracker
        if (client != null) {
            Log.d(Log.TAG_CHANGE_TRACKER, "%s: changeTrackerReceivedChange: %s", this, change);
            client.changeTrackerReceivedChange(change);
            Log.d(Log.TAG_CHANGE_TRACKER, "%s: /changeTrackerReceivedChange: %s", this, change);

        }
        lastSequenceID = seq;
    }
    return true;
}
 
开发者ID:couchbase,项目名称:couchbase-lite-java-core,代码行数:21,代码来源:ChangeTracker.java

示例5: close

import com.couchbase.lite.util.Log; //导入方法依赖的package包/类
/**
 * Releases all resources used by the Manager instance and closes all its databases.
 */
@InterfaceAudience.Public
public void close() {
    synchronized (lockDatabases) {
        Log.d(Database.TAG, "Closing " + this);

        // Close all database:
        // Snapshot of the current open database to avoid concurrent modification as
        // the database will be forgotten (removed from the databases map) when it is closed:
        Database[] openDbs = databases.values().toArray(new Database[databases.size()]);
        for (Database database : openDbs)
            database.close();
        databases.clear();

        // Stop reachability:
        context.getNetworkReachabilityManager().stopListening();

        // Shutdown ScheduledExecutorService:
        if (workExecutor != null && !workExecutor.isShutdown())
            Utils.shutdownAndAwaitTermination(workExecutor);

        Log.d(Database.TAG, "Closed " + this);
    }
}
 
开发者ID:couchbase,项目名称:couchbase-lite-java-core,代码行数:27,代码来源:Manager.java

示例6: start

import com.couchbase.lite.util.Log; //导入方法依赖的package包/类
/**
 * Starts observing database changes. The .rows property will now update automatically. (You
 * usually don't need to call this yourself, since calling getRows() will start it for you
 */
@InterfaceAudience.Public
public void start() {

    if (runningState.get() == true) {
        Log.v(Log.TAG_QUERY, "%s: start() called, but runningState is already true.  Ignoring.", this);
        return;
    } else {
        Log.d(Log.TAG_QUERY, "%s: start() called", this);
        runningState.set(true);
    }

    if (!observing) {
        observing = true;
        getDatabase().addChangeListener(this);
        Log.v(Log.TAG_QUERY, "%s: start() is calling update()", this);
        update();
    }
}
 
开发者ID:couchbase,项目名称:couchbase-lite-java-core,代码行数:23,代码来源:LiveQuery.java

示例7: isTransientError

import com.couchbase.lite.util.Log; //导入方法依赖的package包/类
private boolean isTransientError(Response response, Throwable e) {
    Log.d(TAG, "%s: isTransientError, httpResponse: %s e: %s", this, response, e);
    if (response != null) {
        Log.d(TAG, "%s: isTransientError, status code: %d",
                this, response.code());
        if (Utils.isTransientError(response)) {
            Log.d(TAG, "%s: isTransientError, detect a transient error", this);
            return true;
        }
    }
    if (response == null || response.code() < 400) {
        if (e instanceof IOException) {
            Log.d(TAG, "%s: isTransientError, detect an IOException which is a transient error", this);
            return true;
        }
    }
    Log.d(TAG, "%s: isTransientError, return false", this);
    return false;
}
 
开发者ID:couchbase,项目名称:couchbase-lite-java-core,代码行数:20,代码来源:RemoteRequestRetry.java

示例8: sendAsyncRequest

import com.couchbase.lite.util.Log; //导入方法依赖的package包/类
/**
 * @exclude
 */
@InterfaceAudience.Private
public CustomFuture sendAsyncRequest(String method,
                                     URL url,
                                     boolean cancelable,
                                     Map<String, ?> body,
                                     boolean dontLog404,
                                     final RemoteRequestCompletion onCompletion) {
    Log.d(Log.TAG_SYNC, "[sendAsyncRequest()] " + method + " => " + url);
    RemoteRequestRetry request = new RemoteRequestRetry(
            RemoteRequestRetry.RemoteRequestType.REMOTE_REQUEST,
            remoteRequestExecutor,
            executor,
            clientFactory,
            method,
            url,
            serverIsSyncGateway(),
            cancelable,
            body,
            null,
            getLocalDatabase(),
            getHeaders(),
            onCompletion
    );
    request.setDontLog404(dontLog404);
    request.setAuthenticator(getAuthenticator());
    request.setOnPreCompletionCaller(new RemoteRequestCompletion() {
        @Override
        public void onCompletion(RemoteRequest remoteRequest, Response response, Object result, Throwable e) {
            if (serverType == null && response != null) {
                String serverVersion = response.header("Server");
                if (serverVersion != null) {
                    Log.v(Log.TAG_SYNC, "serverVersion: %s", serverVersion);
                    serverType = serverVersion;
                }
            }
        }
    });
    return request.submit(canSendCompressedRequests());
}
 
开发者ID:couchbase,项目名称:couchbase-lite-java-core,代码行数:43,代码来源:ReplicationInternal.java

示例9: run

import com.couchbase.lite.util.Log; //导入方法依赖的package包/类
@Override
public void run() {
    Log.d(Log.TAG_CHANGE_TRACKER, "Thread id => " + Thread.currentThread().getId());
    try {
        runLoop();
    } finally {
        // stopped() method should be called at end of run() method.
        stopped();
    }
}
 
开发者ID:couchbase,项目名称:couchbase-lite-java-core,代码行数:11,代码来源:ChangeTracker.java

示例10: start

import com.couchbase.lite.util.Log; //导入方法依赖的package包/类
public boolean start() {
    Log.d(Log.TAG_CHANGE_TRACKER, "%s: Changed tracker asked to start", this);
    running = true;
    this.error = null;
    String maskedRemoteWithoutCredentials = databaseURL.toExternalForm();
    maskedRemoteWithoutCredentials = maskedRemoteWithoutCredentials.replaceAll("://.*:.*@", "://---:[email protected]");
    thread = new Thread(this, "ChangeTracker-" + maskedRemoteWithoutCredentials);
    thread.start();
    return true;
}
 
开发者ID:couchbase,项目名称:couchbase-lite-java-core,代码行数:11,代码来源:ChangeTracker.java

示例11: stopped

import com.couchbase.lite.util.Log; //导入方法依赖的package包/类
private void stopped() {
    Log.d(Log.TAG_CHANGE_TRACKER, "%s: Change tracker in stopped()", this);
    running = false; // in case stop() method was not called to stop
    if (client != null) {
        Log.d(Log.TAG_CHANGE_TRACKER, "%s: Change tracker calling changeTrackerStopped, client: %s", this, client);
        client.changeTrackerStopped(ChangeTracker.this);
    } else {
        Log.d(Log.TAG_CHANGE_TRACKER, "%s: Change tracker not calling changeTrackerStopped, client == null", this);
    }
    client = null;
}
 
开发者ID:couchbase,项目名称:couchbase-lite-java-core,代码行数:12,代码来源:ChangeTracker.java

示例12: startChangeTracker

import com.couchbase.lite.util.Log; //导入方法依赖的package包/类
protected void startChangeTracker() {
    // make sure not start new changeTracker if pull replicator is not running or idle
    if (!(stateMachine.isInState(ReplicationState.RUNNING) ||
            stateMachine.isInState(ReplicationState.IDLE)))
        return;

    // if changeTracker is already running, not start new one.
    if (changeTracker != null && changeTracker.isRunning())
        return;

    ChangeTracker.ChangeTrackerMode changeTrackerMode;

    // it always starts out as OneShot, but if its a continuous replication
    // it will switch to longpoll later.
    changeTrackerMode = ChangeTracker.ChangeTrackerMode.OneShot;

    Log.d(TAG, "%s: starting ChangeTracker with since=%s mode=%s",
            this, lastSequence, changeTrackerMode);
    changeTracker = new ChangeTracker(remote, changeTrackerMode, true, lastSequence, this);
    changeTracker.setAuthenticator(getAuthenticator());
    Log.d(TAG, "%s: started ChangeTracker %s", this, changeTracker);

    if (filterName != null) {
        changeTracker.setFilterName(filterName);
        if (filterParams != null) {
            changeTracker.setFilterParams(filterParams);
        }
    }
    changeTracker.setDocIDs(documentIDs);
    changeTracker.setRequestHeaders(requestHeaders);
    changeTracker.setContinuous(lifecycle == Replication.Lifecycle.CONTINUOUS);
    changeTracker.setActiveOnly(lastSequence == null && db.getDocumentCount() == 0);
    changeTracker.start();
}
 
开发者ID:couchbase,项目名称:couchbase-lite-java-core,代码行数:35,代码来源:PullerInternal.java

示例13: sleepAppropriateAmountOfTime

import com.couchbase.lite.util.Log; //导入方法依赖的package包/类
public void sleepAppropriateAmountOfTime() {
    try {
        int sleepMilliseconds = getSleepMilliseconds();
        if (sleepMilliseconds > 0) {
            Log.d(Log.TAG_CHANGE_TRACKER, "%s: sleeping for %d", this, sleepMilliseconds);
            Thread.sleep(sleepMilliseconds);
        }
    } catch (InterruptedException e1) {
    }
}
 
开发者ID:couchbase,项目名称:couchbase-lite-java-core,代码行数:11,代码来源:ChangeTrackerBackoff.java

示例14: dbClosing

import com.couchbase.lite.util.Log; //导入方法依赖的package包/类
private void dbClosing() {
    Log.d(TAG, "Database closing! Returning error 500");
    Status status = new Status(Status.INTERNAL_SERVER_ERROR);
    status = sendResponseHeaders(status);
    connection.setResponseCode(status.getCode());
    setResponse();
    sendResponse();
}
 
开发者ID:couchbase,项目名称:couchbase-lite-java-core,代码行数:9,代码来源:Router.java

示例15: processChangeTrackerChange

import com.couchbase.lite.util.Log; //导入方法依赖的package包/类
/**
 * in CBL_Puller.m
 * - (void) changeTrackerReceivedSequence: (id)remoteSequenceID
 * docID: (NSString*)docID
 * revIDs: (NSArray*)revIDs
 * deleted: (BOOL)deleted
 */
protected void processChangeTrackerChange(final Map<String, Object> change) {
    // Process each change from the feed:
    String docID = (String) change.get("id");
    if (docID == null || !Document.isValidDocumentId(docID))
        return;

    String lastSequence = change.get("seq").toString();
    boolean deleted = (change.containsKey("deleted") &&
            change.get("deleted").equals(Boolean.TRUE));
    List<Map<String, Object>> changes = (List<Map<String, Object>>) change.get("changes");
    for (Map<String, Object> changeDict : changes) {
        String revID = (String) changeDict.get("rev");
        if (revID == null) {
            continue;
        }

        PulledRevision rev = new PulledRevision(docID, revID, deleted);

        // Remember its remote sequence ID (opaque), and make up a numeric sequence
        // based on the order in which it appeared in the _changes feed:
        rev.setRemoteSequenceID(lastSequence);

        if (changes.size() > 1)
            rev.setConflicted(true);

        Log.d(TAG, "%s: adding rev to inbox %s", this, rev);

        Log.v(TAG,
                "%s: changeTrackerReceivedChange() incrementing changesCount by 1", this);

        // this is purposefully done slightly different than the ios version
        addToChangesCount(1);

        addToInbox(rev);
    }

    pauseOrResume();
}
 
开发者ID:couchbase,项目名称:couchbase-lite-java-core,代码行数:46,代码来源:PullerInternal.java


注:本文中的com.couchbase.lite.util.Log.d方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。