public @interface OnDetached
In a component spec, you can acquire resources in @OnAttached method, and release them in @OnDetached method.
For example:
@OnDetached
void onDetached(
ComponentContext c,
@Prop final DataSource dataSource,
@State final SourceListener sourceListener) {
dataSource.unsubscribe(sourceListener);
}