Example #1
0
        /// Note that *ActiveSession() APIs are not exposed because these APIs work with a
        /// thread-local variable, which stores the session variable. Since the Netty server
        /// that handles the requests is multi-threaded, any thread can invoke these APIs,
        /// resulting in unexpected behaviors if different threads are used.

        /// <summary>
        /// Sets the default SparkSession that is returned by the builder.
        /// </summary>
        /// <param name="session">SparkSession object</param>
        public static void SetDefaultSession(SparkSession session) =>
        session._jvmObject.Jvm.CallStaticJavaMethod(
            s_sparkSessionClassName, "setDefaultSession", session);
Example #2
0
 /// <summary>
 /// Changes the SparkSession that will be returned in this thread when
 /// <see cref="Builder.GetOrCreate"/> is called. This can be used to ensure that a given
 /// thread receives a SparkSession with an isolated session, instead of the global
 /// (first created) context.
 /// </summary>
 /// <param name="session">SparkSession object</param>
 public static void SetActiveSession(SparkSession session) =>
 session.Reference.Jvm.CallStaticJavaMethod(
     s_sparkSessionClassName, "setActiveSession", session);