mirror of
https://github.com/overcuriousity/autopsy-flatpak.git
synced 2025-07-17 18:17:43 +00:00
Made EmailExtracted class thread safe
This commit is contained in:
parent
4ad575ef41
commit
f641128cb0
@ -72,36 +72,34 @@ public class EmailExtracted implements AutopsyVisitableItem {
|
|||||||
|
|
||||||
private final class EmailResults extends Observable {
|
private final class EmailResults extends Observable {
|
||||||
|
|
||||||
|
// NOTE: "accounts" object can be accessed by multiple threads and needs to be synchronized
|
||||||
private final Map<String, Map<String, List<Long>>> accounts = new LinkedHashMap<>();
|
private final Map<String, Map<String, List<Long>>> accounts = new LinkedHashMap<>();
|
||||||
// "accounts" object can be accessed by multiple threads and needs to be protected with locks
|
|
||||||
private final Object accountsLock;
|
|
||||||
|
|
||||||
EmailResults() {
|
EmailResults() {
|
||||||
accountsLock = new Object();
|
|
||||||
update();
|
update();
|
||||||
}
|
}
|
||||||
|
|
||||||
public Set<String> getAccounts() {
|
public Set<String> getAccounts() {
|
||||||
synchronized (accountsLock) {
|
synchronized (accounts) {
|
||||||
return accounts.keySet();
|
return accounts.keySet();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public Set<String> getFolders(String account) {
|
public Set<String> getFolders(String account) {
|
||||||
synchronized (accountsLock) {
|
synchronized (accounts) {
|
||||||
return accounts.get(account).keySet();
|
return accounts.get(account).keySet();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<Long> getArtifactIds(String account, String folder) {
|
public List<Long> getArtifactIds(String account, String folder) {
|
||||||
synchronized (accountsLock) {
|
synchronized (accounts) {
|
||||||
return accounts.get(account).get(folder);
|
return accounts.get(account).get(folder);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings("deprecation")
|
@SuppressWarnings("deprecation")
|
||||||
public void update() {
|
public void update() {
|
||||||
synchronized (accountsLock) {
|
synchronized (accounts) {
|
||||||
accounts.clear();
|
accounts.clear();
|
||||||
if (skCase == null) {
|
if (skCase == null) {
|
||||||
return;
|
return;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user