WIFI-540: Added more robust exception handling to prevent crashing registration thread during

cleaning up of stale records.
Also removed the base dependencies from opensync-process that are coming from opensync-ext-cloud.
This commit is contained in:
Rahul Sharma
2020-08-26 10:36:44 -04:00
parent 5867584afb
commit 01b5d7dd5e
2 changed files with 47 additions and 52 deletions

View File

@@ -411,6 +411,7 @@ public class OpensyncCloudGatewayController {
*/
protected void cleanupStaleGwRecord() {
LOG.debug("In CleanUp stale registered Gateways records ");
try {
// Get Equipment gateway list
List<EquipmentGatewayRecord> eqGwRecList = eqRoutingSvc.getGateway(GatewayType.CEGW);
if (eqGwRecList != null) {
@@ -432,6 +433,11 @@ public class OpensyncCloudGatewayController {
} else {
LOG.debug("No gateways registered with Routing Service");
}
} catch (Exception ex) { // Catching Exception to prevent crashing the register thread
LOG.debug("Generic Exception encountered when trying to cleanup " +
"the stale not-reachable GateWays. Continuing to register the new Gateway." +
" Error: {} ", ex.getMessage());
}
}
private boolean isGwReachable(String ipAddr, int port) {
@@ -518,6 +524,7 @@ public class OpensyncCloudGatewayController {
*/
protected void cleanupStaleEqptRoutingRecord(Long equipmentId) {
LOG.debug("In Clean Up stale Equipment Routing record for Equipment ID {}", equipmentId);
try {
List<EquipmentRoutingRecord> eqptRoutingRecsList = eqRoutingSvc.getRegisteredRouteList(equipmentId);
if (eqptRoutingRecsList != null) {
for (EquipmentRoutingRecord eqRouting : eqptRoutingRecsList) {
@@ -538,16 +545,16 @@ public class OpensyncCloudGatewayController {
} catch (DsEntityNotFoundException entityNotFoundException) {
LOG.debug("Gateway ID: {} not found... Deleting the equipment routing entry", eqRouting.getGatewayId());
deleteUnresponiveGwRoutingRecord(eqRouting.getId(), equipmentId);
} catch ( Exception genericException) {
LOG.debug("Generic Exception encountered when trying to query/delete " +
"the Gateway with ID: {}. Error: {} ", eqRouting.getGatewayId(), genericException.getMessage());
}
}
} else {
LOG.debug("No gateways registered with Routing Service for Equipment ID {}", equipmentId);
}
} catch (Exception genericException) { // Catching Exception to prevent crashing the register thread
LOG.debug("Generic Exception encountered when trying to cleanup " +
"the stale routing records for equipment ID: {}. Continuing to register the new RoutingRecord." +
" Error: {} ", equipmentId, genericException.getMessage());
}
}
private boolean deleteUnresponiveGwRoutingRecord(Long routingId, Long eqptId) {

View File

@@ -24,23 +24,11 @@
<artifactId>opensync-ext-cloud</artifactId>
<version>${tip-wlan-cloud.release.version}</version>
</dependency>
<dependency>
<artifactId>base-container</artifactId>
<groupId>com.telecominfraproject.wlan</groupId>
<version>${tip-wlan-cloud.release.version}</version>
</dependency>
<dependency>
<artifactId>base-client</artifactId>
<groupId>com.telecominfraproject.wlan</groupId>
<version>${tip-wlan-cloud.release.version}</version>
</dependency>
<dependency>
<artifactId>filestore-service</artifactId>
<groupId>com.telecominfraproject.wlan</groupId>
<version>${tip-wlan-cloud.release.version}</version>
</dependency>
<dependency>
<artifactId>customer-service-remote</artifactId>
<groupId>com.telecominfraproject.wlan</groupId>