Skip to content

Possibility to reset connection to redis#41

Merged
vdoleans01 merged 13 commits intoAmadeusITGroup:masterfrom
vdoleans01:master
Apr 25, 2018
Merged

Possibility to reset connection to redis#41
vdoleans01 merged 13 commits intoAmadeusITGroup:masterfrom
vdoleans01:master

Conversation

@vdoleans01
Copy link
Copy Markdown
Contributor

No description provided.

Copy link
Copy Markdown
Contributor

@mgarcez mgarcez left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi Vincent,

Thank you for the PR.

I added some comments.

Could you please also perform a formatting of your code with your IDE? And also remove unnecessary newlines new added?

Thanks,
Maxime

redis.info("server");
return true;
}
catch ( Exception e ) {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are there no other ways to detect that Redis is disconnected than by catching an exception?

I would rather we find another way. If not possible, then can we at least be more specific on the Exception caught?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

* max: if the number if items is more than the max value the ErrorTracker reachLimits
*
*/

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Better to remove the useless end of line :)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

import java.util.concurrent.ConcurrentLinkedQueue;

/**
* The class is used to track the number of item during a time.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

during a time?


/**
* The class is used to track the number of item during a time.
* input parameter
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • @param delay
    Time in milliseconds while items are kept
  • @param max
    If the number of items is more than the max value the Tracker is considered in error

private ConcurrentLinkedQueue<Long> list = new ConcurrentLinkedQueue<Long>();

/**
* The class calculate the items during a time
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

calculates

Could you clarify "during a time"?


monitoring = new MetricRegistry ();

String SESSIONS_METRIC_MANAGER_PREFIX = "com.amadeus.session.manager";
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You could put is as a constant

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

try {
expirationListener.close(redis);
expirationListener = null;
} catch (Exception e) {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cannot we be more specific on the Exception caught?
Same remark for the other cases where we caught Exception

Small spelling error: generates errors

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No we cant , it is like you want to close a sql connection you want to close is even you have other errors

*/
final int max ;

public void addError( long now ) {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe you could add some javadoc explaining the method?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

monitoring = new MetricRegistry ();

String SESSIONS_METRIC_MANAGER_PREFIX = "com.amadeus.session.manager";
String ResetManager_created_METRIC = name(SESSIONS_METRIC_MANAGER_PREFIX, "initialized");
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would put it, and the others as constants (and hence all in upper case too)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

private final ErrorTracker errorTracker ;


private final Meter create_metrics ;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would either put the variable name as camelCase, or as a CONSTANT_NAME.
I would also replace "metrics" by "meter", or "metric" in singular.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

@vdoleans01 vdoleans01 merged commit f138eb2 into AmadeusITGroup:master Apr 25, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants