Skip to content

Commit 305644f

Browse files
committed
chore: update assettype
1 parent b2c766e commit 305644f

File tree

2 files changed

+5
-17
lines changed

2 files changed

+5
-17
lines changed

gestalt-asset-core/src/main/java/org/terasology/gestalt/assets/Asset.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -170,10 +170,11 @@ public final <U extends Asset<T>> Optional<U> createInstance() {
170170

171171
/**
172172
* return the non-instanced version of this asset. if the asset is already the normal
173-
* type then it returns itself.
173+
* type then it returns itself. instanced assets are temporary copies from the normal loaded instances.
174+
*
174175
* @return non-instanced version of this Asset
175176
*/
176-
public final Asset<T> getConcreteAsset() {
177+
public final Asset<T> getNormalAsset() {
177178
if (parent == null) {
178179
return this;
179180
}
@@ -187,7 +188,6 @@ public final synchronized void dispose() {
187188
if (!disposed) {
188189
compactInstances();
189190
disposed = true;
190-
assetType.onAssetDisposed(this);
191191
disposalHook.dispose();
192192
if (parent == null) {
193193
for (WeakReference<Asset<T>> inst : this.instances()) {

gestalt-asset-core/src/main/java/org/terasology/gestalt/assets/AssetType.java

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -115,14 +115,13 @@ public synchronized void close() {
115115
*/
116116
@SuppressWarnings("unchecked")
117117
public void processDisposal() {
118-
Reference<? extends Asset<U>> ref = disposalQueue.poll();
119118
Set<ResourceUrn> urns = new HashSet<>();
120-
while (ref != null) {
119+
Reference<? extends Asset<U>> ref = null;
120+
while ((ref = disposalQueue.poll()) != null) {
121121
AssetReference<? extends Asset<U>> assetRef = (AssetReference<? extends Asset<U>>) ref;
122122
urns.add(assetRef.parentUrn);
123123
assetRef.dispose();
124124
references.remove(assetRef);
125-
ref = disposalQueue.poll();
126125
}
127126
for (ResourceUrn urn : urns) {
128127
disposeAsset(urn);
@@ -261,17 +260,6 @@ synchronized void registerAsset(Asset<U> asset, DisposalHook disposer) {
261260
}
262261
}
263262

264-
/**
265-
* Notifies the asset type when an asset is disposed
266-
*
267-
* @param asset The asset that was disposed.
268-
*/
269-
void onAssetDisposed(Asset<U> asset) {
270-
if (!asset.getUrn().isInstance()) {
271-
disposeAsset(asset.getUrn());
272-
}
273-
}
274-
275263
/**
276264
* dispose asset and remove loaded asset from {@link #loadedAssets}
277265
* @param target urn to free

0 commit comments

Comments
 (0)