Skip to content

Commit

Permalink
Update of AlertSbb - shared database will not be used in Timer
Browse files Browse the repository at this point in the history
  • Loading branch information
vetss committed Mar 26, 2018
1 parent f5a855a commit a66e5cc
Showing 1 changed file with 22 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -227,26 +227,29 @@ public void onAlertServiceCentreRequest(AlertServiceCentreRequest evt, ActivityC
}

public void onTimerEvent(TimerEvent event, ActivityContextInterface aci, EventContext eventContext) {

long currLastKey = smscPropertiesManagement.getLastKey();
if(currLastKey == 0) {
currLastKey = System.currentTimeMillis() - TimeUnit.MINUTES.toMillis(serviceCentreRequestTtl);
}

try {
List<AlertServiceRequestData> serviceCentreRequests = ClusterDBOperations.getInstance().c2_getServiceCenterResponses(currLastKey);
if(!serviceCentreRequests.isEmpty()) {
for(AlertServiceRequestData requestData : serviceCentreRequests) {
ISDNAddressString msisdn = requestData.getMsisdn();
AddressString serviceCentreAddress = requestData.getServiceCentreAddress();
int networkId = requestData.getNetworkId();
currLastKey = requestData.getTimestamp();
setupAlert(msisdn, serviceCentreAddress, networkId);

if (smscPropertiesManagement != null && smscPropertiesManagement.getInCluster()) {
long currLastKey = smscPropertiesManagement.getLastKey();
if (currLastKey == 0) {
currLastKey = System.currentTimeMillis() - TimeUnit.MINUTES.toMillis(serviceCentreRequestTtl);
}

try {
List<AlertServiceRequestData> serviceCentreRequests = ClusterDBOperations.getInstance()
.c2_getServiceCenterResponses(currLastKey);
if (!serviceCentreRequests.isEmpty()) {
for (AlertServiceRequestData requestData : serviceCentreRequests) {
ISDNAddressString msisdn = requestData.getMsisdn();
AddressString serviceCentreAddress = requestData.getServiceCentreAddress();
int networkId = requestData.getNetworkId();
currLastKey = requestData.getTimestamp();
setupAlert(msisdn, serviceCentreAddress, networkId);
}
smscPropertiesManagement.setLastKey(currLastKey);
}
} catch (PersistenceException ex) {
logger.severe("Exception while trying to process AlertService notification: " + ex.getMessage(), ex);
}
smscPropertiesManagement.setLastKey(currLastKey);
}
} catch (PersistenceException ex) {
logger.severe("Exception while trying to process AlertService notification: " + ex.getMessage(), ex);
}
}

Expand Down

0 comments on commit a66e5cc

Please sign in to comment.