forked from Qortal/qortal
Small refactor to reduce code duplication.
This commit is contained in:
parent
87b724ec72
commit
19173321ea
@ -93,9 +93,7 @@ public class ArbitraryDataReader {
|
|||||||
public boolean isCachedDataAvailable() {
|
public boolean isCachedDataAvailable() {
|
||||||
// If this resource is in the build queue then we shouldn't attempt to serve
|
// If this resource is in the build queue then we shouldn't attempt to serve
|
||||||
// cached data, as it may not be fully built
|
// cached data, as it may not be fully built
|
||||||
ArbitraryDataBuildQueueItem queueItem =
|
if (ArbitraryDataBuildManager.getInstance().isInBuildQueue(this.createQueueItem())) {
|
||||||
new ArbitraryDataBuildQueueItem(this.resourceId, this.resourceIdType, this.service, this.identifier);
|
|
||||||
if (ArbitraryDataBuildManager.getInstance().isInBuildQueue(queueItem)) {
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -109,6 +107,10 @@ public class ArbitraryDataReader {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private ArbitraryDataBuildQueueItem createQueueItem() {
|
||||||
|
return new ArbitraryDataBuildQueueItem(this.resourceId, this.resourceIdType, this.service, this.identifier);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* loadAsynchronously
|
* loadAsynchronously
|
||||||
*
|
*
|
||||||
@ -119,9 +121,7 @@ public class ArbitraryDataReader {
|
|||||||
* @return true if added or already present in queue; false if not
|
* @return true if added or already present in queue; false if not
|
||||||
*/
|
*/
|
||||||
public boolean loadAsynchronously() {
|
public boolean loadAsynchronously() {
|
||||||
ArbitraryDataBuildQueueItem queueItem =
|
return ArbitraryDataBuildManager.getInstance().addToBuildQueue(this.createQueueItem());
|
||||||
new ArbitraryDataBuildQueueItem(this.resourceId, this.resourceIdType, this.service, this.identifier);
|
|
||||||
return ArbitraryDataBuildManager.getInstance().addToBuildQueue(queueItem);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
x
Reference in New Issue
Block a user