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


Java FileDownloadLog.v方法代码示例

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


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

示例1: addListener

import com.liulishuo.filedownloader.util.FileDownloadLog; //导入方法依赖的package包/类
@Override
public boolean addListener(final String eventId, final IDownloadListener listener) {
    if (FileDownloadLog.NEED_LOG) {
        FileDownloadLog.v(this, "setListener %s", eventId);
    }
    Assert.assertNotNull("EventPoolImpl.add", listener);

    LinkedList<IDownloadListener> container = listenersMap.get(eventId);

    if (container == null) {
        synchronized (eventId.intern()) {
            container = listenersMap.get(eventId);
            if (container == null) {
                listenersMap.put(eventId, container = new LinkedList<>());
            }
        }
    }


    synchronized (eventId.intern()) {
        return container.add(listener);
    }
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:24,代码来源:DownloadEventPoolImpl.java

示例2: publish

import com.liulishuo.filedownloader.util.FileDownloadLog; //导入方法依赖的package包/类
@Override
public boolean publish(final IDownloadEvent event) {
    if (FileDownloadLog.NEED_LOG) {
        FileDownloadLog.v(this, "publish %s", event.getId());
    }
    Assert.assertNotNull("EventPoolImpl.publish", event);
    String eventId = event.getId();
    LinkedList<IDownloadListener> listeners = listenersMap.get(eventId);
    if (listeners == null) {
        synchronized (eventId.intern()) {
            listeners = listenersMap.get(eventId);
            if (listeners == null) {
                if (FileDownloadLog.NEED_LOG) {
                    FileDownloadLog.d(this, "No listener for this event %s", eventId);
                }
                return false;
            }
        }
    }

    trigger(listeners, event);
    return true;
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:24,代码来源:DownloadEventPoolImpl.java

示例3: onOver

import com.liulishuo.filedownloader.util.FileDownloadLog; //导入方法依赖的package包/类
@Override
public void onOver() {
    final BaseDownloadTask origin = mTask.getRunningTask().getOrigin();

    if (FileDownloadMonitor.isValid()) {
        FileDownloadMonitor.getMonitor().onTaskOver(origin);
    }

    if (FileDownloadLog.NEED_LOG) {
        FileDownloadLog.v(this, "filedownloader:lifecycle:over %s by %d ", toString(),
                getStatus());
    }

    mSpeedMonitor.end(this.mSoFarBytes);
    if (mTask.getFinishListenerList() != null) {
        @SuppressWarnings("unchecked") final ArrayList<BaseDownloadTask.FinishListener>
                listenersCopy =
                (ArrayList<BaseDownloadTask.FinishListener>) mTask.getFinishListenerList().clone();
        final int numListeners = listenersCopy.size();
        for (int i = 0; i < numListeners; ++i) {
            listenersCopy.get(i).over(origin);
        }
    }

    FileDownloader.getImpl().getLostConnectedHandler().taskWorkFine(mTask.getRunningTask());
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:27,代码来源:DownloadTaskHunter.java

示例4: onAssembledTasksToStart

import com.liulishuo.filedownloader.util.FileDownloadLog; //导入方法依赖的package包/类
private boolean onAssembledTasksToStart(int attachKey, final List<BaseDownloadTask.IRunningTask> list,
                                        final FileDownloadListener listener, boolean isSerial) {
    if (FileDownloadMonitor.isValid()) {
        FileDownloadMonitor.getMonitor().onRequestStart(list.size(), true, listener);
    }

    if (FileDownloadLog.NEED_LOG) {
        FileDownloadLog.v(FileDownloader.class, "start list attachKey[%d] size[%d] " +
                "listener[%s] isSerial[%B]", attachKey, list.size(), listener, isSerial);
    }

    if (list == null || list.isEmpty()) {
        FileDownloadLog.w(FileDownloader.class, "Tasks with the listener can't start, " +
                        "because can't find any task with the provided listener, maybe tasks " +
                        "instance has been started in the past, so they are all are inUsing, if " +
                        "in this case, you can use [BaseDownloadTask#reuse] to reuse theme " +
                        "first then start again: [%s, %B]",
                listener, isSerial);

        return true;
    }

    return false;

}
 
开发者ID:angcyo,项目名称:RLibrary,代码行数:26,代码来源:QueuesHandler.java

示例5: removeListener

import com.liulishuo.filedownloader.util.FileDownloadLog; //导入方法依赖的package包/类
@Override
public boolean removeListener(final String eventId, final IDownloadListener listener) {
    if (FileDownloadLog.NEED_LOG) {
        FileDownloadLog.v(this, "removeListener %s", eventId);
    }

    LinkedList<IDownloadListener> container = listenersMap.get(eventId);
    if (container == null) {
        synchronized (eventId.intern()) {
            container = listenersMap.get(eventId);
        }
    }

    if (container == null || listener == null) {
        return false;
    }

    synchronized (eventId.intern()) {
        boolean succeed = container.remove(listener);
        if (container.size() <= 0) {
            listenersMap.remove(eventId);
        }
        return succeed;
    }
}
 
开发者ID:angcyo,项目名称:RLibrary,代码行数:26,代码来源:DownloadEventPoolImpl.java

示例6: addUnchecked

import com.liulishuo.filedownloader.util.FileDownloadLog; //导入方法依赖的package包/类
/**
 * This method generally used for enqueuing the task which will be assembled by a queue.
 *
 * @see BaseDownloadTask.InQueueTask#enqueue()
 */
void addUnchecked(final BaseDownloadTask.IRunningTask task) {
    if (task.isMarkedAdded2List()) {
        return;
    }

    synchronized (mList) {
        if (mList.contains(task)) {
            FileDownloadLog.w(this, "already has %s", task);
        } else {
            task.markAdded2List();
            mList.add(task);
            if (FileDownloadLog.NEED_LOG) {
                FileDownloadLog.v(this, "add list in all %s %d %d", task,
                        task.getOrigin().getStatus(), mList.size());
            }
        }
    }
}
 
开发者ID:yannanzheng,项目名称:FileDownloader-master,代码行数:24,代码来源:FileDownloadList.java

示例7: addUserRequiredHeader

import com.liulishuo.filedownloader.util.FileDownloadLog; //导入方法依赖的package包/类
void addUserRequiredHeader(FileDownloadConnection connection) {
    final HashMap<String, List<String>> additionHeaders;
    if (header != null) {
        additionHeaders = header.getHeaders();

        if (additionHeaders != null) {
            if (FileDownloadLog.NEED_LOG) {
                FileDownloadLog.v(this, "%d add outside header: %s", downloadId, additionHeaders);
            }

            String name;
            List<String> list;

            // add addition headers which is provided by the user
            Set<Map.Entry<String, List<String>>> entries = additionHeaders.entrySet();
            for (Map.Entry<String, List<String>> e : entries) {
                name = e.getKey();
                list = e.getValue();
                if (list != null) {
                    for (String value : list) {
                        connection.addHeader(name, value);
                    }
                }
            }

        }
    }
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:29,代码来源:ConnectTask.java

示例8: onBegin

import com.liulishuo.filedownloader.util.FileDownloadLog; //导入方法依赖的package包/类
@Override
public void onBegin() {
    if (FileDownloadMonitor.isValid()) {
        FileDownloadMonitor.getMonitor().onTaskBegin(mTask.getRunningTask().getOrigin());
    }

    if (FileDownloadLog.NEED_LOG) {
        FileDownloadLog.v(this, "filedownloader:lifecycle:start %s by %d ", toString(), getStatus());
    }
}
 
开发者ID:yannanzheng,项目名称:FileDownloader-master,代码行数:11,代码来源:DownloadTaskHunter.java

示例9: asyncPublishInNewThread

import com.liulishuo.filedownloader.util.FileDownloadLog; //导入方法依赖的package包/类
@Override
public void asyncPublishInNewThread(final IDownloadEvent event) {
    if (FileDownloadLog.NEED_LOG) {
        FileDownloadLog.v(this, "asyncPublishInNewThread %s", event.getId());
    }
    Assert.assertNotNull("EventPoolImpl.asyncPublish event", event);

    threadPool.execute(new Runnable() {
        @Override
        public void run() {
            DownloadEventPoolImpl.this.publish(event);
        }
    });
}
 
开发者ID:angcyo,项目名称:RLibrary,代码行数:15,代码来源:DownloadEventPoolImpl.java

示例10: remove

import com.liulishuo.filedownloader.util.FileDownloadLog; //导入方法依赖的package包/类
/**
 * @param willRemoveDownload will be remove
 */
public boolean remove(final BaseDownloadTask.IRunningTask willRemoveDownload,
                      MessageSnapshot snapshot) {
    final byte removeByStatus = snapshot.getStatus();
    boolean succeed;
    synchronized (mList) {
        succeed = mList.remove(willRemoveDownload);
    }
    if (FileDownloadLog.NEED_LOG) {
        if (mList.size() == 0) {
            FileDownloadLog.v(this, "remove %s left %d %d",
                    willRemoveDownload, removeByStatus, mList.size());
        }
    }

    if (succeed) {
        final IFileDownloadMessenger messenger = willRemoveDownload.getMessageHandler().
                getMessenger();
        // Notify 2 Listener
        switch (removeByStatus) {
            case FileDownloadStatus.warn:
                messenger.notifyWarn(snapshot);
                break;
            case FileDownloadStatus.error:
                messenger.notifyError(snapshot);
                break;
            case FileDownloadStatus.paused:
                messenger.notifyPaused(snapshot);
                break;
            case FileDownloadStatus.completed:
                messenger.notifyBlockComplete(MessageSnapshotTaker.takeBlockCompleted(snapshot));
                break;
        }

    } else {
        FileDownloadLog.e(this, "remove error, not exist: %s %d", willRemoveDownload,
                removeByStatus);
    }

    return succeed;
}
 
开发者ID:angcyo,项目名称:RLibrary,代码行数:44,代码来源:FileDownloadList.java

示例11: intoLaunchPool

import com.liulishuo.filedownloader.util.FileDownloadLog; //导入方法依赖的package包/类
@Override
public void intoLaunchPool() {
    synchronized (mPauseLock) {
        if (mStatus != FileDownloadStatus.INVALID_STATUS) {
            FileDownloadLog.w(this, "High concurrent cause, this task %d will not input " +
                            "to launch pool, because of the status isn't idle : %d",
                    getId(), mStatus);
            return;
        }

        mStatus = FileDownloadStatus.toLaunchPool;
    }

    final BaseDownloadTask.IRunningTask runningTask = mTask.getRunningTask();
    final BaseDownloadTask origin = runningTask.getOrigin();

    if (FileDownloadMonitor.isValid()) {
        FileDownloadMonitor.getMonitor().onRequestStart(origin);
    }

    if (FileDownloadLog.NEED_LOG) {
        FileDownloadLog.v(this, "call start " +
                        "Url[%s], Path[%s] Listener[%s], Tag[%s]",
                origin.getUrl(), origin.getPath(), origin.getListener(), origin.getTag());
    }

    boolean ready = true;

    try {
        prepare();
    } catch (Throwable e) {
        ready = false;

        FileDownloadList.getImpl().add(runningTask);
        FileDownloadList.getImpl().remove(runningTask, prepareErrorMessage(e));
    }

    if (ready) {
        FileDownloadTaskLauncher.getImpl().launch(this);
    }

    if (FileDownloadLog.NEED_LOG) {
        FileDownloadLog.v(this, "the task[%d] has been into the launch pool.", getId());
    }
}
 
开发者ID:angcyo,项目名称:RLibrary,代码行数:46,代码来源:DownloadTaskHunter.java

示例12: pause

import com.liulishuo.filedownloader.util.FileDownloadLog; //导入方法依赖的package包/类
@Override
public boolean pause() {
    if (FileDownloadStatus.isOver(getStatus())) {
        if (FileDownloadLog.NEED_LOG) {
            /**
             * The over-mStatus call-backed and set the over-mStatus to this task between here
             * area and remove from the {@link FileDownloadList}.
             *
             * High concurrent cause.
             */
            FileDownloadLog.d(this, "High concurrent cause, Already is over, can't pause " +
                    "again, %d %d", getStatus(), mTask.getRunningTask().getOrigin().getId());
        }
        return false;
    }
    this.mStatus = FileDownloadStatus.paused;

    final BaseDownloadTask.IRunningTask runningTask = mTask.getRunningTask();
    final BaseDownloadTask origin = runningTask.getOrigin();

    FileDownloadTaskLauncher.getImpl().expire(this);
    if (FileDownloadLog.NEED_LOG) {
        FileDownloadLog.v(this, "the task[%d] has been expired from the launch pool.", getId());
    }

    if (!FileDownloader.getImpl().isServiceConnected()) {
        if (FileDownloadLog.NEED_LOG) {
            FileDownloadLog.d(this, "request pause the task[%d] to the download service, but" +
                    " the download service isn't connected yet.", origin.getId());
        }
    } else {
        FileDownloadServiceProxy.getImpl().pause(origin.getId());
    }

    // For make sure already added event mListener for receive paused event
    FileDownloadList.getImpl().add(runningTask);
    FileDownloadList.getImpl().remove(runningTask, MessageSnapshotTaker.catchPause(origin));

    FileDownloader.getImpl().getLostConnectedHandler().taskWorkFine(runningTask);

    return true;
}
 
开发者ID:angcyo,项目名称:RLibrary,代码行数:43,代码来源:DownloadTaskHunter.java


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