File tree Expand file tree Collapse file tree 3 files changed +10
-3
lines changed
main/scala/com/twitter/finagle/util Expand file tree Collapse file tree 3 files changed +10
-3
lines changed Original file line number Diff line number Diff line change @@ -25,7 +25,7 @@ Runtime Behavior Changes
2525 and stack trace are printed to stderr in addition to the existing stdout. ``PHAB_ID=D1116753 ``
2626* util-jvm: Memory manager & pool metrics are labelled dimensionally rather than hierarchically
2727 when exported as dimensional metrics. ``PHAB_ID=D1218090 ``
28-
28+ * util-app: Enables a jvm shutdown hook to call app.quit(). `` PHAB_ID=D1236932 ``
2929
303023.11.0
3131-------
Original file line number Diff line number Diff line change @@ -51,6 +51,6 @@ object loadServiceIgnoredPaths
5151 */
5252object enableJvmShutdownHook
5353 extends GlobalFlag [Boolean ](
54- false ,
54+ true ,
5555 " Registers a JVM shutdown hook which invokes close()"
5656 )
Original file line number Diff line number Diff line change @@ -5,11 +5,13 @@ import com.twitter.app.lifecycle.Event
55import com .twitter .app .lifecycle .Observer
66import com .twitter .app .LoadService .Binding
77import com .twitter .conversions .DurationOps ._
8+ import com .twitter .finagle .util .enableJvmShutdownHook
89import com .twitter .util ._
910import java .util .concurrent .ConcurrentLinkedQueue
1011import scala .jdk .CollectionConverters ._
1112import scala .language .reflectiveCalls
1213import org .scalatest .funsuite .AnyFunSuite
14+ import org .scalatest .BeforeAndAfterEach
1315
1416class TestApp (f : () => Unit ) extends App {
1517 var reason : Option [String ] = None
@@ -61,7 +63,12 @@ trait ErrorOnExitApp extends App {
6163 }
6264}
6365
64- class AppTest extends AnyFunSuite {
66+ class AppTest extends AnyFunSuite with BeforeAndAfterEach {
67+
68+ override protected def beforeEach (): Unit = {
69+ enableJvmShutdownHook.parse(" false" )
70+ }
71+
6572 test(" App: make sure system.exit called on exception from main" ) {
6673 val test1 = new TestApp (() => throw new RuntimeException (" simulate main failing" ))
6774
You can’t perform that action at this time.
0 commit comments