summaryrefslogtreecommitdiffstats
path: root/controlloop/common/eventmanager/src/main
diff options
context:
space:
mode:
Diffstat (limited to 'controlloop/common/eventmanager/src/main')
-rw-r--r--controlloop/common/eventmanager/src/main/java/org/onap/policy/controlloop/eventmanager/ControlLoopOperationManager2.java2
-rw-r--r--controlloop/common/eventmanager/src/main/java/org/onap/policy/controlloop/ophistory/OperationHistoryDataManager.java3
-rw-r--r--controlloop/common/eventmanager/src/main/java/org/onap/policy/controlloop/ophistory/OperationHistoryDataManagerImpl.java16
-rw-r--r--controlloop/common/eventmanager/src/main/java/org/onap/policy/controlloop/ophistory/OperationHistoryDataManagerStub.java3
4 files changed, 17 insertions, 7 deletions
diff --git a/controlloop/common/eventmanager/src/main/java/org/onap/policy/controlloop/eventmanager/ControlLoopOperationManager2.java b/controlloop/common/eventmanager/src/main/java/org/onap/policy/controlloop/eventmanager/ControlLoopOperationManager2.java
index 156dad7e6..a096522bc 100644
--- a/controlloop/common/eventmanager/src/main/java/org/onap/policy/controlloop/eventmanager/ControlLoopOperationManager2.java
+++ b/controlloop/common/eventmanager/src/main/java/org/onap/policy/controlloop/eventmanager/ControlLoopOperationManager2.java
@@ -585,7 +585,7 @@ public class ControlLoopOperationManager2 implements Serializable {
* Stores the latest operation in the DB.
*/
private void storeOperationInDataBase() {
- operContext.getDataManager().store(requestId, eventContext.getEvent(),
+ operContext.getDataManager().store(requestId, eventContext.getEvent(), targetEntity,
operationHistory.peekLast().getClOperation());
}
diff --git a/controlloop/common/eventmanager/src/main/java/org/onap/policy/controlloop/ophistory/OperationHistoryDataManager.java b/controlloop/common/eventmanager/src/main/java/org/onap/policy/controlloop/ophistory/OperationHistoryDataManager.java
index a1774ea6f..091c38ef3 100644
--- a/controlloop/common/eventmanager/src/main/java/org/onap/policy/controlloop/ophistory/OperationHistoryDataManager.java
+++ b/controlloop/common/eventmanager/src/main/java/org/onap/policy/controlloop/ophistory/OperationHistoryDataManager.java
@@ -34,9 +34,10 @@ public interface OperationHistoryDataManager {
*
* @param requestId request ID
* @param event event with which the operation is associated
+ * @param targetEntity target entity associated with the operation
* @param operation operation to be stored
*/
- void store(String requestId, VirtualControlLoopEvent event, ControlLoopOperation operation);
+ void store(String requestId, VirtualControlLoopEvent event, String targetEntity, ControlLoopOperation operation);
/**
* Starts the background thread.
diff --git a/controlloop/common/eventmanager/src/main/java/org/onap/policy/controlloop/ophistory/OperationHistoryDataManagerImpl.java b/controlloop/common/eventmanager/src/main/java/org/onap/policy/controlloop/ophistory/OperationHistoryDataManagerImpl.java
index f7576f139..5de38a4c3 100644
--- a/controlloop/common/eventmanager/src/main/java/org/onap/policy/controlloop/ophistory/OperationHistoryDataManagerImpl.java
+++ b/controlloop/common/eventmanager/src/main/java/org/onap/policy/controlloop/ophistory/OperationHistoryDataManagerImpl.java
@@ -110,6 +110,8 @@ public class OperationHistoryDataManagerImpl implements OperationHistoryDataMana
return;
}
+ logger.info("start operation history thread");
+
thread = makeThread(emFactory, this::run);
thread.setDaemon(true);
thread.start();
@@ -117,6 +119,8 @@ public class OperationHistoryDataManagerImpl implements OperationHistoryDataMana
@Override
public synchronized void stop() {
+ logger.info("requesting stop of operation history thread");
+
stopped = true;
if (thread == null) {
@@ -130,7 +134,8 @@ public class OperationHistoryDataManagerImpl implements OperationHistoryDataMana
}
@Override
- public synchronized void store(String requestId, VirtualControlLoopEvent event, ControlLoopOperation operation) {
+ public synchronized void store(String requestId, VirtualControlLoopEvent event, String targetEntity,
+ ControlLoopOperation operation) {
if (stopped) {
logger.warn("operation history thread is stopped, discarding requestId={} event={} operation={}", requestId,
@@ -138,7 +143,7 @@ public class OperationHistoryDataManagerImpl implements OperationHistoryDataMana
return;
}
- operations.add(new Record(requestId, event, operation));
+ operations.add(new Record(requestId, event, targetEntity, operation));
if (operations.size() > maxQueueLength) {
Record discarded = operations.remove();
@@ -204,6 +209,7 @@ public class OperationHistoryDataManagerImpl implements OperationHistoryDataMana
* @param firstRecord first record to be stored
*/
private void storeBatch(EntityManager entityManager, Record firstRecord) {
+ logger.info("store operation history record batch");
try (EntityMgrCloser emc = new EntityMgrCloser(entityManager);
EntityTransCloser trans = new EntityTransCloser(entityManager.getTransaction())) {
@@ -233,17 +239,18 @@ public class OperationHistoryDataManagerImpl implements OperationHistoryDataMana
* @param record record to be stored
*/
private void storeRecord(EntityManager entityMgr, Record record) {
-
Dbao newEntry = new Dbao();
final VirtualControlLoopEvent event = record.getEvent();
final ControlLoopOperation operation = record.getOperation();
+ logger.info("store operation history record for {}", event.getRequestId());
+
newEntry.setClosedLoopName(event.getClosedLoopControlName());
newEntry.setRequestId(record.getRequestId());
newEntry.setActor(operation.getActor());
newEntry.setOperation(operation.getOperation());
- newEntry.setTarget(operation.getTarget());
+ newEntry.setTarget(record.getTargetEntity());
newEntry.setSubrequestId(operation.getSubRequestId());
newEntry.setMessage(operation.getMessage());
newEntry.setOutcome(operation.getOutcome());
@@ -280,6 +287,7 @@ public class OperationHistoryDataManagerImpl implements OperationHistoryDataMana
private static class Record {
private String requestId;
private VirtualControlLoopEvent event;
+ private String targetEntity;
private ControlLoopOperation operation;
}
diff --git a/controlloop/common/eventmanager/src/main/java/org/onap/policy/controlloop/ophistory/OperationHistoryDataManagerStub.java b/controlloop/common/eventmanager/src/main/java/org/onap/policy/controlloop/ophistory/OperationHistoryDataManagerStub.java
index e1e0cbe09..bd2ee043c 100644
--- a/controlloop/common/eventmanager/src/main/java/org/onap/policy/controlloop/ophistory/OperationHistoryDataManagerStub.java
+++ b/controlloop/common/eventmanager/src/main/java/org/onap/policy/controlloop/ophistory/OperationHistoryDataManagerStub.java
@@ -29,7 +29,8 @@ import org.onap.policy.controlloop.VirtualControlLoopEvent;
public class OperationHistoryDataManagerStub implements OperationHistoryDataManager {
@Override
- public void store(String requestId, VirtualControlLoopEvent event, ControlLoopOperation operation) {
+ public void store(String requestId, VirtualControlLoopEvent event, String targetEntity,
+ ControlLoopOperation operation) {
// do nothing
}