-
Notifications
You must be signed in to change notification settings - Fork 106
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
-extends Queue -allows peek/executeQueuedAction PackageController/PackageControllerTable/SelectionInfo: -updated to make use of ReadOnlyQueueAction LinkCollector/DownloadController: -updated save to make use of new PackageControllerQueue.peek and PackageControllerQueue.executeQueuedAction methods refs thread 96430 git-svn-id: svn://svn.jdownloader.org/jdownloader/trunk@49880 ebf7c1c2-ba36-0410-9fe8-c592906822b4 Former-commit-id: 2074a51dd9aed84af6ed31fb194060c5f0901079
- Loading branch information
jiaz
committed
Sep 27, 2024
1 parent
24958d3
commit d47e9aa
Showing
5 changed files
with
112 additions
and
45 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
73 changes: 73 additions & 0 deletions
73
src/jd/controlling/packagecontroller/PackageControllerQueue.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
package jd.controlling.packagecontroller; | ||
|
||
import javax.swing.SwingUtilities; | ||
|
||
import org.appwork.utils.DebugMode; | ||
import org.appwork.utils.event.queue.Queue; | ||
import org.appwork.utils.event.queue.QueueAction; | ||
import org.appwork.utils.logging2.LogInterface; | ||
|
||
public class PackageControllerQueue extends Queue { | ||
|
||
public static abstract class ReadOnlyQueueAction<T, E extends Throwable> extends QueueAction<T, E> { | ||
|
||
public ReadOnlyQueueAction() { | ||
super(); | ||
} | ||
|
||
public ReadOnlyQueueAction(QueuePriority prio) { | ||
super(prio); | ||
} | ||
} | ||
|
||
protected PackageControllerQueue(String id) { | ||
super(id); | ||
} | ||
|
||
@Override | ||
public void killQueue() { | ||
getLogger().log(new Throwable("YOU CANNOT KILL ME!")); | ||
/* | ||
* this queue can't be killed | ||
*/ | ||
} | ||
|
||
public <E, T extends Throwable> E addWait(QueueAction<E, T> item) throws T { | ||
if (DebugMode.TRUE_IN_IDE_ELSE_FALSE && SwingUtilities.isEventDispatchThread()) { | ||
getLogger().log(new Exception("This should be done via callback to avoid queue<->edt deadlocks")); | ||
} | ||
return super.addWait(item); | ||
}; | ||
|
||
@Override | ||
public QueueAction<?, ? extends Throwable> peek() { | ||
if (!DebugMode.TRUE_IN_IDE_ELSE_FALSE) { | ||
return null; | ||
} | ||
try { | ||
return super.peek(); | ||
} catch (Throwable e) { | ||
// compatibility with incompatible core | ||
return null; | ||
} | ||
} | ||
|
||
public boolean executeQueuedAction(final QueueAction<?, ?> item) { | ||
if (item != null && !item.gotStarted() && isQueueThread(item) && isQueued(item)) { | ||
try { | ||
super.startItem(item, true); | ||
} catch (Throwable e) { | ||
getLogger().log(e); | ||
} | ||
remove(item); | ||
return true; | ||
} else { | ||
return false; | ||
} | ||
} | ||
|
||
protected LogInterface getLogger() { | ||
return org.appwork.utils.logging2.extmanager.LoggerFactory.getDefaultLogger(); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters