PSF-BotServer/src/main/scala/net/psforever/IFinalizable.scala
Jakob Gillich f4fd78fc5d Restructure repository
* Move /common/src to /src
* Move services to net.psforever package
* Move /pslogin to /server
2020-08-26 06:19:00 +02:00

24 lines
531 B
Scala

// Copyright (c) 2017 PSForever
package net.psforever
class ObjectFinalizedException(msg: String) extends Exception(msg)
trait IFinalizable {
var closed = false
def close = {
closed = true
}
def assertNotClosed = {
if (closed)
throw new ObjectFinalizedException(
this.getClass.getCanonicalName + ": already finalized. Cannot interact with object"
)
}
override def finalize() = {
if (!closed)
println(this.getClass.getCanonicalName + ": class not closed. memory leaked")
}
}