Skip to content

Commit 29e14cd

Browse files
committed
chore: update assettype
1 parent 41f75bc commit 29e14cd

2 files changed

Lines changed: 5 additions & 17 deletions

File tree

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
@@ -175,10 +175,11 @@ public final <U extends Asset<T>> Optional<U> createInstance() {
175175

176176
/**
177177
* return the non-instanced version of this asset. if the asset is already the normal
178-
* type then it returns itself.
178+
* type then it returns itself. instanced assets are temporary copies from the normal loaded instances.
179+
*
179180
* @return non-instanced version of this Asset
180181
*/
181-
public final Asset<T> getConcreteAsset() {
182+
public final Asset<T> getNormalAsset() {
182183
if (parent == null) {
183184
return this;
184185
}
@@ -192,7 +193,6 @@ public final synchronized void dispose() {
192193
if (!disposed) {
193194
compactInstances();
194195
disposed = true;
195-
assetType.onAssetDisposed(this);
196196
disposalHook.dispose();
197197
if(parent == null) {
198198
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)