-
Notifications
You must be signed in to change notification settings - Fork 49
Community changes #144
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
Community changes #144
Changes from all commits
a70d9a2
76f1d39
01e9871
e08c8fd
cc7a02c
2ee0d95
f6fb441
9ab8472
2447cd4
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 |
|---|---|---|
|
|
@@ -801,8 +801,9 @@ private static String getSubstringInRange(String input, int startIndex, int endI | |
| @Override | ||
| public void publishSMS() { | ||
| RestTemplate restTemplateLogin = new RestTemplate(); | ||
| if (!SMSServiceImpl.publishingSMS) { | ||
| try { | ||
|
|
||
|
Contributor
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. Fix potential race condition with static flag. The static Consider using an AtomicBoolean instead: -private static Boolean publishingSMS = false;
+private static final AtomicBoolean publishingSMS = new AtomicBoolean(false);Then update the flag checks: -if (!SMSServiceImpl.publishingSMS) {
- SMSServiceImpl.publishingSMS = true;
+if (SMSServiceImpl.publishingSMS.compareAndSet(false, true)) {
Contributor
Author
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. It's an existing code. maintaining from long back
Contributor
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.
|
||
| try { | ||
| if (!SMSServiceImpl.publishingSMS) { | ||
| SMSServiceImpl.publishingSMS = true; | ||
| Boolean doSendSMS = ConfigProperties.getBoolean("send-sms"); | ||
| String sendSMSURL = ConfigProperties.getPropertyByName("send-message-url"); | ||
|
|
@@ -875,11 +876,11 @@ public void publishSMS() { | |
| sms = smsNotification.save(sms); | ||
| } | ||
| } | ||
| } catch (Exception e) { | ||
| logger.error("publishSMS failed with error " + e.getMessage()); | ||
| } finally { | ||
| SMSServiceImpl.publishingSMS = false; | ||
| } | ||
| } catch (Exception e) { | ||
| logger.error("publishSMS failed with error " + e.getMessage()); | ||
| } finally { | ||
| SMSServiceImpl.publishingSMS = 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.
π οΈ Refactor suggestion
Redundant community field assignments.
The code sets both
communityandcommunityNamefields with the same value. This appears redundant and could lead to maintenance issues.Consider using only one of these fields consistently:
if(null != benificiaryDetails.getI_bendemographics()) { - identityEditDTO.setCommunity(benificiaryDetails.getI_bendemographics().getCommunityName()); - identityEditDTO.setCommunityName(benificiaryDetails.getI_bendemographics().getCommunityName()); + identityEditDTO.setCommunityName(benificiaryDetails.getI_bendemographics().getCommunityName()); }