Imesha,
I can't comment particularly this piece of code. The initial
question was too general and I thought about QueueConsumer, for example,
or other type of listener that is implemented by customer and executes
customer code.
It might be some type of dependency for that function that could
depend from customer code. If you want to go deeper - you can analyze
source and check if there are such. May be there is no reason for that
also. :)
Vadim.
On 2016-11-21 12:32, Imesha Sudasingha wrote:
> Hello Vadim,
>
> I didn't get your point. What I mean is, suppose we are going to create an
> ZNode. Consider the following example,
>
> curatorFrameworkInstance.create().forPath("/ZNode/path");
>
> In the above code, we have to surround with a try/catch since it is expected
> to throw an exception of type EXCEPTION. According to your explanation, how
> can this be a code written by me? What I am doing above is just executing the
> methods provided. Can you elaborate on that?
>
> -Imesha
>
> On 21 November 2016 at 13:45, Vadim <[email protected]> wrote:
>
> Hello Imesha,
>
> As user of curator, I guess this is because Curator suppose to execute
> external code (like yours) and it does not know what type of the exception it
> will throw in advance. If you define specific exception -- your code will be
> dependent on that and thus "hard dependency" arise. It breaks DIP principle
> from SOLID (https://en.wikipedia.org/wiki/SOLID_(object-oriented_design)) [1]
> that is not good.
>
> Vadim.
>
> On 2016-11-21 09:12, Imesha Sudasingha wrote:
> Hi all,
>
> I was curious on why most of the methods in CURATORFRAMEWORK throw exceptions
> of the type EXCEPTION which is the base class? In Zookeeper, they have
> specific set of custom exceptions like ZooKeeperException and so on. Do you
> have a specific reason for that?
>
> Thanks in advance!
>
> -Imesha
> --
>
> IMESHA SUDASINGHA
> Undergraduate of Department of Computer Science and Engineering,
> University of Moratuwa.
--
IMESHA SUDASINGHA
Undergraduate of Department of Computer Science and Engineering,
University of Moratuwa.
Links:
------
[1] https://en.wikipedia.org/wiki/SOLID_(object-oriented_design))