parent
ad136576dc
commit
4e305dcf01
@ -1,269 +1,205 @@ |
|||||||
///*
|
/* |
||||||
// * Copyright (C) 2016 AriaLyy(https://github.com/AriaLyy/Aria)
|
* Copyright (C) 2016 AriaLyy(https://github.com/AriaLyy/Aria)
|
||||||
// *
|
* |
||||||
// * Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License"); |
||||||
// * you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License. |
||||||
// * You may obtain a copy of the License at
|
* You may obtain a copy of the License at |
||||||
// *
|
* |
||||||
// * http://www.apache.org/licenses/LICENSE-2.0
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
// *
|
* |
||||||
// * Unless required by applicable law or agreed to in writing, software
|
* Unless required by applicable law or agreed to in writing, software |
||||||
// * distributed under the License is distributed on an "AS IS" BASIS,
|
* distributed under the License is distributed on an "AS IS" BASIS, |
||||||
// * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
||||||
// * See the License for the specific language governing permissions and
|
* See the License for the specific language governing permissions and |
||||||
// * limitations under the License.
|
* limitations under the License. |
||||||
// */
|
*/ |
||||||
//package com.arialyy.aria.core.download;
|
package com.arialyy.aria.core.download; |
||||||
//
|
|
||||||
//import android.content.Context;
|
import android.content.Context; |
||||||
//import android.os.Handler;
|
import android.os.Handler; |
||||||
//import android.util.SparseArray;
|
import com.arialyy.aria.core.AriaManager; |
||||||
//import com.arialyy.aria.core.Aria;
|
import com.arialyy.aria.core.download.downloader.DownloadGroupUtil; |
||||||
//import com.arialyy.aria.core.AriaManager;
|
import com.arialyy.aria.core.download.downloader.DownloadListener; |
||||||
//import com.arialyy.aria.core.download.downloader.DownloadListener;
|
import com.arialyy.aria.core.download.downloader.IDownloadUtil; |
||||||
//import com.arialyy.aria.core.download.downloader.DownloadUtil;
|
import com.arialyy.aria.core.inf.AbsGroupTask; |
||||||
//import com.arialyy.aria.core.inf.AbsGroupTask;
|
import com.arialyy.aria.core.inf.IEntity; |
||||||
//import com.arialyy.aria.core.inf.IEntity;
|
import com.arialyy.aria.core.scheduler.DownloadSchedulers; |
||||||
//import com.arialyy.aria.core.scheduler.DownloadSchedulers;
|
import com.arialyy.aria.core.scheduler.ISchedulers; |
||||||
//import com.arialyy.aria.core.scheduler.ISchedulers;
|
import com.arialyy.aria.util.CheckUtil; |
||||||
//import com.arialyy.aria.util.CheckUtil;
|
import com.arialyy.aria.util.CommonUtil; |
||||||
//import com.arialyy.aria.util.CommonUtil;
|
import java.lang.ref.WeakReference; |
||||||
//import java.lang.ref.WeakReference;
|
|
||||||
//import java.util.HashMap;
|
/** |
||||||
//import java.util.List;
|
* Created by AriaL on 2017/6/27. |
||||||
//import java.util.Map;
|
* 任务组任务 |
||||||
//import java.util.concurrent.ExecutorService;
|
*/ |
||||||
//import java.util.concurrent.Executors;
|
public class DownloadGroupTask extends AbsGroupTask<DownloadGroupTaskEntity, DownloadGroupEntity> { |
||||||
//
|
private DListener mListener; |
||||||
///**
|
private IDownloadUtil mUtil; |
||||||
// * Created by AriaL on 2017/6/27.
|
|
||||||
// * 任务组任务
|
private DownloadGroupTask(DownloadGroupTaskEntity taskEntity, Handler outHandler) { |
||||||
// */
|
mTaskEntity = taskEntity; |
||||||
//public class DownloadGroupTask extends AbsGroupTask<DownloadTaskEntity, DownloadGroupEntity> {
|
mEntity = taskEntity.getEntity(); |
||||||
// DListener mListener;
|
mOutHandler = outHandler; |
||||||
// SparseArray<DownloadUtil> mUtils = new SparseArray<>();
|
mContext = AriaManager.APP; |
||||||
// boolean isStop = false;
|
mListener = new DListener(mContext, this, mOutHandler); |
||||||
//
|
mUtil = new DownloadGroupUtil(mListener, mTaskEntity); |
||||||
// private ExecutorService mFixedThreadPool;
|
} |
||||||
//
|
|
||||||
// private DownloadGroupTask(DownloadTaskEntity taskEntity, Handler outHandler) {
|
@Override public boolean isRunning() { |
||||||
// mTaskEntity = taskEntity;
|
return mUtil.isDownloading(); |
||||||
// mEntity = taskEntity.groupEntity;
|
} |
||||||
// mOutHandler = outHandler;
|
|
||||||
// mContext = AriaManager.APP;
|
@Override public void start() { |
||||||
// mListener = new DListener(mContext, this, mOutHandler);
|
mUtil.stopDownload(); |
||||||
// mFixedThreadPool = Executors.newFixedThreadPool(Runtime.getRuntime().availableProcessors());
|
} |
||||||
// }
|
|
||||||
//
|
@Override public void stop() { |
||||||
// @Override public void start() {
|
mUtil.startDownload(); |
||||||
// List<DownloadEntity> childs = mEntity.getChild();
|
} |
||||||
// int i = 1;
|
|
||||||
// mListener.sendInState2Target(ISchedulers.PRE);
|
@Override public void cancel() { |
||||||
// for (DownloadEntity entity : childs) {
|
mUtil.cancelDownload(); |
||||||
// DownloadUtil util = createChildDownload(entity);
|
} |
||||||
// if (isStop) break;
|
|
||||||
// mUtils.append(i, util);
|
/** |
||||||
// mFixedThreadPool.execute(util);
|
* 下载监听类 |
||||||
// i++;
|
*/ |
||||||
// }
|
private static class DListener extends DownloadListener { |
||||||
// }
|
WeakReference<Handler> outHandler; |
||||||
//
|
WeakReference<DownloadGroupTask> wTask; |
||||||
// /**
|
Context context; |
||||||
// * 创建任务组单个任务下载工具
|
long lastLen = 0; //上一次发送长度
|
||||||
// */
|
boolean isFirst = true; |
||||||
// private DownloadUtil createChildDownload(DownloadEntity entity) {
|
DownloadGroupEntity entity; |
||||||
// DownloadTaskEntity taskEntity = new DownloadTaskEntity(entity);
|
DownloadGroupTask task; |
||||||
// taskEntity.headers = mTaskEntity.headers;
|
boolean isConvertSpeed = false; |
||||||
// taskEntity.requestEnum = mTaskEntity.requestEnum;
|
|
||||||
// taskEntity.redirectUrlKey = mTaskEntity.redirectUrlKey;
|
DListener(Context context, DownloadGroupTask task, Handler outHandler) { |
||||||
// taskEntity.removeFile = mTaskEntity.removeFile;
|
this.context = context; |
||||||
// return new DownloadUtil(mContext, taskEntity, mListener);
|
this.outHandler = new WeakReference<>(outHandler); |
||||||
// }
|
this.wTask = new WeakReference<>(task); |
||||||
//
|
this.task = wTask.get(); |
||||||
// @Override public void stop() {
|
this.entity = this.task.getEntity(); |
||||||
// isStop = true;
|
final AriaManager manager = AriaManager.getInstance(context); |
||||||
// if (mFixedThreadPool != null) {
|
isConvertSpeed = manager.getDownloadConfig().isConvertSpeed(); |
||||||
// mFixedThreadPool.shutdown();
|
} |
||||||
// }
|
|
||||||
// for (int i = 1, len = mUtils.size(); i <= len; i++) {
|
@Override public void onPre() { |
||||||
// DownloadUtil util = mUtils.get(i);
|
saveData(IEntity.STATE_PRE, -1); |
||||||
// if (util != null && util.isDownloading()) {
|
sendInState2Target(ISchedulers.PRE); |
||||||
// util.stopDownload();
|
} |
||||||
// }
|
|
||||||
// }
|
@Override public void onPostPre(long fileSize) { |
||||||
// }
|
entity.setFileSize(fileSize); |
||||||
//
|
saveData(IEntity.STATE_POST_PRE, -1); |
||||||
// @Override public void cancel() {
|
sendInState2Target(ISchedulers.POST_PRE); |
||||||
// isStop = true;
|
} |
||||||
// if (mFixedThreadPool != null) {
|
|
||||||
// mFixedThreadPool.shutdown();
|
@Override public void onStart(long startLocation) { |
||||||
// }
|
saveData(IEntity.STATE_RUNNING, startLocation); |
||||||
// for (int i = 1, len = mUtils.size(); i <= len; i++) {
|
sendInState2Target(ISchedulers.START); |
||||||
// DownloadUtil util = mUtils.get(i);
|
} |
||||||
// if (util != null) {
|
|
||||||
// util.cancelDownload();
|
@Override public void onResume(long resumeLocation) { |
||||||
// }
|
saveData(IEntity.STATE_RUNNING, resumeLocation); |
||||||
// }
|
sendInState2Target(ISchedulers.RESUME); |
||||||
// }
|
} |
||||||
//
|
|
||||||
// /**
|
@Override public void onProgress(long currentLocation) { |
||||||
// * 下载监听类
|
long speed = currentLocation - lastLen; |
||||||
// */
|
if (isFirst) { |
||||||
// private static class DListener extends DownloadListener {
|
speed = 0; |
||||||
// WeakReference<Handler> outHandler;
|
isFirst = false; |
||||||
// WeakReference<DownloadGroupTask> wTask;
|
} |
||||||
// Context context;
|
handleSpeed(speed); |
||||||
// long lastLen = 0; //上一次发送长度
|
lastLen = currentLocation; |
||||||
// long lastTime = 0;
|
sendInState2Target(ISchedulers.RUNNING); |
||||||
// long INTERVAL_TIME = 1000; //1m更新周期
|
} |
||||||
// boolean isFirst = true;
|
|
||||||
// DownloadGroupEntity groupEntity;
|
@Override public void onStop(long stopLocation) { |
||||||
// DownloadGroupTask task;
|
saveData(IEntity.STATE_STOP, stopLocation); |
||||||
// boolean isConvertSpeed = false;
|
handleSpeed(0); |
||||||
// Map<String, DownloadEntity> mEntityMap = new HashMap<>();
|
sendInState2Target(ISchedulers.STOP); |
||||||
//
|
} |
||||||
// DListener(Context context, DownloadGroupTask task, Handler outHandler) {
|
|
||||||
// this.context = context;
|
@Override public void onCancel() { |
||||||
// this.outHandler = new WeakReference<>(outHandler);
|
saveData(IEntity.STATE_CANCEL, -1); |
||||||
// this.wTask = new WeakReference<>(task);
|
handleSpeed(0); |
||||||
// this.task = wTask.get();
|
sendInState2Target(ISchedulers.CANCEL); |
||||||
// this.groupEntity = this.task.getEntity();
|
} |
||||||
// final AriaManager manager = AriaManager.getInstance(context);
|
|
||||||
// isConvertSpeed = manager.getDownloadConfig().isConvertSpeed();
|
@Override public void onComplete() { |
||||||
// for (DownloadEntity entity : groupEntity.getChild()) {
|
saveData(IEntity.STATE_COMPLETE, entity.getFileSize()); |
||||||
// mEntityMap.put(entity.getDownloadUrl(), entity);
|
handleSpeed(0); |
||||||
// }
|
sendInState2Target(ISchedulers.COMPLETE); |
||||||
// }
|
} |
||||||
//
|
|
||||||
// @Override public void onPre(String url) {
|
@Override public void onFail() { |
||||||
// saveData(url, IEntity.STATE_PRE, -1);
|
entity.setFailNum(entity.getFailNum() + 1); |
||||||
// }
|
saveData(IEntity.STATE_FAIL, -1); |
||||||
//
|
handleSpeed(0); |
||||||
// @Override public void onPostPre(String url, long fileSize) {
|
sendInState2Target(ISchedulers.FAIL); |
||||||
// DownloadEntity entity = mEntityMap.get(url);
|
} |
||||||
// if (entity != null){
|
|
||||||
// entity.setFileSize(fileSize);
|
private void handleSpeed(long speed) { |
||||||
// }
|
if (isConvertSpeed) { |
||||||
// saveData(url, IEntity.STATE_POST_PRE, -1);
|
entity.setConvertSpeed(CommonUtil.formatFileSize(speed) + "/s"); |
||||||
// }
|
} else { |
||||||
//
|
entity.setSpeed(speed); |
||||||
// @Override public void onStart(String url, long startLocation) {
|
} |
||||||
// downloadEntity.setState(IEntity.STATE_RUNNING);
|
} |
||||||
// sendInState2Target(ISchedulers.START);
|
|
||||||
// sendIntent(Aria.ACTION_START, startLocation);
|
/** |
||||||
// }
|
* 将任务状态发送给下载器 |
||||||
//
|
* |
||||||
// @Override public void onResume(String url, long resumeLocation) {
|
* @param state {@link DownloadSchedulers#START} |
||||||
// downloadEntity.setState(IEntity.STATE_RUNNING);
|
*/ |
||||||
// sendInState2Target(ISchedulers.RESUME);
|
private void sendInState2Target(int state) { |
||||||
// sendIntent(Aria.ACTION_RESUME, resumeLocation);
|
if (outHandler.get() != null) { |
||||||
// }
|
outHandler.get().obtainMessage(state, task).sendToTarget(); |
||||||
//
|
} |
||||||
// @Override public void onProgress(String url, long currentLocation) {
|
} |
||||||
// if (System.currentTimeMillis() - lastTime > INTERVAL_TIME) {
|
|
||||||
// long speed = currentLocation - lastLen;
|
private void saveData(int state, long location) { |
||||||
// sendIntent.putExtra(Aria.CURRENT_LOCATION, currentLocation);
|
if (state == IEntity.STATE_CANCEL) { |
||||||
// sendIntent.putExtra(Aria.CURRENT_SPEED, speed);
|
entity.deleteData(); |
||||||
// lastTime = System.currentTimeMillis();
|
} else { |
||||||
// if (isFirst) {
|
entity.setState(state); |
||||||
// speed = 0;
|
if (location != -1) { |
||||||
// isFirst = false;
|
entity.setCurrentProgress(location); |
||||||
// }
|
} |
||||||
// handleSpeed(speed);
|
entity.update(); |
||||||
// downloadEntity.setCurrentProgress(currentLocation);
|
} |
||||||
// lastLen = currentLocation;
|
} |
||||||
// sendInState2Target(ISchedulers.RUNNING);
|
} |
||||||
// context.sendBroadcast(sendIntent);
|
|
||||||
// }
|
public static class Builder { |
||||||
// }
|
DownloadGroupTaskEntity taskEntity; |
||||||
//
|
Handler outHandler; |
||||||
// @Override public void onStop(String url, long stopLocation) {
|
String targetName; |
||||||
// downloadEntity.setState(task.isWait ? IEntity.STATE_WAIT : IEntity.STATE_STOP);
|
|
||||||
// handleSpeed(0);
|
public Builder(String targetName, DownloadGroupTaskEntity taskEntity) { |
||||||
// sendInState2Target(ISchedulers.STOP);
|
CheckUtil.checkTaskEntity(taskEntity); |
||||||
// sendIntent(Aria.ACTION_STOP, stopLocation);
|
this.targetName = targetName; |
||||||
// }
|
this.taskEntity = taskEntity; |
||||||
//
|
} |
||||||
// @Override public void onCancel(String url) {
|
|
||||||
// downloadEntity.setState(IEntity.STATE_CANCEL);
|
/** |
||||||
// handleSpeed(0);
|
* 设置自定义Handler处理下载状态时间 |
||||||
// sendInState2Target(ISchedulers.CANCEL);
|
* |
||||||
// sendIntent(Aria.ACTION_CANCEL, -1);
|
* @param schedulers {@link ISchedulers} |
||||||
// downloadEntity.deleteData();
|
*/ |
||||||
// }
|
public DownloadGroupTask.Builder setOutHandler(ISchedulers schedulers) { |
||||||
//
|
this.outHandler = new Handler(schedulers); |
||||||
// @Override public void onComplete(String url) {
|
return this; |
||||||
// downloadEntity.setState(IEntity.STATE_COMPLETE);
|
} |
||||||
// downloadEntity.setDownloadComplete(true);
|
|
||||||
// handleSpeed(0);
|
public DownloadGroupTask build() { |
||||||
// sendInState2Target(ISchedulers.COMPLETE);
|
DownloadGroupTask task = new DownloadGroupTask(taskEntity, outHandler); |
||||||
// sendIntent(Aria.ACTION_COMPLETE, downloadEntity.getFileSize());
|
task.setTargetName(targetName); |
||||||
// }
|
taskEntity.save(); |
||||||
//
|
return task; |
||||||
// @Override public void onFail(String url) {
|
} |
||||||
// downloadEntity.setFailNum(downloadEntity.getFailNum() + 1);
|
} |
||||||
// downloadEntity.setState(IEntity.STATE_FAIL);
|
} |
||||||
// handleSpeed(0);
|
|
||||||
// sendInState2Target(ISchedulers.FAIL);
|
|
||||||
// sendIntent(Aria.ACTION_FAIL, -1);
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// private void handleSpeed(long speed) {
|
|
||||||
// if (isConvertSpeed) {
|
|
||||||
// downloadEntity.setConvertSpeed(CommonUtil.formatFileSize(speed) + "/s");
|
|
||||||
// } else {
|
|
||||||
// downloadEntity.setSpeed(speed);
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// /**
|
|
||||||
// * 将任务状态发送给下载器
|
|
||||||
// *
|
|
||||||
// * @param state {@link DownloadSchedulers#START}
|
|
||||||
// */
|
|
||||||
// private void sendInState2Target(int state) {
|
|
||||||
// if (outHandler.get() != null) {
|
|
||||||
// outHandler.get().obtainMessage(state, task).sendToTarget();
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// private void saveData(String url, int state, long location) {
|
|
||||||
// DownloadEntity child = mEntityMap.get(url);
|
|
||||||
// if (child != null) {
|
|
||||||
// child.setState(state);
|
|
||||||
// child.setDownloadComplete(state == IEntity.STATE_COMPLETE);
|
|
||||||
// child.setCurrentProgress(location);
|
|
||||||
// child.update();
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// public static class Builder {
|
|
||||||
// DownloadTaskEntity taskEntity;
|
|
||||||
// Handler outHandler;
|
|
||||||
// String targetName;
|
|
||||||
//
|
|
||||||
// public Builder(String targetName, DownloadTaskEntity taskEntity) {
|
|
||||||
// CheckUtil.checkTaskEntity(taskEntity);
|
|
||||||
// this.targetName = targetName;
|
|
||||||
// this.taskEntity = taskEntity;
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// /**
|
|
||||||
// * 设置自定义Handler处理下载状态时间
|
|
||||||
// *
|
|
||||||
// * @param schedulers {@link ISchedulers}
|
|
||||||
// */
|
|
||||||
// public DownloadGroupTask.Builder setOutHandler(ISchedulers schedulers) {
|
|
||||||
// this.outHandler = new Handler(schedulers);
|
|
||||||
// return this;
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// public DownloadGroupTask build() {
|
|
||||||
// DownloadGroupTask task = new DownloadGroupTask(taskEntity, outHandler);
|
|
||||||
// task.setTargetName(targetName);
|
|
||||||
// taskEntity.downloadEntity.save();
|
|
||||||
// return task;
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
//}
|
|
||||||
|
@ -0,0 +1,82 @@ |
|||||||
|
/* |
||||||
|
* Copyright (C) 2016 AriaLyy(https://github.com/AriaLyy/Aria)
|
||||||
|
* |
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License"); |
||||||
|
* you may not use this file except in compliance with the License. |
||||||
|
* You may obtain a copy of the License at |
||||||
|
* |
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
* |
||||||
|
* Unless required by applicable law or agreed to in writing, software |
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS, |
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
||||||
|
* See the License for the specific language governing permissions and |
||||||
|
* limitations under the License. |
||||||
|
*/ |
||||||
|
package com.arialyy.aria.core.queue.pool; |
||||||
|
|
||||||
|
import android.util.Log; |
||||||
|
import com.arialyy.aria.core.AriaManager; |
||||||
|
import com.arialyy.aria.core.download.DownloadTask; |
||||||
|
import com.arialyy.aria.util.CommonUtil; |
||||||
|
import java.util.Set; |
||||||
|
import java.util.concurrent.TimeUnit; |
||||||
|
|
||||||
|
/** |
||||||
|
* Created by AriaL on 2017/6/29. |
||||||
|
* 单个下载任务的执行池 |
||||||
|
*/ |
||||||
|
public class DownloadExecutePool extends BaseExecutePool<DownloadTask> { |
||||||
|
private final String TAG = "DownloadExecutePool"; |
||||||
|
|
||||||
|
public DownloadExecutePool(boolean isDownload) { |
||||||
|
super(isDownload); |
||||||
|
} |
||||||
|
|
||||||
|
@Override public boolean putTask(DownloadTask task) { |
||||||
|
synchronized (AriaManager.LOCK) { |
||||||
|
if (task == null) { |
||||||
|
Log.e(TAG, "任务不能为空!!"); |
||||||
|
return false; |
||||||
|
} |
||||||
|
String url = task.getKey(); |
||||||
|
if (mExecuteQueue.contains(task)) { |
||||||
|
Log.e(TAG, "队列中已经包含了该任务,任务key【" + url + "】"); |
||||||
|
return false; |
||||||
|
} else { |
||||||
|
if (mExecuteQueue.size() >= mSize) { |
||||||
|
Set<String> keys = mExecuteMap.keySet(); |
||||||
|
for (String key : keys) { |
||||||
|
if (mExecuteMap.get(key).isHighestPriorityTask()) return false; |
||||||
|
} |
||||||
|
if (pollFirstTask()) { |
||||||
|
return putNewTask(task); |
||||||
|
} |
||||||
|
} else { |
||||||
|
return putNewTask(task); |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
return false; |
||||||
|
} |
||||||
|
|
||||||
|
@Override boolean pollFirstTask() { |
||||||
|
try { |
||||||
|
DownloadTask oldTask = mExecuteQueue.poll(TIME_OUT, TimeUnit.MICROSECONDS); |
||||||
|
if (oldTask == null) { |
||||||
|
Log.e(TAG, "移除任务失败"); |
||||||
|
return false; |
||||||
|
} |
||||||
|
if (oldTask.isHighestPriorityTask()) { |
||||||
|
return false; |
||||||
|
} |
||||||
|
oldTask.stop(); |
||||||
|
String key = CommonUtil.keyToHashKey(oldTask.getKey()); |
||||||
|
mExecuteMap.remove(key); |
||||||
|
} catch (InterruptedException e) { |
||||||
|
e.printStackTrace(); |
||||||
|
return false; |
||||||
|
} |
||||||
|
return true; |
||||||
|
} |
||||||
|
} |
@ -1,23 +0,0 @@ |
|||||||
/* |
|
||||||
* Copyright (C) 2016 AriaLyy(https://github.com/AriaLyy/Aria)
|
|
||||||
* |
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License"); |
|
||||||
* you may not use this file except in compliance with the License. |
|
||||||
* You may obtain a copy of the License at |
|
||||||
* |
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
* |
|
||||||
* Unless required by applicable law or agreed to in writing, software |
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS, |
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
|
||||||
* See the License for the specific language governing permissions and |
|
||||||
* limitations under the License. |
|
||||||
*/ |
|
||||||
package com.arialyy.aria.core.queue.pool; |
|
||||||
|
|
||||||
/** |
|
||||||
* Created by AriaL on 2017/6/29. |
|
||||||
* 任务组缓冲池 |
|
||||||
*/ |
|
||||||
public class GroupCachePool { |
|
||||||
} |
|
@ -1,23 +0,0 @@ |
|||||||
/* |
|
||||||
* Copyright (C) 2016 AriaLyy(https://github.com/AriaLyy/Aria)
|
|
||||||
* |
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License"); |
|
||||||
* you may not use this file except in compliance with the License. |
|
||||||
* You may obtain a copy of the License at |
|
||||||
* |
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
* |
|
||||||
* Unless required by applicable law or agreed to in writing, software |
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS, |
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
|
||||||
* See the License for the specific language governing permissions and |
|
||||||
* limitations under the License. |
|
||||||
*/ |
|
||||||
package com.arialyy.aria.core.queue.pool; |
|
||||||
|
|
||||||
/** |
|
||||||
* Created by AriaL on 2017/6/29. |
|
||||||
*/ |
|
||||||
|
|
||||||
public class GroupExecutePool { |
|
||||||
} |
|
@ -0,0 +1,45 @@ |
|||||||
|
/* |
||||||
|
* Copyright (C) 2016 AriaLyy(https://github.com/AriaLyy/Aria)
|
||||||
|
* |
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License"); |
||||||
|
* you may not use this file except in compliance with the License. |
||||||
|
* You may obtain a copy of the License at |
||||||
|
* |
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
* |
||||||
|
* Unless required by applicable law or agreed to in writing, software |
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS, |
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
||||||
|
* See the License for the specific language governing permissions and |
||||||
|
* limitations under the License. |
||||||
|
*/ |
||||||
|
package com.arialyy.aria.core.scheduler; |
||||||
|
|
||||||
|
import com.arialyy.aria.core.AriaManager; |
||||||
|
import com.arialyy.aria.core.download.DownloadGroupEntity; |
||||||
|
import com.arialyy.aria.core.download.DownloadGroupTask; |
||||||
|
import com.arialyy.aria.core.download.DownloadGroupTaskEntity; |
||||||
|
import com.arialyy.aria.core.queue.DownloadGroupTaskQueue; |
||||||
|
|
||||||
|
/** |
||||||
|
* Created by AriaL on 2017/7/2. |
||||||
|
*/ |
||||||
|
public class DownloadGroupSchedulers extends |
||||||
|
AbsSchedulers<DownloadGroupTaskEntity, DownloadGroupEntity, DownloadGroupTask, DownloadGroupTaskQueue> { |
||||||
|
private final String TAG = "DownloadGroupSchedulers"; |
||||||
|
private static volatile DownloadGroupSchedulers INSTANCE = null; |
||||||
|
|
||||||
|
private DownloadGroupSchedulers() { |
||||||
|
mQueue = DownloadGroupTaskQueue.getInstance(); |
||||||
|
isDownload = true; |
||||||
|
} |
||||||
|
|
||||||
|
public static DownloadGroupSchedulers getInstance() { |
||||||
|
if (INSTANCE == null) { |
||||||
|
synchronized (AriaManager.LOCK) { |
||||||
|
INSTANCE = new DownloadGroupSchedulers(); |
||||||
|
} |
||||||
|
} |
||||||
|
return INSTANCE; |
||||||
|
} |
||||||
|
} |
Loading…
Reference in new issue