more state checking
This commit is contained in:
@@ -163,15 +163,18 @@ public class WorldEngine {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void markActive() {
|
public void markActive() {
|
||||||
|
if (!this.isLive) throw new IllegalStateException();
|
||||||
this.lastActiveTime = System.currentTimeMillis();
|
this.lastActiveTime = System.currentTimeMillis();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void acquireRef() {
|
public void acquireRef() {
|
||||||
|
if (!this.isLive) throw new IllegalStateException();
|
||||||
this.refCount.incrementAndGet();
|
this.refCount.incrementAndGet();
|
||||||
this.lastActiveTime = System.currentTimeMillis();
|
this.lastActiveTime = System.currentTimeMillis();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void releaseRef() {
|
public void releaseRef() {
|
||||||
|
if (!this.isLive) throw new IllegalStateException();
|
||||||
if (this.refCount.decrementAndGet()<0) {
|
if (this.refCount.decrementAndGet()<0) {
|
||||||
throw new IllegalStateException("ref count less than 0");
|
throw new IllegalStateException("ref count less than 0");
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user