Skip to content

Commit

Permalink
Improves the method synchronization safety
Browse files Browse the repository at this point in the history
  • Loading branch information
CesarCoelho committed Oct 24, 2023
1 parent df16966 commit 68f98d2
Showing 1 changed file with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public class MALElementsRegistry {
* @param absoluteSFP The absolute short form part.
* @param callable The method with the generation of the Element.
*/
public synchronized void addCallableElement(Long absoluteSFP, Callable<Element> callable) {
public void addCallableElement(Long absoluteSFP, Callable<Element> callable) {
ELEMENTS.put(absoluteSFP, callable);
}

Expand Down Expand Up @@ -149,15 +149,15 @@ public static Element elementListToElement(ElementList obj) throws NotFoundExcep
}
}

public void registerElementsForArea(MALArea malArea) {
public synchronized void registerElementsForArea(MALArea malArea) {
Element[] elements = malArea.getElements();

for (Element element : elements) {
this.addCallableElement(element.getShortForm(), () -> element.createElement());
}
}

public void registerElementsForService(MALService malService) {
public synchronized void registerElementsForService(MALService malService) {
Element[] elements = malService.getElements();

for (Element element : elements) {
Expand Down

0 comments on commit 68f98d2

Please sign in to comment.