mirror of
https://github.com/overcuriousity/autopsy-flatpak.git
synced 2025-07-13 00:16:16 +00:00
Address codacy issues
This commit is contained in:
parent
f171de25c6
commit
692b4604fa
@ -48,12 +48,10 @@ final class ContactCache {
|
|||||||
|
|
||||||
private static final Logger logger = Logger.getLogger(ContactCache.class.getName());
|
private static final Logger logger = Logger.getLogger(ContactCache.class.getName());
|
||||||
|
|
||||||
private final LoadingCache<Account, List<BlackboardArtifact>> contactCache;
|
private final LoadingCache<Account, List<BlackboardArtifact>> accountMap;
|
||||||
|
|
||||||
private static ContactCache instance;
|
private static ContactCache instance;
|
||||||
|
|
||||||
private final PropertyChangeListener ingestListener;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the list of Contacts for the given Account.
|
* Returns the list of Contacts for the given Account.
|
||||||
*
|
*
|
||||||
@ -65,21 +63,21 @@ final class ContactCache {
|
|||||||
* @throws ExecutionException
|
* @throws ExecutionException
|
||||||
*/
|
*/
|
||||||
static synchronized List<BlackboardArtifact> getContacts(Account account) throws ExecutionException {
|
static synchronized List<BlackboardArtifact> getContacts(Account account) throws ExecutionException {
|
||||||
return getInstance().contactCache.get(account);
|
return getInstance().accountMap.get(account);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Force the cache to invalidate all entries.
|
* Force the cache to invalidate all entries.
|
||||||
*/
|
*/
|
||||||
static synchronized void invalidateCache() {
|
static synchronized void invalidateCache() {
|
||||||
getInstance().contactCache.invalidateAll();
|
getInstance().accountMap.invalidateAll();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Construct a new instance.
|
* Construct a new instance.
|
||||||
*/
|
*/
|
||||||
private ContactCache() {
|
private ContactCache() {
|
||||||
contactCache = CacheBuilder.newBuilder().expireAfterAccess(10, TimeUnit.MINUTES).build(
|
accountMap = CacheBuilder.newBuilder().expireAfterAccess(10, TimeUnit.MINUTES).build(
|
||||||
new CacheLoader<Account, List<BlackboardArtifact>>() {
|
new CacheLoader<Account, List<BlackboardArtifact>>() {
|
||||||
@Override
|
@Override
|
||||||
public List<BlackboardArtifact> load(Account key) {
|
public List<BlackboardArtifact> load(Account key) {
|
||||||
@ -94,7 +92,7 @@ final class ContactCache {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
this.ingestListener = pce -> {
|
PropertyChangeListener ingestListener = pce -> {
|
||||||
String eventType = pce.getPropertyName();
|
String eventType = pce.getPropertyName();
|
||||||
if (eventType.equals(DATA_ADDED.toString())) {
|
if (eventType.equals(DATA_ADDED.toString())) {
|
||||||
ModuleDataEvent eventData = (ModuleDataEvent) pce.getOldValue();
|
ModuleDataEvent eventData = (ModuleDataEvent) pce.getOldValue();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user