aboutsummaryrefslogtreecommitdiffstats
path: root/feature-session-persistence
diff options
context:
space:
mode:
Diffstat (limited to 'feature-session-persistence')
-rw-r--r--feature-session-persistence/src/main/java/org/onap/policy/drools/persistence/JpaDroolsSessionConnector.java6
-rw-r--r--feature-session-persistence/src/main/java/org/onap/policy/drools/persistence/PersistenceFeature.java47
-rw-r--r--feature-session-persistence/src/test/java/org/onap/policy/drools/persistence/EntityMgrTransTest.java4
3 files changed, 35 insertions, 22 deletions
diff --git a/feature-session-persistence/src/main/java/org/onap/policy/drools/persistence/JpaDroolsSessionConnector.java b/feature-session-persistence/src/main/java/org/onap/policy/drools/persistence/JpaDroolsSessionConnector.java
index 381a896e..b85a6854 100644
--- a/feature-session-persistence/src/main/java/org/onap/policy/drools/persistence/JpaDroolsSessionConnector.java
+++ b/feature-session-persistence/src/main/java/org/onap/policy/drools/persistence/JpaDroolsSessionConnector.java
@@ -98,13 +98,13 @@ public class JpaDroolsSessionConnector implements DroolsSessionConnector {
*/
private boolean update(EntityManager em, DroolsSession sess) {
- DroolsSessionEntity s = em.find(DroolsSessionEntity.class, sess.getSessionName());
- if (s == null) {
+ DroolsSessionEntity session = em.find(DroolsSessionEntity.class, sess.getSessionName());
+ if (session == null) {
return false;
}
logger.info("update: Updating session id to {}", sess.getSessionId());
- s.setSessionId(sess.getSessionId());
+ session.setSessionId(sess.getSessionId());
return true;
}
diff --git a/feature-session-persistence/src/main/java/org/onap/policy/drools/persistence/PersistenceFeature.java b/feature-session-persistence/src/main/java/org/onap/policy/drools/persistence/PersistenceFeature.java
index 7b17de6c..332e2984 100644
--- a/feature-session-persistence/src/main/java/org/onap/policy/drools/persistence/PersistenceFeature.java
+++ b/feature-session-persistence/src/main/java/org/onap/policy/drools/persistence/PersistenceFeature.java
@@ -119,14 +119,16 @@ public class PersistenceFeature implements PolicySessionFeatureAPI, PolicyEngine
}
/**
- * {@inheritDoc} */
+ * {@inheritDoc}.
+ **/
@Override
public int getSequenceNumber() {
return 1;
}
/**
- * {@inheritDoc} */
+ * {@inheritDoc}.
+ **/
@Override
public void globalInit(String[] args, String configDir) {
@@ -160,7 +162,8 @@ public class PersistenceFeature implements PolicySessionFeatureAPI, PolicyEngine
}
/**
- * {@inheritDoc} */
+ * {@inheritDoc}.
+ **/
@Override
public PolicySession.ThreadModel selectThreadModel(PolicySession session) {
@@ -172,7 +175,8 @@ public class PersistenceFeature implements PolicySessionFeatureAPI, PolicyEngine
}
/**
- * {@inheritDoc} */
+ * {@inheritDoc}.
+ **/
@Override
public void disposeKieSession(PolicySession policySession) {
@@ -184,7 +188,8 @@ public class PersistenceFeature implements PolicySessionFeatureAPI, PolicyEngine
}
/**
- * {@inheritDoc} */
+ * {@inheritDoc}.
+ **/
@Override
public void destroyKieSession(PolicySession policySession) {
@@ -196,14 +201,16 @@ public class PersistenceFeature implements PolicySessionFeatureAPI, PolicyEngine
}
/**
- * {@inheritDoc} */
+ * {@inheritDoc}.
+ **/
@Override
public boolean afterStart(PolicyEngine engine) {
return false;
}
/**
- * {@inheritDoc} */
+ * {@inheritDoc}.
+ **/
@Override
public boolean beforeStart(PolicyEngine engine) {
synchronized (cleanupLock) {
@@ -214,7 +221,8 @@ public class PersistenceFeature implements PolicySessionFeatureAPI, PolicyEngine
}
/**
- * {@inheritDoc} */
+ * {@inheritDoc}.
+ **/
@Override
public boolean beforeActivate(PolicyEngine engine) {
synchronized (cleanupLock) {
@@ -225,7 +233,8 @@ public class PersistenceFeature implements PolicySessionFeatureAPI, PolicyEngine
}
/**
- * {@inheritDoc} */
+ * {@inheritDoc}.
+ **/
@Override
public boolean afterActivate(PolicyEngine engine) {
return false;
@@ -686,19 +695,21 @@ public class PersistenceFeature implements PolicySessionFeatureAPI, PolicyEngine
return "Session " + session.getFullName() + " (persistent)";
}
- /** ************************ */
+ /*=========================*/
/* 'ThreadModel' interface */
- /** ************************ */
+ /*=========================*/
/**
- * {@inheritDoc} */
+ * {@inheritDoc}.
+ **/
@Override
public void start() {
thread.start();
}
/**
- * {@inheritDoc} */
+ * {@inheritDoc}.
+ **/
@Override
public void stop() {
// tell the thread to stop
@@ -720,19 +731,21 @@ public class PersistenceFeature implements PolicySessionFeatureAPI, PolicyEngine
}
/**
- * {@inheritDoc} */
+ * {@inheritDoc}.
+ **/
@Override
public void updated() {
// the container artifact has been updated -- adjust the thread name
thread.setName(getThreadName());
}
- /** ********************* */
+ /*======================*/
/* 'Runnable' interface */
- /** ********************* */
+ /*======================*/
/**
- * {@inheritDoc} */
+ * {@inheritDoc}.
+ **/
@Override
public void run() {
logger.info("PersistentThreadModel running");
diff --git a/feature-session-persistence/src/test/java/org/onap/policy/drools/persistence/EntityMgrTransTest.java b/feature-session-persistence/src/test/java/org/onap/policy/drools/persistence/EntityMgrTransTest.java
index c622a933..fb0d1102 100644
--- a/feature-session-persistence/src/test/java/org/onap/policy/drools/persistence/EntityMgrTransTest.java
+++ b/feature-session-persistence/src/test/java/org/onap/policy/drools/persistence/EntityMgrTransTest.java
@@ -98,7 +98,7 @@ public class EntityMgrTransTest {
*/
@Test
public void testEntityMgrTrans_Inactive() throws Exception {
- EntityMgrTrans emt = new EntityMgrTrans(mgr);
+ final EntityMgrTrans emt = new EntityMgrTrans(mgr);
// verify that transaction was started
verify(trans).begin();
@@ -123,7 +123,7 @@ public class EntityMgrTransTest {
when(trans.getStatus()).thenReturn(Status.STATUS_ACTIVE);
- EntityMgrTrans emt = new EntityMgrTrans(mgr);
+ final EntityMgrTrans emt = new EntityMgrTrans(mgr);
// verify that transaction was not re-started started
verify(trans, never()).begin();