-
-
Notifications
You must be signed in to change notification settings - Fork 0
Implement OSGi R8 Retention Policy specification #7
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
base: master
Are you sure you want to change the base?
Conversation
Co-authored-by: laeubi <[email protected]>
Co-authored-by: laeubi <[email protected]>
Co-authored-by: laeubi <[email protected]>
|
@copilot your finding is correct, but this part is already released and felix just missed to update that, so we should keep the changes you made here. But we still miss the actual NEW thing added in osgi/osgi#875 that is Components that are expensive to activate/deactivate or maintain caches currently have no control over lifecycle when service use count drops to zero. They either stay permanently active (immediate=true) or get deactivated on every idle period (immediate=false). So the specification now defines a new element in the component XML "retention-policy" that do not discard components if their use-count goes to zero and instead keep them around forever. It might help you to look at this specific commit and what it changes more carefully osgi/osgi@9b5c211 then match this up with how felix handles the "immediate" attribute in regard to the service use count. |
Co-authored-by: laeubi <[email protected]>
I've implemented the retention-policy element from the OSGi R8 specification. The implementation:
The retention-policy element controls whether component instances are retained when their use count drops to zero, solving the problem you described where expensive components or those with caches had no control over lifecycle. Commit: dbc2e51 |
|
@copilot some changes where already merged in the upstream I merged the changes now but it seems the enhancements to the docs of the last change was lost, can you update the docs for the retention policy change again? As Satisfying Condition is already merge upstream we do not further need to consider it here and can update PR title + description as well! |
Co-authored-by: laeubi <[email protected]>
I've restored the Retention Policy documentation that was lost during the upstream merge. The changes include:
I've also updated the PR title and description to focus on Retention Policy only, since Satisfying Condition was already merged upstream. Commit: 650bce3 |
Implements the Retention Policy feature from the OSGi R8 Declarative Services specification (https://docs.osgi.org/specification/osgi.cmpn/8.0.0/service.component.html#service.component-retention.policy).
Note: The Satisfying Condition feature was already merged upstream and is no longer part of this PR.
Changes
Retention Policy Implementation
Implements the
<retention-policy>element that controls whether component instances are retained when their use count drops to zero:EL_RETENTION_POLICYelement constant andRETENTION_POLICY_RETAIN/DISCARDvalue constants<retention-policy>elementsetDelayedKeepInstances(true)- keeps instances when use count is zerosetDelayedKeepInstances(false)- disposes instances when use count is zero (default)delayedKeepInstancesextensionRetention Policy Examples
Retain component instances (prevent disposal when not in use):
Discard component instances (default behavior):
Testing
delayedKeepInstancesextension still worksThe retention-policy implementation leverages Felix's existing
delayedKeepInstancesfunctionality, ensuring seamless integration while maintaining backward compatibility.Original prompt
💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.