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


Java FileDownloadLog.NEED_LOG属性代码示例

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


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

示例1: publish

@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:yannanzheng,项目名称:FileDownloader-master,代码行数:23,代码来源:DownloadEventPoolImpl.java

示例2: notifyProgress

@Override
public void notifyProgress(MessageSnapshot snapshot) {
    final BaseDownloadTask originTask = mTask.getOrigin();
    if (FileDownloadLog.NEED_LOG) {
        FileDownloadLog.d(this, "notify progress %s %d %d",
                originTask, originTask.getLargeFileSoFarBytes(),
                originTask.getLargeFileTotalBytes());
    }
    if (originTask.getCallbackProgressTimes() <= 0) {
        if (FileDownloadLog.NEED_LOG) {
            FileDownloadLog.d(this, "notify progress but client not request notify %s", mTask);
        }
        return;
    }

    mLifeCycleCallback.onIng();

    process(snapshot);

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

示例3: onOver

@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:yannanzheng,项目名称:FileDownloader-master,代码行数:26,代码来源:DownloadTaskHunter.java

示例4: onAssembledTasksToStart

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:yannanzheng,项目名称:FileDownloader-master,代码行数:25,代码来源:QueuesHandler.java

示例5: goNext

private void goNext(final int nextIndex) {
    if (this.mHandler == null || this.mList == null) {
        FileDownloadLog.w(this, "need go next %d, but params is not ready %s %s",
                nextIndex, this.mHandler, this.mList);
        return;
    }

    Message nextMsg = this.mHandler.obtainMessage();
    nextMsg.what = WHAT_SERIAL_NEXT;
    nextMsg.arg1 = nextIndex;
    if (FileDownloadLog.NEED_LOG) {
        FileDownloadLog.d(SerialHandlerCallback.class, "start next %s %s",
                this.mList == null ? null : this.mList.get(0) == null ? null :
                        this.mList.get(0).getOrigin().getListener(), nextMsg.arg1);
    }
    this.mHandler.sendMessage(nextMsg);
}
 
开发者ID:angcyo,项目名称:RLibrary,代码行数:17,代码来源:QueuesHandler.java

示例6: addListener

@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:yannanzheng,项目名称:FileDownloader-master,代码行数:23,代码来源:DownloadEventPoolImpl.java

示例7: onStatusChanged

private void onStatusChanged(final byte status) {
    // In current situation, it maybe invoke this method simultaneously between #onPause() and
    // others.
    if (model.getStatus() == FileDownloadStatus.paused) {
        if (FileDownloadLog.NEED_LOG) {
            /**
             * Already paused or the current status is paused.
             *
             * We don't need to call-back to Task in here, because the pause status has
             * already handled by {@link BaseDownloadTask#pause()} manually.
             *
             * In some case, it will arrive here by High concurrent cause.  For performance
             * more make sense.
             *
             * High concurrent cause.
             */
            FileDownloadLog.d(this, "High concurrent cause, Already paused and we don't " +
                    "need to call-back to Task in here, %d", model.getId());
        }
        return;
    }

    MessageSnapshotFlow.getImpl().inflow(MessageSnapshotTaker.take(status, model, processParams));
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:24,代码来源:DownloadStatusCallback.java

示例8: onError

@Override
public void onError(Exception exception) {
    if (paused) {
        if (FileDownloadLog.NEED_LOG) {
            FileDownloadLog.d(this, "the task[%d] has already been paused, so pass the" +
                    " error callback", model.getId());
        }
        return;
    }

    // discard all
    @SuppressWarnings("unchecked") ArrayList<DownloadRunnable> discardList =
            (ArrayList<DownloadRunnable>) downloadRunnableList.clone();
    for (DownloadRunnable runnable : discardList) {
        if (runnable != null) {
            runnable.discard();
            // if runnable is null, then that one must be completed and removed
        }
    }

    statusCallback.onError(exception);
}
 
开发者ID:yannanzheng,项目名称:FileDownloader-master,代码行数:22,代码来源:DownloadLaunchRunnable.java

示例9: createOutputStreamCreator

public FileDownloadHelper.OutputStreamCreator createOutputStreamCreator() {
    if (mMaker == null) {
        return createDefaultOutputStreamCreator();
    }

    final FileDownloadHelper.OutputStreamCreator outputStreamCreator = mMaker.mOutputStreamCreator;
    if (outputStreamCreator != null) {
        if (FileDownloadLog.NEED_LOG) {
            FileDownloadLog.d(this, "initial FileDownloader manager with the customize " +
                    "output stream: %s", outputStreamCreator);
        }
        return outputStreamCreator;
    } else {
        return createDefaultOutputStreamCreator();
    }
}
 
开发者ID:angcyo,项目名称:RLibrary,代码行数:16,代码来源:DownloadMgrInitialParams.java

示例10: updateKeepFlow

@Override
public boolean updateKeepFlow(MessageSnapshot snapshot) {
    final int currentStatus = getStatus();
    final int nextStatus = snapshot.getStatus();

    if (FileDownloadStatus.paused == currentStatus && FileDownloadStatus.isIng(nextStatus)) {
        if (FileDownloadLog.NEED_LOG) {
            /**
             * Occur such situation, must be the running-mStatus waiting for turning up in flow
             * thread pool(or binder thread) when there is someone invoked the {@link #pause()} .
             *
             * High concurrent cause.
             */
            FileDownloadLog.d(this, "High concurrent cause, callback pending, but has already" +
                    " be paused %d", getId());
        }
        return true;
    }

    if (!FileDownloadStatus.isKeepFlow(currentStatus, nextStatus)) {
        if (FileDownloadLog.NEED_LOG) {
            FileDownloadLog.d(this, "can't update mStatus change by keep flow, %d, but the" +
                    " current mStatus is %d, %d", mStatus, getStatus(), getId());
        }

        return false;
    }

    update(snapshot);
    return true;
}
 
开发者ID:yannanzheng,项目名称:FileDownloader-master,代码行数:31,代码来源:DownloadTaskHunter.java

示例11: receive

@Override
public void receive(MessageSnapshot snapshot) {

    final String updateSyncLock = Integer.toString(snapshot.getId());
    synchronized (updateSyncLock.intern()) {
        final List<BaseDownloadTask.IRunningTask> taskList = FileDownloadList.getImpl().
                getReceiveServiceTaskList(snapshot.getId());

        if (taskList.size() > 0) {
            final BaseDownloadTask topOriginTask = taskList.get(0).getOrigin();

            if (FileDownloadLog.NEED_LOG) {
                FileDownloadLog.d(this, "~~~callback %s old[%s] new[%s] %d",
                        snapshot.getId(), topOriginTask.getStatus(), snapshot.getStatus(),
                        taskList.size());
            }

            if (!transmitMessage(taskList, snapshot)) {

                StringBuilder log = new StringBuilder("The event isn't consumed, id:" + snapshot.getId() + " status:"
                        + snapshot.getStatus() + " task-count:" + taskList.size());
                for (BaseDownloadTask.IRunningTask task : taskList) {
                    log.append(" | ").append(task.getOrigin().getStatus());
                }
                FileDownloadLog.i(this, log.toString());
            }


        } else {
            FileDownloadLog.i(this, "Receive the event %d, but there isn't any running task in " +
                    "the upper layer", snapshot.getStatus());
        }

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

示例12: pauseAll

/**
 * Pause all running task
 */
public void pauseAll() {
    List<Integer> list = mThreadPool.getAllExactRunningDownloadIds();

    if (FileDownloadLog.NEED_LOG) {
        FileDownloadLog.d(this, "pause all tasks %d", list.size());
    }

    for (Integer id : list) {
        pause(id);
    }
}
 
开发者ID:angcyo,项目名称:RLibrary,代码行数:14,代码来源:FileDownloadManager.java

示例13: asyncPublishInNewThread

@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:yannanzheng,项目名称:FileDownloader-master,代码行数:14,代码来源:DownloadEventPoolImpl.java

示例14: notifyPaused

@Override
public void notifyPaused(MessageSnapshot snapshot) {
    if (FileDownloadLog.NEED_LOG) {
        FileDownloadLog.d(this, "notify paused %s", mTask);
    }

    mLifeCycleCallback.onOver();

    process(snapshot);
}
 
开发者ID:angcyo,项目名称:RLibrary,代码行数:10,代码来源:FileDownloadMessenger.java

示例15: bindStartByContext

@Override
public void bindStartByContext(final Context context, final Runnable connectedRunnable) {
    if (FileDownloadUtils.isDownloaderProcess(context)) {
        throw new IllegalStateException("Fatal-Exception: You can't bind the " +
                "FileDownloadService in :filedownloader process.\n It's the invalid operation, " +
                "and is likely to cause unexpected problems.\n Maybe you want to use" +
                " non-separate process mode for FileDownloader, More detail about " +
                "non-separate mode, please move to wiki manually:" +
                " https://github.com/lingochamp/FileDownloader/wiki/filedownloader.properties");
    }

    if (FileDownloadLog.NEED_LOG) {
        FileDownloadLog.d(this, "bindStartByContext %s", context.getClass().getSimpleName());
    }

    Intent i = new Intent(context, serviceClass);
    if (connectedRunnable != null) {
        if (!connectedRunnableList.contains(connectedRunnable)) {
            connectedRunnableList.add(connectedRunnable);
        }
    }

    if (!BIND_CONTEXTS.contains(context)) {
        // 对称,只有一次remove,防止内存泄漏
        BIND_CONTEXTS.add(context);
    }

    context.bindService(i, this, Context.BIND_AUTO_CREATE);
    context.startService(i);
}
 
开发者ID:angcyo,项目名称:RLibrary,代码行数:30,代码来源:BaseFileServiceUIGuard.java


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