I just noticed, that the PlcDriverManager currently does more stuff than we need for the caches. So, I simply created a PlcConnectionManager interface with the two getConnection methods. This way we don’t even have to refactor anything, and problem number 1 is solved.
From: Christofer Dutz <christofer.d...@c-ware.de> Date: Sunday, 8. January 2023 at 15:36 To: dev@plc4x.apache.org <dev@plc4x.apache.org> Subject: [DISCUSS] Refactor the PlcDriverManager in Java? Hi all, I’m currently working on a new Connection Cache for Java and have stumbled over two things: The one is the fact, that the PlcDriverManager is a class and not an interface. This makes it problematic for me to have the PlcDriverManager implement the same interface. I could probably override every method, so this is not a big problem. However, having a PlcDriverManager interface would be the cleaner solution. This would require us to change the name of the current PlcDriverManager class to something like DefaultPlcDriverManager… this would be a breaking change. Another is that the getConnection doesn’t return a Future … the main reason for this was the try-with-resources pattern, that automatically closes the PlcConnection returned from getConnection. However, returning a future might be the better option and it would be more like in the other languages. Especially when we’re working with cached connections. Here a client might be waiting a while till it gets a connection handle. This also would be a breaking change. What do you folks think? Chris