本文整理汇总了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);
}
}
示例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;
}
示例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());
}
示例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;
}
示例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;
}
}
示例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());
}
}
}
}
示例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);
}
}
}
}
}
}
示例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());
}
}
示例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);
}
});
}
示例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;
}
示例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());
}
}
示例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;
}