Open imback82 opened 5 years ago
One possible approach to address this issue is to create a new class that wraps the JvmBridge instance and implements IDisposable. This wrapper class can then be used to manage the lifecycle of the JvmBridge instance and ensure that it is properly disposed of when it is no longer needed.
@rapoth can i work on it?
Currently, a
JvmBridge
instance is a static member ofSparkEnvironment
class. Without forcing the user to call something likeSparkEnvironment.JvmBridge.Dispose()
in his/her application, there is no clean way to disposeJvmBridge
, thus Scala side handles the disconnect gracefully (#121).One approach to address this issue is to have a ref-counted
SparkSession
whereJvmBridge.Dispose()
is called when the lastSparkSession
object is disposed.// New JvmBridge should be instantiated with the following. using (var spark = SparkSession.Builder().GetOrCreate()) { // do somthing }
public static void Main(string[] args) { var conf = new SparkConf(); // exits Main without creating SparkSession. }