[ECOMMERCE-97] Don't create new instance of SphereClient when has been already created Created: 28/Jan/19  Updated: 07/Feb/19  Resolved: 07/Feb/19

Status: Closed
Project: E-commerce
Component/s: None
Affects Version/s: None
Fix Version/s: 1.0

Type: Improvement Priority: Neutral
Reporter: Antonín Juran Assignee: Antonín Juran
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
relation
is related to ECOMMERCE-53 Implement REST connection to Commerce... Closed
Template:
Acceptance criteria:
Empty
Task DoD:
[ ]* Doc/release notes changes? Comment present?
[ ]* Downstream builds green?
[ ]* Solution information and context easily available?
[ ]* Tests
[ ]* FixVersion filled and not yet released
[ ]  Architecture Decision Record (ADR)
Date of First Response:
Epic Link: Access the product catalogs
Sprint: Add-Ons 4
Story Points: 3

 Description   

get method in SphereClientUtil class creates new instance of SphereClient every time it's called. Reimplement the method to reuse already created client instance(s) (singleton pattern).

SphereClient should not be returned if conection test fails (see info.magnolia.commercetools.integration.CommercetoolsIntegrationModule#start)

 

 

 



 Comments   
Comment by Oanh Thai Hoang [ 31/Jan/19 ]

Additional things for improvement: Check null for parameter map

Caused by: java.lang.NullPointerExceptionCaused by: java.lang.NullPointerException at info.magnolia.ecommerce.provider.commercetool.util.SphereClientUtil.get(SphereClientUtil.java:34) ~[magnolia-ecommerce-commerce-tool-connector-1.0-SNAPSHOT.jar:?] at info.magnolia.ecommerce.provider.commercetool.service.categories.All.fetch(All.java:50) ~[magnolia-ecommerce-commerce-tool-connector-1.0-SNAPSHOT.jar:?]

Generated at Mon Feb 12 01:40:50 CET 2024 using Jira 9.4.2#940002-sha1:46d1a51de284217efdcb32434eab47a99af2938b.