-
Notifications
You must be signed in to change notification settings - Fork 393
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
New various Changes for #1 #818
Conversation
add Timeout-HandlingVarious Changes
YESS! ... that's much more something we can discuss ... I'll do that as soon as I can (Currently not allowed to do Apache code-work while on the clock :-( ) ... but just wanted to say that it's greatly appreciated :-) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How do the changes from the Nett wrapper correspond to the ones in the connection-cache?
...ection-cache/src/main/java/org/apache/plc4x/java/utils/cache/CachedPlcConnectionManager.java
Show resolved
Hide resolved
...ection-cache/src/main/java/org/apache/plc4x/java/utils/cache/CachedPlcConnectionManager.java
Outdated
Show resolved
Hide resolved
@@ -66,7 +76,7 @@ public void connect() throws PlcConnectionException { | |||
@Override | |||
public boolean isConnected() { | |||
if(connection == null) { | |||
throw new PlcRuntimeException("Error using leased connection after returning it to the cache."); | |||
return false; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not quite sure this is the best way to do this. Because for me there's a difference, if we're not connected or if we already gave back the handle. The way I implemented it gives the user the explicit feedback, that he's doing something bad. If we return false, he might think he just needs to re-connect.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we lose the connection we can handle reconnection
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
By the way. I'm working on eclipse kura. It require work uninterrupted. We must have explicit reconect signal to reconnect not a exception.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have already explained that previous PR are the basis for subsequent PRs. Next I want to submit a PR for PL4x
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have encountered a scenario where the PLC connection appeared to be disconnected, but in reality it was still connected due to certain reasons. However, we kept trying to reconnect and as a result, the TCP estab value increased to tens of thousands. This caused the PLC to be disconnected and also resulted in server network issues. Therefore, I'm looking to see if there is a better solution available.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I still don't quite understand the problem with this ... if you returned the connection to the pool, you should not do anything with it ... that's sort of the contract on using the pool. If there's some logic calling "isConnected()" after it has been returned, that's just a flaw in the program using it. I still think we should continue to throw an exception here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We use PLC4x to collect data for long term work. If the connection is closed abnormally, I don’t want to always use the try catch method. If we use this to detect that the connection is closed, we only need to borrow it again.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would say that's a usecase particular to how you use PLC4X, however out API shouldn't be optimized towards one particular usecase. I think try-catch-blocks don't consume any noticable amount of resources. So I would like to ask to to stick to using try-catch blocks and us keeping the API coherent.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just connect is not allowed. I think isConeccted is should reserve the functionality of the original API
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm wondering why you want to disable this API functionality and replace it with an error
...ls/connection-cache/src/main/java/org/apache/plc4x/java/utils/cache/LeasedPlcConnection.java
Show resolved
Hide resolved
plc4j/spi/src/main/java/org/apache/plc4x/java/spi/messages/DefaultPlcWriteRequest.java
Outdated
Show resolved
Hide resolved
The raw conection is netty conection and if disconnected it always can
reconnect
Christofer Dutz ***@***.***> 于2023年2月22日周三 22:57写道:
… ***@***.**** commented on this pull request.
------------------------------
In
plc4j/tools/connection-cache/src/main/java/org/apache/plc4x/java/utils/cache/CachedPlcConnectionManager.java
<#818 (comment)>:
> connectionContainers.put(url, connectionContainer);
} else {
LOG.debug("Reusing exising connection");
+ if(connectionContainer.getRawConnection()!=null && !connectionContainer.getRawConnection().isConnected()){
Also admittedly ... I'm not 100% sure if all drivers safely allow
reconnecting if they were somehow disconnected.
—
Reply to this email directly, view it on GitHub
<#818 (comment)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/AANP4ZB7FQLGUAQMR672INDWYYSOPANCNFSM6AAAAAAVEEMXEI>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>
|
fix OutOfMemoryError
add Timeout-Handling
fix connection-cache