add pooledObject validate#4
Conversation
|
Hi @uliian, Thanks for your PR. I must take some time to evaluate your changes, in order to see how well they fit with existing specialized and timed pools; in fact, the addition of validation might make it easier to implement those pools. Moreover, I think it might be useful to provide some sort of "validation context" to your method, which now might be an empty/dummy class, but it will let us give more information to the validation function without breaking the API. Hoping that this change is not really urgent, I will merge and publish this as soon as possible, no later than this weekend. |
|
😃 this change is not urgent。My PR is relatively hasty, we really should carefully consider its API design to ensure scalability |
|
Hi @uliian, Could you have a look at these commits: And let me know if my changes are OK for you? I added a validation context, through which additional information might be given to the validation step, and I changed the way a subclass can provide its own validation step so that it was similar to existing extension points. Moreover, your validation is also used when an object returns to the pool. Currently, the validation context only exposes the "direction" of an object (in or out of the pool). I already adapted existing specialized pools so that they use the new validation step, you can check the code in the second commit. As soon as we agree on the changes, I can release the updated package. |
|
No Problem!:bowtie: |
|
Hi @uliian, The updated package has been published to NuGet. |
In my scenario, I need to do some usability validation on the Pooledobject. Eg: (TCP connectivity) I want to join the object validation feature. If we are free in the future, we can also join the background thread verification feature.