Package com.biglybt.core.history.impl
Class DownloadHistoryManagerImpl
- java.lang.Object
-
- com.biglybt.core.history.impl.DownloadHistoryManagerImpl
-
- All Implemented Interfaces:
DownloadHistoryManager
public class DownloadHistoryManagerImpl extends java.lang.Object implements DownloadHistoryManager
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private static class
DownloadHistoryManagerImpl.DownloadHistoryEventImpl
private class
DownloadHistoryManagerImpl.DownloadHistoryImpl
-
Field Summary
Fields Modifier and Type Field Description private java.util.Map<java.lang.Long,DownloadHistoryManagerImpl.DownloadHistoryImpl>
active_dirty
(package private) int
active_history_size
private long
active_load_time
private static java.lang.String
CONFIG_ACTIVE_FILE
private static java.lang.String
CONFIG_ACTIVE_SIZE
private static java.lang.String
CONFIG_DEAD_FILE
private static java.lang.String
CONFIG_DEAD_SIZE
private static java.lang.String
CONFIG_ENABLED
private Core
core
private java.util.Map<java.lang.Long,DownloadHistoryManagerImpl.DownloadHistoryImpl>
dead_dirty
(package private) int
dead_history_size
private long
dead_load_time
(package private) boolean
enabled
private java.lang.ref.WeakReference<java.util.Map<java.lang.Long,DownloadHistoryManagerImpl.DownloadHistoryImpl>>
history_active
private java.lang.ref.WeakReference<java.util.Map<java.lang.Long,DownloadHistoryManagerImpl.DownloadHistoryImpl>>
history_dead
private boolean
history_escaped
private ListenerManager<DownloadHistoryListener>
listeners
(package private) java.lang.Object
lock
private static java.lang.String[]
NO_TAGS
private java.util.Map<java.lang.Long,java.lang.Long>
redownload_cache
private static java.lang.Object
TAG_CACHE_KEY
private static TagManager
tag_manager
private static int
UPDATE_TYPE_ACTIVE
private static int
UPDATE_TYPE_BOTH
private static int
UPDATE_TYPE_DEAD
(package private) TimerEvent
write_pending_event
-
Constructor Summary
Constructors Constructor Description DownloadHistoryManagerImpl()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addListener(DownloadHistoryListener listener, boolean fire_for_existing)
(package private) void
checkDiscard()
private void
clearHistory()
(package private) java.util.Map<java.lang.Long,DownloadHistoryManagerImpl.DownloadHistoryImpl>
getActiveHistory()
long[]
getDates(byte[] hash)
(package private) java.util.Map<java.lang.Long,DownloadHistoryManagerImpl.DownloadHistoryImpl>
getDeadHistory()
private java.util.List<DownloadHistory>
getHistory()
int
getHistoryCount()
(package private) static long
getUID(DownloadManager dm)
(package private) void
historyUpdated(DownloadHistory dh, int action, int type)
private void
historyUpdated(java.util.Collection<DownloadHistory> list, int action, int type)
boolean
isEnabled()
(package private) boolean
isMonitored(DownloadManager dm)
private java.util.Map<java.lang.Long,DownloadHistoryManagerImpl.DownloadHistoryImpl>
loadHistory(java.lang.String file)
void
removeHistory(java.util.List<DownloadHistory> to_remove)
void
removeListener(DownloadHistoryListener listener)
void
resetHistory()
private void
saveHistory(java.lang.String file, java.util.Map<java.lang.Long,DownloadHistoryManagerImpl.DownloadHistoryImpl> records)
void
setEnabled(boolean enabled)
(package private) void
setEnabledSupport(boolean b, boolean startup)
(package private) void
setRedownloading(DownloadHistory dh)
private void
syncFromExisting(GlobalManager global_manager)
(package private) void
writeHistory()
-
-
-
Field Detail
-
CONFIG_ENABLED
private static final java.lang.String CONFIG_ENABLED
- See Also:
- Constant Field Values
-
CONFIG_ACTIVE_FILE
private static final java.lang.String CONFIG_ACTIVE_FILE
- See Also:
- Constant Field Values
-
CONFIG_DEAD_FILE
private static final java.lang.String CONFIG_DEAD_FILE
- See Also:
- Constant Field Values
-
CONFIG_ACTIVE_SIZE
private static final java.lang.String CONFIG_ACTIVE_SIZE
- See Also:
- Constant Field Values
-
CONFIG_DEAD_SIZE
private static final java.lang.String CONFIG_DEAD_SIZE
- See Also:
- Constant Field Values
-
UPDATE_TYPE_ACTIVE
private static final int UPDATE_TYPE_ACTIVE
- See Also:
- Constant Field Values
-
UPDATE_TYPE_DEAD
private static final int UPDATE_TYPE_DEAD
- See Also:
- Constant Field Values
-
UPDATE_TYPE_BOTH
private static final int UPDATE_TYPE_BOTH
- See Also:
- Constant Field Values
-
TAG_CACHE_KEY
private static final java.lang.Object TAG_CACHE_KEY
-
core
private final Core core
-
tag_manager
private static final TagManager tag_manager
-
listeners
private final ListenerManager<DownloadHistoryListener> listeners
-
lock
final java.lang.Object lock
-
history_active
private java.lang.ref.WeakReference<java.util.Map<java.lang.Long,DownloadHistoryManagerImpl.DownloadHistoryImpl>> history_active
-
history_dead
private java.lang.ref.WeakReference<java.util.Map<java.lang.Long,DownloadHistoryManagerImpl.DownloadHistoryImpl>> history_dead
-
active_history_size
volatile int active_history_size
-
dead_history_size
volatile int dead_history_size
-
active_dirty
private java.util.Map<java.lang.Long,DownloadHistoryManagerImpl.DownloadHistoryImpl> active_dirty
-
dead_dirty
private java.util.Map<java.lang.Long,DownloadHistoryManagerImpl.DownloadHistoryImpl> dead_dirty
-
write_pending_event
TimerEvent write_pending_event
-
active_load_time
private long active_load_time
-
dead_load_time
private long dead_load_time
-
history_escaped
private boolean history_escaped
-
redownload_cache
private final java.util.Map<java.lang.Long,java.lang.Long> redownload_cache
-
enabled
boolean enabled
-
NO_TAGS
private static java.lang.String[] NO_TAGS
-
-
Method Detail
-
isEnabled
public boolean isEnabled()
- Specified by:
isEnabled
in interfaceDownloadHistoryManager
-
setEnabled
public void setEnabled(boolean enabled)
- Specified by:
setEnabled
in interfaceDownloadHistoryManager
-
setEnabledSupport
void setEnabledSupport(boolean b, boolean startup)
-
isMonitored
boolean isMonitored(DownloadManager dm)
-
syncFromExisting
private void syncFromExisting(GlobalManager global_manager)
-
getHistory
private java.util.List<DownloadHistory> getHistory()
-
getHistoryCount
public int getHistoryCount()
- Specified by:
getHistoryCount
in interfaceDownloadHistoryManager
-
removeHistory
public void removeHistory(java.util.List<DownloadHistory> to_remove)
- Specified by:
removeHistory
in interfaceDownloadHistoryManager
-
clearHistory
private void clearHistory()
-
resetHistory
public void resetHistory()
- Specified by:
resetHistory
in interfaceDownloadHistoryManager
-
getDates
public long[] getDates(byte[] hash)
- Specified by:
getDates
in interfaceDownloadHistoryManager
- Returns:
- [ added, completed, removed, redownloaded (transient)]
-
setRedownloading
void setRedownloading(DownloadHistory dh)
-
getUID
static long getUID(DownloadManager dm)
-
addListener
public void addListener(DownloadHistoryListener listener, boolean fire_for_existing)
- Specified by:
addListener
in interfaceDownloadHistoryManager
-
removeListener
public void removeListener(DownloadHistoryListener listener)
- Specified by:
removeListener
in interfaceDownloadHistoryManager
-
getActiveHistory
java.util.Map<java.lang.Long,DownloadHistoryManagerImpl.DownloadHistoryImpl> getActiveHistory()
-
getDeadHistory
java.util.Map<java.lang.Long,DownloadHistoryManagerImpl.DownloadHistoryImpl> getDeadHistory()
-
historyUpdated
void historyUpdated(DownloadHistory dh, int action, int type)
-
historyUpdated
private void historyUpdated(java.util.Collection<DownloadHistory> list, int action, int type)
-
checkDiscard
void checkDiscard()
-
writeHistory
void writeHistory()
-
loadHistory
private java.util.Map<java.lang.Long,DownloadHistoryManagerImpl.DownloadHistoryImpl> loadHistory(java.lang.String file)
-
saveHistory
private void saveHistory(java.lang.String file, java.util.Map<java.lang.Long,DownloadHistoryManagerImpl.DownloadHistoryImpl> records)
-
-