12
12
namespace Microsoft . Spark . E2ETest . IpcTests
13
13
{
14
14
[ Collection ( "Spark E2E Tests" ) ]
15
- public class JvmThreadPoolGarbageCollectorTests
15
+ public class JvmThreadPoolGCTests
16
16
{
17
17
private readonly SparkSession _spark ;
18
18
private readonly IJvmBridge _jvmBridge ;
19
19
20
- public JvmThreadPoolGarbageCollectorTests ( SparkFixture fixture )
20
+ public JvmThreadPoolGCTests ( SparkFixture fixture )
21
21
{
22
22
_spark = fixture . Spark ;
23
23
_jvmBridge = ( ( IJvmObjectReferenceProvider ) _spark ) . Reference . Jvm ;
@@ -42,7 +42,7 @@ void testChildThread(string appName)
42
42
43
43
// Since we are in the child thread, GetActiveSession() should return the child
44
44
// SparkSession.
45
- var activeSession = SparkSession . GetActiveSession ( ) ;
45
+ SparkSession activeSession = SparkSession . GetActiveSession ( ) ;
46
46
Assert . NotNull ( activeSession ) ;
47
47
Assert . Equal ( appName , activeSession . Conf ( ) . Get ( "spark.app.name" , null ) ) ;
48
48
} ) ;
@@ -51,7 +51,7 @@ void testChildThread(string appName)
51
51
thread . Join ( ) ;
52
52
}
53
53
54
- for ( var i = 0 ; i < 5 ; i ++ )
54
+ for ( var i = 0 ; i < 5 ; ++ i )
55
55
{
56
56
testChildThread ( i . ToString ( ) ) ;
57
57
}
@@ -60,12 +60,12 @@ void testChildThread(string appName)
60
60
}
61
61
62
62
/// <summary>
63
- /// Monitor a thread via the JvmThreadPoolGarbageCollector .
63
+ /// Monitor a thread via the JvmThreadPoolGC .
64
64
/// </summary>
65
65
[ Fact ]
66
- public void TestMonitorThread ( )
66
+ public void TestTryAddThread ( )
67
67
{
68
- var threadPool = new JvmThreadPoolGarbageCollector ( _jvmBridge , TimeSpan . FromMinutes ( 30 ) ) ;
68
+ using var threadPool = new JvmThreadPoolGC ( _jvmBridge , TimeSpan . FromMinutes ( 30 ) ) ;
69
69
70
70
var thread = new Thread ( ( ) => _spark . Sql ( "SELECT TRUE" ) ) ;
71
71
thread . Start ( ) ;
@@ -92,19 +92,23 @@ public void TestThreadRm()
92
92
}
93
93
94
94
/// <summary>
95
- /// Test that the JvmThreadGarbageCollectionInterval configuration defaults to 5 minutes,
96
- /// and can be updated correctly by setting the environment variable.
95
+ /// Test that the GC interval configuration defaults to 5 minutes, and can be updated
96
+ /// correctly by setting the environment variable.
97
97
/// </summary>
98
98
[ Fact ]
99
99
public void TestIntervalConfiguration ( )
100
100
{
101
101
// Default value is 5 minutes.
102
102
Assert . Null ( Environment . GetEnvironmentVariable ( "DOTNET_THREAD_GC_INTERVAL" ) ) ;
103
- Assert . Equal ( TimeSpan . FromMinutes ( 5 ) , SparkEnvironment . ConfigurationService . JvmThreadGarbageCollectionInterval ) ;
103
+ Assert . Equal (
104
+ TimeSpan . FromMinutes ( 5 ) ,
105
+ SparkEnvironment . ConfigurationService . JvmThreadGCInterval ) ;
104
106
105
107
// Test a custom value.
106
108
Environment . SetEnvironmentVariable ( "DOTNET_THREAD_GC_INTERVAL" , "1:30:00" ) ;
107
- Assert . Equal ( TimeSpan . FromMinutes ( 90 ) , SparkEnvironment . ConfigurationService . JvmThreadGarbageCollectionInterval ) ;
109
+ Assert . Equal (
110
+ TimeSpan . FromMinutes ( 90 ) ,
111
+ SparkEnvironment . ConfigurationService . JvmThreadGCInterval ) ;
108
112
}
109
113
}
110
114
}
0 commit comments