release resource reference count

* increment ref count on calling action, pub, sub
* decrement ref count on request releasing resource

when ref count reaches 0, the resource is finally released.