Skip to main content
Tweeted twitter.com/StackSoftEng/status/1065938145714294784
deleted 81 characters in body
Source Link

I have a ConstraintsResolver class which resolves a queue of Constraints. This is done when a ConstraintsResolver object calls meetConstraint() on a Constraint one.

Most of meetConstraint() implementations will return immediately, so I could just return a boolean, but there is at least one that will block, which means I need to implement the callback pattern.

Do I have an option to combine both solutions or I have to implement only the callback pattern?

ps: I was not sure if this question needed to be asked here or StackOverflow

I have a ConstraintsResolver class which resolves a queue of Constraints. This is done when a ConstraintsResolver object calls meetConstraint() on a Constraint one.

Most of meetConstraint() implementations will return immediately, so I could just return a boolean, but there is at least one that will block, which means I need to implement the callback pattern.

Do I have an option to combine both solutions or I have to implement only the callback pattern?

ps: I was not sure if this question needed to be asked here or StackOverflow

I have a ConstraintsResolver class which resolves a queue of Constraints. This is done when a ConstraintsResolver object calls meetConstraint() on a Constraint one.

Most of meetConstraint() implementations will return immediately, so I could just return a boolean, but there is at least one that will block, which means I need to implement the callback pattern.

Do I have an option to combine both solutions or I have to implement only the callback pattern?

Source Link

Callback pattern - return value confusion

I have a ConstraintsResolver class which resolves a queue of Constraints. This is done when a ConstraintsResolver object calls meetConstraint() on a Constraint one.

Most of meetConstraint() implementations will return immediately, so I could just return a boolean, but there is at least one that will block, which means I need to implement the callback pattern.

Do I have an option to combine both solutions or I have to implement only the callback pattern?

ps: I was not sure if this question needed to be asked here or StackOverflow