Some senders need to explictly clean opened resources (opened files, opened sockets or anything else that needs to explicitly close resources or free memory). This can be necessary in applications that create, destroy and recreate MessagingService instances.
A new interface Cleanable has been created but for now it is not called automatically. Several possibilities:
Change every implementation to also implement Cleanable in order to transmit clean() calls everywhere
-- need to update all classes for a technical concern (not business one)
-- some implementations that delegates to several implementations may be hard to handle
Change only builders that register implementations that need to be cleaned (instances that implement Cleanable)
+ change is only located in builders that create the instances. An utility method can be used to track Cleanable instances into a registry.
++ only implementations that need cleanup are modified
-- registry must be shared between all builders
Use an static event system
++ only implementations that need cleanup are modified
++ builders are not modified
-- use of static method so can't use several distinct services
-- implementations need to know about event system
Use of static registry
++ only implementations that need cleanup are modified
++ builders are not modified
-- use of static method so can't use several distinct services
Some senders need to explictly clean opened resources (opened files, opened sockets or anything else that needs to explicitly close resources or free memory). This can be necessary in applications that create, destroy and recreate
MessagingService
instances.A new interface
Cleanable
has been created but for now it is not called automatically. Several possibilities:Cleanable
in order to transmitclean()
calls everywhere--
need to update all classes for a technical concern (not business one)--
some implementations that delegates to several implementations may be hard to handleCleanable
)+
change is only located in builders that create the instances. An utility method can be used to trackCleanable
instances into a registry.++
only implementations that need cleanup are modified--
registry must be shared between all builders++
only implementations that need cleanup are modified++
builders are not modified--
use of static method so can't use several distinct services--
implementations need to know about event system++
only implementations that need cleanup are modified++
builders are not modified--
use of static method so can't use several distinct services--
implementations need to know about registry