From 3436649e7d5c7398ee57d9b47ece9adf1d728f72 Mon Sep 17 00:00:00 2001 From: jiaz Date: Wed, 12 Nov 2014 08:12:58 +0000 Subject: [PATCH] reviewed dashboardapi git-svn-id: svn://svn.jdownloader.org/jdownloader/trunk@27894 ebf7c1c2-ba36-0410-9fe8-c592906822b4 Former-commit-id: 5a3cd10d789ec40761ca5650e971eb76502b57ea --- .classpath | 206 +++++++++--------- .../api/jdanywhere/api/DashboardApi.java | 34 +-- 2 files changed, 122 insertions(+), 118 deletions(-) diff --git a/.classpath b/.classpath index 6bb97a7802..0bec191742 100644 --- a/.classpath +++ b/.classpath @@ -1,103 +1,103 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/org/jdownloader/api/jdanywhere/api/DashboardApi.java b/src/org/jdownloader/api/jdanywhere/api/DashboardApi.java index 1a7f253a61..3dc9fbcca0 100644 --- a/src/org/jdownloader/api/jdanywhere/api/DashboardApi.java +++ b/src/org/jdownloader/api/jdanywhere/api/DashboardApi.java @@ -49,15 +49,19 @@ public class DashboardApi implements IDashboardApi { timer.scheduleAtFixedRate(new TimerTask() { @Override public void run() { - _speedList.addLast(DownloadWatchDog.getInstance().getDownloadSpeedManager().getSpeed()); - _speedList.removeFirst(); + final int speed = DownloadWatchDog.getInstance().getDownloadSpeedManager().getSpeed(); + synchronized (_speedList) { + _speedList.addLast(speed); + _speedList.removeFirst(); + } } }, 3 * 1000, 3 * 1000); } public List speedList() { - return new ArrayList(_speedList); - + synchronized (_speedList) { + return new ArrayList(_speedList); + } } public String apiVersion() { @@ -66,7 +70,7 @@ public class DashboardApi implements IDashboardApi { /* * (non-Javadoc) - * + * * @see org.jdownloader.extensions.jdanywhere.api.IDashboardApi#start() */ @Override @@ -77,7 +81,7 @@ public class DashboardApi implements IDashboardApi { /* * (non-Javadoc) - * + * * @see org.jdownloader.extensions.jdanywhere.api.IDashboardApi#stop() */ @Override @@ -88,7 +92,7 @@ public class DashboardApi implements IDashboardApi { /* * (non-Javadoc) - * + * * @see org.jdownloader.extensions.jdanywhere.api.IDashboardApi#pause(java.lang .Boolean) */ @Override @@ -102,7 +106,7 @@ public class DashboardApi implements IDashboardApi { // running = 0 /* * (non-Javadoc) - * + * * @see org.jdownloader.extensions.jdanywhere.api.IDashboardApi#getState() */ @Override @@ -180,7 +184,7 @@ public class DashboardApi implements IDashboardApi { // used in iPhone-App /* * (non-Javadoc) - * + * * @see org.jdownloader.extensions.jdanywhere.api.IDashboardApi#speed() */ @Override @@ -192,7 +196,7 @@ public class DashboardApi implements IDashboardApi { // used in iPhone-App /* * (non-Javadoc) - * + * * @see org.jdownloader.extensions.jdanywhere.api.IDashboardApi#limit() */ @Override @@ -204,7 +208,7 @@ public class DashboardApi implements IDashboardApi { // used in iPhone-App /* * (non-Javadoc) - * + * * @see org.jdownloader.extensions.jdanywhere.api.IDashboardApi#traffic() */ @Override @@ -214,7 +218,7 @@ public class DashboardApi implements IDashboardApi { /* * (non-Javadoc) - * + * * @see org.jdownloader.extensions.jdanywhere.api.IDashboardApi#setLimitspeed (int) */ @Override @@ -225,7 +229,7 @@ public class DashboardApi implements IDashboardApi { /* * (non-Javadoc) - * + * * @see org.jdownloader.extensions.jdanywhere.api.IDashboardApi#activateLimitspeed (boolean) */ @Override @@ -239,7 +243,7 @@ public class DashboardApi implements IDashboardApi { // used in iPhone-App /* * (non-Javadoc) - * + * * @see org.jdownloader.extensions.jdanywhere.api.IDashboardApi#speedMeter(org .appwork.remoteapi.RemoteAPIRequest, * org.appwork.remoteapi.RemoteAPIResponse) */ @@ -277,7 +281,7 @@ public class DashboardApi implements IDashboardApi { /* * (non-Javadoc) - * + * * @see org.jdownloader.extensions.jdanywhere.api.IDashboardApi#runningLinks() */ @Override