-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
update #3
base: main
Are you sure you want to change the base?
Conversation
@GeneratedValue(strategy = GenerationType.IDENTITY) | ||
private Long productId; | ||
@Id | ||
@GeneratedValue(strategy = GenerationType.IDENTITY) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
better to use sequence
} | ||
@Override | ||
public int hashCode() { | ||
return getClass().hashCode(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not a good idea. equals and hashcode should be interconnected. please use the same fields
@@ -9,26 +9,27 @@ | |||
import lombok.extern.slf4j.Slf4j; | |||
import org.springframework.stereotype.Service; | |||
|
|||
|
|||
@Service | |||
@RequiredArgsConstructor | |||
@Slf4j | |||
public class ProductFacade implements ProductUniquenessFacade { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
better to make package-private to not allow others to use it
@@ -8,22 +8,23 @@ | |||
import lombok.extern.slf4j.Slf4j; | |||
import org.springframework.stereotype.Service; | |||
|
|||
|
|||
@Service | |||
@RequiredArgsConstructor | |||
@Slf4j | |||
public class ProductService implements ProductDomainService { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
better to make package-private
} | ||
public MetricsService(MeterRegistry registry) { | ||
log.info("Registering product countMetric into the Prometheus."); | ||
Gauge.builder("product_counter", fetchProductCount()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
let's use Counter instead
@@ -7,23 +7,24 @@ | |||
import java.util.Set; | |||
import java.util.concurrent.ConcurrentHashMap; | |||
|
|||
|
|||
@RequiredArgsConstructor | |||
@Slf4j | |||
@Service | |||
public class ProductCounterService { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why?
log.info("Checking if the product is unique in the in memory counter {}", productDto.getName()); | ||
var productCounter = ProductCounterService.getProductCounter(); | ||
@Override | ||
public ResponseMessage countProducts(ProductDto productDto) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the name is not good. maybe create is better name
No description provided.