Hi all,

I think I‘ve finally managed to spare some time to finish my work on the 
connection cache.

I think https://github.com/apache/plc4x/pull/818 tried to address a problem, 
where if something happens with the connection while it’s being used, that it 
might be in a inconsistent state. So, it was the goal to intercept any errors 
occurring during the execution of any request and to instantly close the 
connection if anything went wrong.

However, I wasn’t happy with the PR as it sort of brought the connection into 
an odd state and it only was a partial solution. Also did it change the API, 
weakening the contract between PLC4X and the using application. And if there 
were requests waiting for the connection, they would just have been dropped and 
would never get a connection.

So, what I did, was something similar to the original PR: I intercept the 
execution of all types of requests (not only read- and write-requests). But 
instead of closing the connection instantly, I mark it as 
“invalidateConnection” … when the close() method is called, this tells the 
connection container to invalidate the connection.

The connection container then handles closing the connection and possibly 
creating a new connection and using that to serve the waiting clients.

I hope this solves the problem people were seeing with the current 
implementation.

I will then close the PR818 if I don’t hear anything in the next 72h

Chris


Reply via email to