Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add ActivityController.close that transitions Activity to destroyed state #6864

Merged
merged 1 commit into from Nov 17, 2021

Conversation

copybara-service[bot]
Copy link

@copybara-service copybara-service bot commented Nov 17, 2021

Add ActivityController.close that transitions Activity to destroyed state

Update ActivityController to implement AutoCloseable, and add a 'close' method
that is lifecycle-aware and transitions the underlying Activity to the destroyed
state, freeing all resources and making the Activity eligible for gc.

This is a convenient way to ensure that ActivityControllers can be freed without
having to manage the underlying Activity lifecycles.

It also enables ActivityController to be managed using try-with-resources.

@copybara-service copybara-service bot force-pushed the piper_410291892 branch 2 times, most recently from 1be6910 to 936637a Compare Nov 17, 2021
@hoisie hoisie force-pushed the piper_410291892 branch 2 times, most recently from 31be693 to 1a350f7 Compare Nov 17, 2021
…tate

Update ActivityController to implement AutoCloseable, and add a 'close'
method that is lifecycle-aware and transitions the underlying Activity
to the destroyed state, freeing all resources and making the Activity
eligible for gc.

This is a convenient way to ensure that ActivityControllers can be freed
without having to manage the underlying Activity lifecycles.

It also enables ActivityController to be managed using
try-with-resources.

PiperOrigin-RevId: 410291892
@hoisie hoisie merged commit c1c3c0e into master Nov 17, 2021
6 checks passed
@hoisie hoisie deleted the piper_410291892 branch Nov 17, 2021
seadowg
Copy link
Collaborator

@seadowg seadowg commented on feaded1 Feb 9, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does close need to be called to prevent Activity objects being leaked during tests?

utzcoz
Copy link
Member

@utzcoz utzcoz commented on feaded1 Feb 9, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does close need to be called to prevent Activity objects being leaked during tests?

Hi @seadowg , could you file a new issue to discuss it? The discussion under commit can't be tracked and indexed well.

seadowg
Copy link
Collaborator

@seadowg seadowg commented on feaded1 Feb 9, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done! #7041

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants