[ https://issues.apache.org/jira/browse/TAP5-2684?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17722470#comment-17722470 ]
Ben Weidig commented on TAP5-2684: ---------------------------------- To implement this correctly, it has to be ensured that shutdown is only called once. Right now, the OneShotLock throws an IllegalStateException if otherwise. There are multiple ways how I can think of doing this ticket: Extending OneShotLock with a "boolean isLocked()" method that won't throw. This way, the shutdown method could check first and not try to shut down again. The lock instance in RegistryImpl is effectively a "is shutdown" marker, so it could be used as such. The obvious downside would be that the shutdown method is behaving differently than the rest of the Registry methods, which isn't that desirable. Another option would be using an AtomicBoolean or something as a more explicit "registry is shutdown" marker instead of solely relying on the lock. Then, the Runtime hook could check that marker to prevent double shutdown attempts. > Registry shutdown only in TapestryFilter > ---------------------------------------- > > Key: TAP5-2684 > URL: https://issues.apache.org/jira/browse/TAP5-2684 > Project: Tapestry 5 > Issue Type: Improvement > Components: tapestry-ioc > Affects Versions: 5.6.4 > Reporter: Ben Weidig > Assignee: Ben Weidig > Priority: Minor > > Maybe I overlooked something, but the registry is only shutdown in the > TapestryFilter, which we don't use in our projects. > Adding a runtime shutdown hook would ensure the registry will be shutdown in > other scenarios, too. > {code:java} > Runtime.getRuntime().addShutdownHook(new Thread(this::shutdown)); > {code} -- This message was sent by Atlassian Jira (v8.20.10#820010)