-
Notifications
You must be signed in to change notification settings - Fork 70
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
Add read timeout for how long we query beans #168
Changes from 1 commit
23066ff
31d8e92
c477c87
647736b
25b7061
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -20,6 +20,7 @@ public class RemoteConnection extends Connection { | |
private String jmx_url; | ||
private static final String TRUST_STORE_PATH_KEY = "trust_store_path"; | ||
private static final String TRUST_STORE_PASSWORD_KEY = "trust_store_password"; | ||
private static final String DEFAULT_RMI_RESPONSE_TIMEOUT = "5000"; | ||
private final static Logger LOGGER = Logger.getLogger(Connection.class.getName()); | ||
|
||
public RemoteConnection(LinkedHashMap<String, Object> connectionParams) | ||
|
@@ -53,6 +54,10 @@ public RemoteConnection(LinkedHashMap<String, Object> connectionParams) | |
} | ||
|
||
} | ||
|
||
//Set an RMI timeout so we don't get stuck waiting for a bean to report a value | ||
System.setProperty("sun.rmi.transport.tcp.responseTimeout", DEFAULT_RMI_RESPONSE_TIMEOUT); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. what happens when we reach the timeout? Do we catch and handle the exception that's raised correctly? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. An error should be shown during the refresh bean list period where we scope out all available beans. If we hit the timeout there, an exception will be thrown (with a read timeout) and we should wait until the next collection period to try again. |
||
|
||
createConnection(); | ||
|
||
} | ||
|
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.
based on the docs this is expressed in milliseconds, are you sure 5 seconds is enough in usual cases? (I know some JVMs expose a lot of beans, and on these environments I could imagine that the call to get all the beans takes more than 5 seconds).
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 bumped this up to 15 by default and am using the user defined "refresh_beans" parameter to address this and make it configurable. Though it may make more sense to actually have this set to the min_collection_interval. What do you think?
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 bumped this again to actually be the default of the refresh_bean timeout as I think that makes the most sense here.