Skip to content

Conversation

@lalaji
Copy link
Member

@lalaji lalaji commented Oct 1, 2025

Pull Request Title

Explain in a few lines the purpose of this pull request

Issue link: required

Doc Issue: Optional, link issue from documentation repository

Applicable Labels: Spec, product, version, type (specify requested labels)


Development Checklist

  1. Build complete solution with pull request in place.
  2. Ran checkstyle plugin with pull request in place.
  3. Ran Findbugs plugin with pull request in place.
  4. Ran FindSecurityBugs plugin and verified report.
  5. Formatted code according to WSO2 code style.
  6. Have you verified the PR doesn't commit any keys, passwords, tokens, usernames, or other secrets?
  7. Migration scripts written (if applicable).
  8. Have you followed secure coding standards in WSO2 Secure Engineering Guidelines?

Testing Checklist

  1. Written unit tests.
  2. Verified tests in multiple database environments (if applicable).
  3. Tested with BI enabled (if applicable).

Comment on lines 143 to 146
buildFSEventExecutors();
} catch (IOException | XMLStreamException | OMException e) {
throw new FinancialServicesRuntimeException("Error occurred while building configuration from " +
"financial-services.xml", e);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Log Improvement Suggestion No: 1

Suggested change
buildFSEventExecutors();
} catch (IOException | XMLStreamException | OMException e) {
throw new FinancialServicesRuntimeException("Error occurred while building configuration from " +
"financial-services.xml", e);
} catch (IOException | XMLStreamException | OMException e) {
log.error("Error occurred while building configuration from financial-services.xml", e.getMessage());
throw new FinancialServicesRuntimeException("Error occurred while building configuration from " +
"financial-services.xml", e);

Comment on lines 213 to 214
private void buildFSEventExecutors() {

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Log Improvement Suggestion No: 2

Suggested change
private void buildFSEventExecutors() {
private void buildFSEventExecutors() {
log.debug("Building Financial Services Event Executors configuration");

Comment on lines 237 to 241

if (StringUtils.isEmpty(obExecutorClass)) {
//Throwing exceptions since we cannot proceed without invalid executor names
throw new FinancialServicesRuntimeException("Event Executor class is not defined " +
"correctly in open-banking.xml");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Log Improvement Suggestion No: 3

Suggested change
if (StringUtils.isEmpty(obExecutorClass)) {
//Throwing exceptions since we cannot proceed without invalid executor names
throw new FinancialServicesRuntimeException("Event Executor class is not defined " +
"correctly in open-banking.xml");
if (StringUtils.isEmpty(obExecutorClass)) {
log.error("Event Executor class is not defined correctly in open-banking.xml");
//Throwing exceptions since we cannot proceed without invalid executor names
throw new FinancialServicesRuntimeException("Event Executor class is not defined " +
"correctly in open-banking.xml");

Comment on lines +246 to +247
}
fsEventExecutors.put(priority, obExecutorClass);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Log Improvement Suggestion No: 4

Suggested change
}
fsEventExecutors.put(priority, obExecutorClass);
}
fsEventExecutors.put(priority, obExecutorClass);
log.debug("Added event executor: {} with priority: {}", obExecutorClass, priority);

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added

Comment on lines 317 to 318
protected void buildDataPublishingStreams() {

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Log Improvement Suggestion No: 5

Suggested change
protected void buildDataPublishingStreams() {
protected void buildDataPublishingStreams() {
log.debug("Building Data Publishing Streams configuration");

Comment on lines 352 to 357

if (StringUtils.isEmpty(attributeName)) {
//Throwing exceptions since we cannot proceed without valid attribute names
throw new FinancialServicesRuntimeException(
"Data publishing attribute name is not defined " +
"correctly in financial-services.xml");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Log Improvement Suggestion No: 6

Suggested change
if (StringUtils.isEmpty(attributeName)) {
//Throwing exceptions since we cannot proceed without valid attribute names
throw new FinancialServicesRuntimeException(
"Data publishing attribute name is not defined " +
"correctly in financial-services.xml");
if (StringUtils.isEmpty(attributeName)) {
log.error("Data publishing attribute name is not defined correctly in financial-services.xml");
//Throwing exceptions since we cannot proceed without valid attribute names
throw new FinancialServicesRuntimeException(
"Data publishing attribute name is not defined " +
"correctly in financial-services.xml");

Comment on lines +378 to +379
String attributeKey = dataStreamName + "_" + attributeName;
dataPublishingValidationMap.put(attributeKey, metadata);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Log Improvement Suggestion No: 7

Suggested change
String attributeKey = dataStreamName + "_" + attributeName;
dataPublishingValidationMap.put(attributeKey, metadata);
}
}
if (log.isDebugEnabled()) {
log.debug("Added data publishing stream: {} with {} attributes", dataStreamName, attributes.size());
}

Comment on lines 27 to 30

@Override
public void processEvent(FSEvent fsEvent) {

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Log Improvement Suggestion No: 8

Suggested change
@Override
public void processEvent(FSEvent fsEvent) {
@Override
public void processEvent(FSEvent fsEvent) {
log.debug("Processing FSEvent: {}", fsEvent);
}

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added

Comment on lines 42 to 47

public FSEventQueue(int queueSize, int workerThreadCount) {

// Note : Using a fixed worker thread pool and a bounded queue to control the load on the server
executorService = Executors.newFixedThreadPool(workerThreadCount);
eventQueue = new ArrayBlockingQueue<>(queueSize);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Log Improvement Suggestion No: 9

Suggested change
public FSEventQueue(int queueSize, int workerThreadCount) {
// Note : Using a fixed worker thread pool and a bounded queue to control the load on the server
executorService = Executors.newFixedThreadPool(workerThreadCount);
eventQueue = new ArrayBlockingQueue<>(queueSize);
public FSEventQueue(int queueSize, int workerThreadCount) {
log.info("Initializing FSEventQueue with queue size: " + queueSize + " and worker threads: " + workerThreadCount);
// Note : Using a fixed worker thread pool and a bounded queue to control the load on the server
executorService = Executors.newFixedThreadPool(workerThreadCount);
eventQueue = new ArrayBlockingQueue<>(queueSize);

Comment on lines 49 to 56

public void put(FSEvent obEvent) {

try {
if (eventQueue.offer(obEvent)) {
executorService.submit(new FSQueueWorker(eventQueue, executorService));
} else {
log.error("Event queue is full. Starting to drop events.");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Log Improvement Suggestion No: 10

Suggested change
public void put(FSEvent obEvent) {
try {
if (eventQueue.offer(obEvent)) {
executorService.submit(new FSQueueWorker(eventQueue, executorService));
} else {
log.error("Event queue is full. Starting to drop events.");
public void put(FSEvent obEvent) {
if (log.isDebugEnabled()) {
log.debug("Attempting to add event to queue");
}
try {
if (eventQueue.offer(obEvent)) {
executorService.submit(new FSQueueWorker(eventQueue, executorService));
} else {
log.error("Event queue is full. Starting to drop events.");

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added

Comment on lines 58 to 65
} catch (RejectedExecutionException e) {
log.warn("Task submission failed. Task queue might be full", e);
}
}

@Override
protected void finalize() throws Throwable {
executorService.shutdown();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Log Improvement Suggestion No: 11

Suggested change
} catch (RejectedExecutionException e) {
log.warn("Task submission failed. Task queue might be full", e);
}
}
@Override
protected void finalize() throws Throwable {
executorService.shutdown();
log.warn("Task submission failed. Task queue might be full", e);
}
}
@Override
protected void finalize() throws Throwable {
log.info("Shutting down FSEventQueue executor service");
executorService.shutdown();
super.finalize();

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added

this.executorService = executorService;
}

@Override
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Log Improvement Suggestion No: 12

Suggested change
@Override
@Override
public void run() {
log.info("FSQueueWorker started processing events");

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added

Comment on lines +55 to +56
do {
FSEvent event = eventQueue.poll();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Log Improvement Suggestion No: 13

Suggested change
do {
FSEvent event = eventQueue.poll();
FSEvent event = eventQueue.poll();
if (event != null) {
if (log.isDebugEnabled()) {
log.debug("Processing FSEvent from queue");
}

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

added

Comment on lines +62 to +63
.getClassInstanceFromFQN(fsEventExecutors.get(integer))).collect(Collectors.toList());
for (FSEventExecutor obEventExecutor : executorList) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Log Improvement Suggestion No: 14

Suggested change
.getClassInstanceFromFQN(fsEventExecutors.get(integer))).collect(Collectors.toList());
for (FSEventExecutor obEventExecutor : executorList) {
for (FSEventExecutor obEventExecutor : executorList) {
if (log.isDebugEnabled()) {
log.debug("Executing event with executor: " + obEventExecutor.getClass().getSimpleName());
}
obEventExecutor.processEvent(event);

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added

Comment on lines +65 to +66
}
} else {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Log Improvement Suggestion No: 15

Suggested change
}
} else {
} else {
log.warn("Polled null event from queue, skipping processing");

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Already there's an error log

Comment on lines 30 to 34

public FSEvent(String eventType, Map<String, Object> eventData) {

this.eventType = eventType;
this.eventData = eventData;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Log Improvement Suggestion No: 16

Suggested change
public FSEvent(String eventType, Map<String, Object> eventData) {
this.eventType = eventType;
this.eventData = eventData;
public FSEvent(String eventType, Map<String, Object> eventData) {
log.debug("Creating FSEvent with type: {}", eventType);
this.eventType = eventType;
this.eventData = eventData;
}

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added

private PoolingHttpClientConnectionManager connectionManager;
private FSEventQueue fsEventQueue;
private Map<Integer, String> fsEventExecutors;

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Log Improvement Suggestion No: 17

Suggested change
private FinancialServicesCommonDataHolder() {
log.info("Initializing FinancialServicesCommonDataHolder");

int workerThreadCount =
Integer.parseInt((String) FinancialServicesConfigParser.getInstance().getConfiguration()
.get(FinancialServicesConstants.EVENT_WORKER_THREAD_COUNT));
fsEventQueue = new FSEventQueue(queueSize, workerThreadCount);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Log Improvement Suggestion No: 18

Suggested change
fsEventQueue = new FSEventQueue(queueSize, workerThreadCount);
fsEventQueue = new FSEventQueue(queueSize, workerThreadCount);
log.info("Initialized FSEventQueue with queue size: " + queueSize + " and worker thread count: " + workerThreadCount);

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added as a debug log

Integer.parseInt((String) FinancialServicesConfigParser.getInstance().getConfiguration()
.get(FinancialServicesConstants.EVENT_WORKER_THREAD_COUNT));
fsEventQueue = new FSEventQueue(queueSize, workerThreadCount);
fsEventExecutors = FinancialServicesConfigParser.getInstance().getFinancialServicesEventExecutors();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Log Improvement Suggestion No: 19

Suggested change
fsEventExecutors = FinancialServicesConfigParser.getInstance().getFinancialServicesEventExecutors();
fsEventExecutors = FinancialServicesConfigParser.getInstance().getFinancialServicesEventExecutors();
if (log.isDebugEnabled()) {
log.debug("Loaded " + fsEventExecutors.size() + " event executors");
}

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added as a debug log

Comment on lines 108 to 109
consentPersist(consentPersistData, consentResource);
ConsentAuthorizeUtil.publishConsentApprovalStatus(consentPersistData);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Log Improvement Suggestion No: 20

Suggested change
consentPersist(consentPersistData, consentResource);
ConsentAuthorizeUtil.publishConsentApprovalStatus(consentPersistData);
consentPersist(consentPersistData, consentResource);
log.info("Consent persisted successfully for consent ID: " + consentResource.getConsentID());
ConsentAuthorizeUtil.publishConsentApprovalStatus(consentPersistData);

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added as a debug log

Comment on lines 188 to 189
persistConsent(responseConsentResource, consentData);
ConsentAuthorizeUtil.publishConsentApprovalStatus(consentPersistData);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Log Improvement Suggestion No: 21

Suggested change
persistConsent(responseConsentResource, consentData);
ConsentAuthorizeUtil.publishConsentApprovalStatus(consentPersistData);
ExternalAPIConsentResourceResponseDTO responseConsentResource = responseDTO.getConsentResource();
persistConsent(responseConsentResource, consentData);
log.info("Consent persisted successfully for consent ID: " + consentData.getConsentId());
ConsentAuthorizeUtil.publishConsentApprovalStatus(consentPersistData);

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added as a debug log.

Comment on lines 190 to 191

} catch (FinancialServicesException e) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Log Improvement Suggestion No: 22

Suggested change
} catch (FinancialServicesException e) {
} catch (FinancialServicesException e) {
log.error("Failed to persist consent: " + e.getMessage());

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added

Comment on lines 676 to 677
public static void publishConsentApprovalStatus(ConsentPersistData consentPersistData) {
if (Boolean.parseBoolean((String) FinancialServicesConfigParser.getInstance().getConfiguration()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Log Improvement Suggestion No: 23

Suggested change
public static void publishConsentApprovalStatus(ConsentPersistData consentPersistData) {
if (Boolean.parseBoolean((String) FinancialServicesConfigParser.getInstance().getConfiguration()
public static void publishConsentApprovalStatus(ConsentPersistData consentPersistData) {
log.info("Publishing consent approval status for consent: " + consentPersistData.getConsentData().getConsentId());
if (Boolean.parseBoolean((String) FinancialServicesConfigParser.getInstance().getConfiguration()

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added as a debug log

Comment on lines 702 to 703
FSDataPublisherUtil.publishData("", "", consentAuthorizationData);
} else {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Log Improvement Suggestion No: 24

Suggested change
FSDataPublisherUtil.publishData("", "", consentAuthorizationData);
} else {
FSDataPublisherUtil.publishData("", "", consentAuthorizationData);
log.debug("Successfully published consent authorization data for consent: " + consentData.getConsentId());
} else {

Comment on lines +735 to +739

if (StringUtils.isBlank(requestUri)) {
log.error("Request URI not found.");
return null;
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Log Improvement Suggestion No: 25

Suggested change
if (StringUtils.isBlank(requestUri)) {
log.error("Request URI not found.");
return null;
}
if (StringUtils.isBlank(requestUri)) {
log.error("Request URI not found.");
return null;
}
if (log.isDebugEnabled()) {
log.debug("Extracting request URI key from request URI");
}

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added

Comment on lines +742 to +744
String requestUriKey = uriParts[uriParts.length - 1];

return StringUtils.isBlank(requestUriKey) ? null : requestUriKey;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Log Improvement Suggestion No: 26

Suggested change
String requestUriKey = uriParts[uriParts.length - 1];
return StringUtils.isBlank(requestUriKey) ? null : requestUriKey;
String requestUriKey = uriParts[uriParts.length - 1];
if (StringUtils.isBlank(requestUriKey)) {
log.warn("Request URI key is blank after extraction");
}
return StringUtils.isBlank(requestUriKey) ? null : requestUriKey;

Comment on lines 65 to 68
@Override
public void processEvent(FSEvent fsEvent) {

Map<String, Object> eventData = fsEvent.getEventData();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Log Improvement Suggestion No: 27

Suggested change
@Override
public void processEvent(FSEvent fsEvent) {
Map<String, Object> eventData = fsEvent.getEventData();
@Override
public void processEvent(FSEvent fsEvent) {
log.info("Processing consent lifecycle event");
Map<String, Object> eventData = fsEvent.getEventData();

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added as a debug log.

Comment on lines 78 to 79
log.debug("Publishing consent data for metrics.");

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Log Improvement Suggestion No: 28

Suggested change
log.debug("Publishing consent data for metrics.");
String consentId = (String) eventData.get(CONSENT_ID);
log.info("Processing consent lifecycle event for consent ID: " + consentId);
String primaryUserId;

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added as a debug log.

Comment on lines +82 to +84
try {
primaryUserId = getPrimaryUserForConsent(detailedConsentResource, consentId);
} catch (ConsentManagementException e) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Log Improvement Suggestion No: 29

Suggested change
try {
primaryUserId = getPrimaryUserForConsent(detailedConsentResource, consentId);
} catch (ConsentManagementException e) {
} catch (ConsentManagementException e) {
log.error("Error while trying to retrieve consent data: " + e.getMessage());
return;

Comment on lines +87 to +89
}

if (StringUtils.isBlank(primaryUserId)) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Log Improvement Suggestion No: 30

Suggested change
}
if (StringUtils.isBlank(primaryUserId)) {
if (StringUtils.isBlank(primaryUserId)) {
log.warn("Primary user ID is blank for consent ID: " + consentId);
return;

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added as a debug log

Comment on lines +110 to +112
}
publishedEventIdentifierCache.put(eventIdentifier, Boolean.TRUE);
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Log Improvement Suggestion No: 31

Suggested change
}
publishedEventIdentifierCache.put(eventIdentifier, Boolean.TRUE);
}
}
}
log.info("Publishing consent lifecycle data for consent ID: " + consentId);
//publish consent lifecycle data

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added as a debug log

Comment on lines +131 to +134
}
}

private String getPrimaryUserForConsent(DetailedConsentResource detailedConsentResource, String consentId)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Log Improvement Suggestion No: 32

Suggested change
}
}
private String getPrimaryUserForConsent(DetailedConsentResource detailedConsentResource, String consentId)
private String getPrimaryUserForConsent(DetailedConsentResource detailedConsentResource, String consentId)
throws ConsentManagementException {
if (log.isDebugEnabled()) {
log.debug("Retrieving primary user for consent ID: " + consentId);
}
String primaryUser = null;

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added.

Comment on lines 34 to 38
@Override
public FinancialServicesDataPublisher create() {

return (FinancialServicesDataPublisher) FSAnalyticsDataHolder.getInstance().getFinancialServicesDataPublisher();
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Log Improvement Suggestion No: 33

Suggested change
@Override
public FinancialServicesDataPublisher create() {
return (FinancialServicesDataPublisher) FSAnalyticsDataHolder.getInstance().getFinancialServicesDataPublisher();
}
@Override
public FinancialServicesDataPublisher create() {
log.debug("Creating new FinancialServicesDataPublisher instance");
return (FinancialServicesDataPublisher) FSAnalyticsDataHolder.getInstance().getFinancialServicesDataPublisher();
}

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added

Comment on lines 40 to 45
@Override
public PooledObject<FinancialServicesDataPublisher> wrap(FinancialServicesDataPublisher
financialServicesDataPublisher) {

return new DefaultPooledObject<FinancialServicesDataPublisher>(financialServicesDataPublisher);
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Log Improvement Suggestion No: 34

Suggested change
@Override
public PooledObject<FinancialServicesDataPublisher> wrap(FinancialServicesDataPublisher
financialServicesDataPublisher) {
return new DefaultPooledObject<FinancialServicesDataPublisher>(financialServicesDataPublisher);
}
@Override
public PooledObject<FinancialServicesDataPublisher> wrap(FinancialServicesDataPublisher
financialServicesDataPublisher) {
log.debug("Wrapping FinancialServicesDataPublisher instance in pooled object");
return new DefaultPooledObject<FinancialServicesDataPublisher>(financialServicesDataPublisher);
}

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added

Comment on lines 28 to 36
*/
public class DataPublisherPool<FinancialServicesDataPublisher> extends
GenericObjectPool<FinancialServicesDataPublisher> {

public DataPublisherPool(PooledObjectFactory<FinancialServicesDataPublisher> factory,
GenericObjectPoolConfig<FinancialServicesDataPublisher> config) {

super(factory, config);
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Log Improvement Suggestion No: 35

Suggested change
*/
public class DataPublisherPool<FinancialServicesDataPublisher> extends
GenericObjectPool<FinancialServicesDataPublisher> {
public DataPublisherPool(PooledObjectFactory<FinancialServicesDataPublisher> factory,
GenericObjectPoolConfig<FinancialServicesDataPublisher> config) {
super(factory, config);
}
public class DataPublisherPool<FinancialServicesDataPublisher> extends
GenericObjectPool<FinancialServicesDataPublisher> {
private static final Log log = LogFactory.getLog(DataPublisherPool.class);
public DataPublisherPool(PooledObjectFactory<FinancialServicesDataPublisher> factory,
GenericObjectPoolConfig<FinancialServicesDataPublisher> config) {
super(factory, config);
log.info("DataPublisherPool initialized with max total: " + config.getMaxTotal() +
", max idle: " + config.getMaxIdle());
}

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changed to a debug log

Comment on lines 40 to 45
public EventQueue(int queueSize, int workerThreadCount) {

// Note : Using a fixed worker thread pool and a bounded queue to control the load on the server
publisherExecutorService = Executors.newFixedThreadPool(workerThreadCount);
eventQueue = new ArrayBlockingQueue<>(queueSize);
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Log Improvement Suggestion No: 36

Suggested change
public EventQueue(int queueSize, int workerThreadCount) {
// Note : Using a fixed worker thread pool and a bounded queue to control the load on the server
publisherExecutorService = Executors.newFixedThreadPool(workerThreadCount);
eventQueue = new ArrayBlockingQueue<>(queueSize);
}
public EventQueue(int queueSize, int workerThreadCount) {
log.info("Initializing EventQueue with queueSize: " + queueSize + " and workerThreadCount: " + workerThreadCount);
// Note : Using a fixed worker thread pool and a bounded queue to control the load on the server
publisherExecutorService = Executors.newFixedThreadPool(workerThreadCount);
eventQueue = new ArrayBlockingQueue<>(queueSize);
}

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changed to a debug log

Comment on lines 47 to 57
public void put(FSAnalyticsEvent fsAnalyticsEvent) {

try {
if (eventQueue.offer(fsAnalyticsEvent)) {
publisherExecutorService.submit(new QueueWorker(eventQueue, publisherExecutorService));
} else {
log.error("Event queue is full. Starting to drop OB analytics events.");
}
} catch (RejectedExecutionException e) {
log.warn("Task submission failed. Task queue might be full", e);
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Log Improvement Suggestion No: 37

Suggested change
public void put(FSAnalyticsEvent fsAnalyticsEvent) {
try {
if (eventQueue.offer(fsAnalyticsEvent)) {
publisherExecutorService.submit(new QueueWorker(eventQueue, publisherExecutorService));
} else {
log.error("Event queue is full. Starting to drop OB analytics events.");
}
} catch (RejectedExecutionException e) {
log.warn("Task submission failed. Task queue might be full", e);
}
public void put(FSAnalyticsEvent fsAnalyticsEvent) {
if (log.isDebugEnabled()) {
log.debug("Attempting to add analytics event to queue");
}
try {
if (eventQueue.offer(fsAnalyticsEvent)) {
publisherExecutorService.submit(new QueueWorker(eventQueue, publisherExecutorService));
} else {
log.error("Event queue is full. Starting to drop OB analytics events.");
}
} catch (RejectedExecutionException e) {
log.warn("Task submission failed. Task queue might be full", e);
}
}

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

added,without isDebugEnabled check

Comment on lines 59 to 63

@Override
protected void finalize() throws Throwable {
publisherExecutorService.shutdown();
super.finalize();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Log Improvement Suggestion No: 38

Suggested change
@Override
protected void finalize() throws Throwable {
publisherExecutorService.shutdown();
super.finalize();
@Override
protected void finalize() throws Throwable {
log.info("Shutting down publisher executor service");
publisherExecutorService.shutdown();
super.finalize();
}

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added as a debug log

Comment on lines 55 to 57

public FinancialServicesThriftDataPublisher() {
this.init();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Log Improvement Suggestion No: 39

Suggested change
public FinancialServicesThriftDataPublisher() {
this.init();
public FinancialServicesThriftDataPublisher() {
log.info("Initializing FinancialServicesThriftDataPublisher");
this.init();
}

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added as a debug log

Comment on lines +59 to +60

@Override
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Log Improvement Suggestion No: 40

Suggested change
@Override
@Override
public void publish(String streamName, String streamVersion, Map<String, Object> analyticsData) {
if (log.isDebugEnabled()) {
log.debug("Publishing data for stream: " + streamName + " with version: " + streamVersion);
}

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

Copy link
Contributor

@wso2-engineering wso2-engineering bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AI Agent Log Improvement Checklist

⚠️ Warning: AI-Generated Review Comments

  • The log-related comments and suggestions in this review were generated by an AI tool to assist with identifying potential improvements. Purpose of reviewing the code for log improvements is to improve the troubleshooting capabilities of our products.
  • Please make sure to manually review and validate all suggestions before applying any changes. Not every code suggestion would make sense or add value to our purpose. Therefore, you have the freedom to decide which of the suggestions are helpful.

✅ Before merging this pull request:

  • Review all AI-generated comments for accuracy and relevance.
  • Complete and verify the table below. We need your feedback to measure the accuracy of these suggestions and the value they add. If you are rejecting a certain code suggestion, please mention the reason briefly in the suggestion for us to capture it.
Comment Accepted (Y/N) Reason
#### Log Improvement Suggestion No: 1
#### Log Improvement Suggestion No: 2
#### Log Improvement Suggestion No: 3
#### Log Improvement Suggestion No: 4
#### Log Improvement Suggestion No: 5
#### Log Improvement Suggestion No: 6
#### Log Improvement Suggestion No: 7
#### Log Improvement Suggestion No: 8
#### Log Improvement Suggestion No: 9
#### Log Improvement Suggestion No: 10
#### Log Improvement Suggestion No: 11
#### Log Improvement Suggestion No: 12
#### Log Improvement Suggestion No: 13
#### Log Improvement Suggestion No: 14
#### Log Improvement Suggestion No: 15
#### Log Improvement Suggestion No: 16
#### Log Improvement Suggestion No: 17
#### Log Improvement Suggestion No: 18
#### Log Improvement Suggestion No: 19
#### Log Improvement Suggestion No: 20
#### Log Improvement Suggestion No: 21
#### Log Improvement Suggestion No: 22
#### Log Improvement Suggestion No: 23
#### Log Improvement Suggestion No: 24
#### Log Improvement Suggestion No: 25
#### Log Improvement Suggestion No: 26
#### Log Improvement Suggestion No: 27
#### Log Improvement Suggestion No: 28
#### Log Improvement Suggestion No: 29
#### Log Improvement Suggestion No: 30
#### Log Improvement Suggestion No: 31
#### Log Improvement Suggestion No: 32
#### Log Improvement Suggestion No: 33
#### Log Improvement Suggestion No: 34
#### Log Improvement Suggestion No: 35
#### Log Improvement Suggestion No: 36
#### Log Improvement Suggestion No: 37
#### Log Improvement Suggestion No: 38
#### Log Improvement Suggestion No: 39
#### Log Improvement Suggestion No: 40

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant