[jvm-packages] Add back the overriden finalize() method for SBooster (#3011)
* Convert SIGSEGV to XGBoostError * Address CR Comments * Address CR Comments
This commit is contained in:
parent
65fb4e3f5c
commit
740eba42f7
@ -23,6 +23,12 @@ import ml.dmlc.xgboost4j.java.XGBoostError
|
|||||||
import scala.collection.JavaConverters._
|
import scala.collection.JavaConverters._
|
||||||
import scala.collection.mutable
|
import scala.collection.mutable
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Booster for xgboost, this is a model API that support interactive build of a XGBoost Model
|
||||||
|
*
|
||||||
|
* DEVELOPER WARNING: A Java Booster must not be shared by more than one Scala Booster
|
||||||
|
* @param booster the java booster object.
|
||||||
|
*/
|
||||||
class Booster private[xgboost4j](private[xgboost4j] var booster: JBooster)
|
class Booster private[xgboost4j](private[xgboost4j] var booster: JBooster)
|
||||||
extends Serializable with KryoSerializable {
|
extends Serializable with KryoSerializable {
|
||||||
|
|
||||||
@ -202,6 +208,11 @@ class Booster private[xgboost4j](private[xgboost4j] var booster: JBooster)
|
|||||||
booster.dispose()
|
booster.dispose()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
override def finalize(): Unit = {
|
||||||
|
super.finalize()
|
||||||
|
dispose
|
||||||
|
}
|
||||||
|
|
||||||
override def write(kryo: Kryo, output: Output): Unit = {
|
override def write(kryo: Kryo, output: Output): Unit = {
|
||||||
kryo.writeObject(output, booster)
|
kryo.writeObject(output, booster)
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user