jeudi 17 octobre 2019

Introduce middleware-like implementation for a singleton class member

I have a singleton Communication class which has numerous methods. I want to enforce that whenever any method of that class is called, a check is made to see if the server is up, and if not, then start it.

It seems a lot like middleware we implement in case of REST servers, but this one is on the client side.

How should I approach a problem like this? Is there a cleaner way around calling a check method in every case explicitly?

Aucun commentaire:

Enregistrer un commentaire