Remove some forced transaction closure 82/104482/1
authorGilles Thouenon <gilles.thouenon@orange.com>
Wed, 22 Feb 2023 14:42:06 +0000 (15:42 +0100)
committerGilles Thouenon <gilles.thouenon@orange.com>
Wed, 22 Feb 2023 15:40:41 +0000 (16:40 +0100)
Forcing closure of all read and write transactions prevents from
finishing executing pending code by all threads that are waiting for the
locking mechanism to release.

JIRA: TRNSPRTPCE-727
Signed-off-by: Gilles Thouenon <gilles.thouenon@orange.com>
Change-Id: Ia00aed2dd1f77aebaf291afbe077c9de96ae6608

common/src/main/java/org/opendaylight/transportpce/common/catalog/CatalogUtils.java
pce/src/main/java/org/opendaylight/transportpce/pce/gnpy/GnpyTopoImpl.java
pce/src/main/java/org/opendaylight/transportpce/pce/networkanalyzer/PceCalculation.java

index 69769705805ae58e668c5e3150fa0212dd7107e8..aa172524b5eff54b63d7b61d1748392352640931 100644 (file)
@@ -144,8 +144,6 @@ public class CatalogUtils {
             } catch (InterruptedException | ExecutionException e) {
                 LOG.error("readMdSal: Error reading Operational Mode Catalog {} , Mode does not exist", omCatalogIid);
                 throw new RuntimeException("Operational mode not populated in Catalog : " + omCatalogIid + " :" + e);
-            } finally {
-                networkTransactionService.close();
             }
         } else {
             // In other cases, means the mode is a non OpenROADM specific Operational Mode
@@ -167,8 +165,6 @@ public class CatalogUtils {
             } catch (InterruptedException | ExecutionException e) {
                 LOG.error("readMdSal: Error reading Operational Mode Catalog {} , Mode does not exist", omCatalogIid);
                 throw new RuntimeException("Operational mode not populated in Catalog : " + omCatalogIid + " :" + e);
-            } finally {
-                networkTransactionService.close();
             }
         }
         if (maxRollOff == 0) {
@@ -236,8 +232,6 @@ public class CatalogUtils {
                 throw new RuntimeException(
                     "readMdSal: Error reading from operational store, Operational Mode Catalog : "
                         + omCatalogIid + " :" + e);
-            } finally {
-                networkTransactionService.close();
             }
         } else {
             // In other cases, means the mode is a non OpenROADM specific Operational Mode
@@ -269,8 +263,6 @@ public class CatalogUtils {
                 throw new RuntimeException(
                     "readMdSal: Error reading from operational store, Operational Mode Catalog : " + omCatalogIid + " :"
                         + e);
-            } finally {
-                networkTransactionService.close();
             }
         }
         if (minOOBOsnrSingleChannelValue != null) {
@@ -334,8 +326,6 @@ public class CatalogUtils {
                 throw new RuntimeException(
                     "readMdSal: Error reading from operational store, Operational Mode Catalog : " + omCatalogIid + " :"
                         + e);
-            } finally {
-                networkTransactionService.close();
             }
         } else {
             // In other cases, means the mode is a non OpenROADM specific Operational Mode
@@ -361,8 +351,6 @@ public class CatalogUtils {
                 throw new RuntimeException(
                     "readMdSal: Error reading from operational store, Operational Mode Catalog : " + omCatalogIid + " :"
                         + e);
-            } finally {
-                networkTransactionService.close();
             }
         }
         if (penaltiesMap == null) {
@@ -502,7 +490,6 @@ public class CatalogUtils {
                     }
                     var orAddOM = omOptional.get();
                     LOG.debug("readMdSal: Operational Mode Catalog: omOptional.isPresent = true {}", orAddOM);
-                    networkTransactionService.close();
                     maxIntroducedCd = orAddOM.getMaxIntroducedCd().doubleValue();
                     // As per current OpenROADM Spec
                     //maxIntroducedPdl = orAddOM.getMaxIntroducedPdl().getValue().doubleValue();
@@ -517,8 +504,6 @@ public class CatalogUtils {
                     throw new RuntimeException(
                         "readMdSal: Error reading from operational store, Operational Mode Catalog : "
                             + omCatalogIid + " :" + e);
-                } finally {
-                    networkTransactionService.close();
                 }
                 break;
 
@@ -539,7 +524,6 @@ public class CatalogUtils {
                     }
                     var orDropOM = omOptional.get();
                     LOG.debug("readMdSal: Operational Mode Catalog: omOptional.isPresent = true {}", orDropOM);
-                    networkTransactionService.close();
                     maxIntroducedCd = orDropOM.getMaxIntroducedCd().doubleValue();
                     // As per current OpenROADM Spec
                     // maxIntroducedPdl = orDropOM.getMaxIntroducedPdl().getValue().doubleValue();
@@ -557,8 +541,6 @@ public class CatalogUtils {
                     throw new RuntimeException(
                         "readMdSal: Error reading from operational store, Operational Mode Catalog : "
                             + omCatalogIid1 + " :" + e);
-                } finally {
-                    networkTransactionService.close();
                 }
                 break;
 
@@ -604,8 +586,6 @@ public class CatalogUtils {
                     throw new RuntimeException(
                         "readMdSal: Error reading from operational store, Operational Mode Catalog : "
                             + omCatalogIid2 + " :" + e);
-                } finally {
-                    networkTransactionService.close();
                 }
                 break;
 
@@ -627,7 +607,6 @@ public class CatalogUtils {
                     }
                     var orAmpOM = omOptional.get();
                     LOG.debug("readMdSal: Operational Mode Catalog: omOptional.isPresent = true {}", orAmpOM);
-                    networkTransactionService.close();
                     maxIntroducedCd = orAmpOM.getMaxIntroducedCd().doubleValue();
                     // As per current OpenROADM Spec
                     // maxIntroducedPdl = orAmpOM.getMaxIntroducedPdl().getValue().doubleValue();
@@ -645,8 +624,6 @@ public class CatalogUtils {
                     throw new RuntimeException(
                         "readMdSal: Error reading from operational store, Operational Mode Catalog : "
                             + omCatalogIid3 + " :" + e);
-                } finally {
-                    networkTransactionService.close();
                 }
                 break;
             default:
@@ -739,7 +716,6 @@ public class CatalogUtils {
                     }
                     var orAddOM = omOptional.get();
                     LOG.debug("readMdSal: Operational Mode Catalog: omOptional.isPresent = true {}", orAddOM);
-                    networkTransactionService.close();
                     var mask = orAddOM.getMaskPowerVsPin();
                     for (Map.Entry<MaskPowerVsPinKey, MaskPowerVsPin> pw : mask.entrySet()) {
                         if (spanLoss >= pw.getKey().getLowerBoundary().doubleValue()
@@ -758,8 +734,6 @@ public class CatalogUtils {
                     throw new RuntimeException(
                         "readMdSal: Error reading from operational store, Operational Mode Catalog : "
                             + omCatalogIid + " :" + e);
-                } finally {
-                    networkTransactionService.close();
                 }
                 break;
 
@@ -806,8 +780,6 @@ public class CatalogUtils {
                     throw new RuntimeException(
                         "readMdSal: Error reading from operational store, Operational Mode Catalog : "
                             + omCatalogIid2 + " :" + e);
-                } finally {
-                    networkTransactionService.close();
                 }
                 break;
 
@@ -867,14 +839,11 @@ public class CatalogUtils {
                 LOG.error("Operational Mode catalog is not filled");
                 return false;
             }
-            networkTransactionService.close();
             return true;
         } catch (InterruptedException | ExecutionException e) {
             LOG.error("readMdSal: Error reading Operational Mode Catalog, catalog not filled");
             throw new RuntimeException(
                 "readMdSal: Error reading from operational store, Operational Mode Catalog not filled" + e);
-        } finally {
-            networkTransactionService.close();
         }
     }
 
index 8bb53215cca9dbb3353468e99ec73723f19f70ef..a213903274019f5f6b57e3f3969a708e802c8b19 100644 (file)
@@ -132,10 +132,8 @@ public class GnpyTopoImpl {
                     "In GnpyTopoImpl : openroadm topology network or openroadm network are not well mounted ...");
             }
         } catch (InterruptedException | ExecutionException e) {
-            this.networkTransactionService.close();
             throw new GnpyException("In gnpyTopoImpl: error in reading the topology", e);
         }
-        this.networkTransactionService.close();
     }
 
     private void extractElements(java.util.Optional<Network> openRoadmTopo,
index 065eab4a5918743c23081ff2ee4ed3cc6a5248ae..a61204c08f76bb5dded723360799fe9f502a5399 100644 (file)
@@ -275,11 +275,9 @@ public class PceCalculation {
             if (nwOptional.isPresent()) {
                 nw = nwOptional.get();
                 LOG.debug("readMdSal: network nodes: nwOptional.isPresent = true {}", nw);
-                networkTransactionService.close();
             }
         } catch (InterruptedException | ExecutionException e) {
             LOG.error("readMdSal: Error reading topology {}", nwInstanceIdentifier);
-            networkTransactionService.close();
             returnStructure.setRC(ResponseCodes.RESPONSE_FAILED);
         }
         return nw;