Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
408ae7d
AMP-30983: images missing on develop
brianbrix Jun 3, 2025
ee6b5fc
AMP-30971: Thread issues for updating
brianbrix Jun 3, 2025
3e07abd
AMP-30971: Thread issues for updating
brianbrix Jun 3, 2025
1a088c6
AMP-30971: Thread issues for updating
brianbrix Jun 3, 2025
bf1f33f
AMP-30971: Thread issues for updating
brianbrix Jun 3, 2025
0803788
AMP-30971: Thread issues for updating
brianbrix Jun 4, 2025
d12cd73
AMP-30971: Thread issues for updating
brianbrix Jun 4, 2025
b2352c6
AMP-30971: Thread issues for updating
brianbrix Jun 4, 2025
41cb242
AMP-30971: Thread issues for updating
brianbrix Jun 4, 2025
f11eaf0
AMP-30971: Thread issues for updating
brianbrix Jun 4, 2025
de718c1
AMP-30971: Thread issues when updating activity via airflow/API
brianbrix Jun 4, 2025
8db0521
AMP-30971: Thread issues when updating activity via airflow/API
brianbrix Jun 4, 2025
3ea3bf4
AMP-30971: Thread issues when updating activity via airflow/API
brianbrix Jun 4, 2025
f3b1fa6
AMP-30971: Thread issues when updating activity via airflow/API
brianbrix Jun 4, 2025
c64b095
AMP 30971: Fix update activities
brianbrix Jun 12, 2025
d56e1f5
AMP 30971: Fix update activities
brianbrix Jun 12, 2025
c17e2ab
AMP 30971: Fix update activities
brianbrix Jun 12, 2025
d3a170d
AMP 30971: Fix update activities
brianbrix Jun 12, 2025
c52f735
AMP 30971: Fix update activities
brianbrix Jun 12, 2025
ea2e934
Merge branch 'develop' into fix/AMP-30971-/mport-activities
brianbrix Jun 13, 2025
8548e83
Merge branch 'develop' into fix/AMP-30971-/mport-activities
brianbrix Jun 13, 2025
37a4268
AMP 30971: Fix update activities
brianbrix Jun 13, 2025
c2d723d
AMP 30971: Fix update activities
brianbrix Jun 13, 2025
b740654
AMP 30971: Fix update activities
brianbrix Jun 13, 2025
c699bec
AMP 30971: Fix update activities
brianbrix Jun 13, 2025
5f1e9cc
AMP 30971: Fix update activities
brianbrix Jun 13, 2025
a70f5cf
AMP 30971: Fix update activities
brianbrix Jun 13, 2025
f63a3db
AMP 30971: Fix update activities
brianbrix Jun 13, 2025
7ea4e15
AMP 30971: Fix update activities
brianbrix Jun 13, 2025
ec41ded
AMP 30971: Fix update activities
brianbrix Jun 13, 2025
0262ebb
AMP 30971: Fix update activities
brianbrix Jun 13, 2025
97c97fc
AMP 30971: Fix update activities
brianbrix Jun 13, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ stage('Build') {
println "AMP Version: ${codeVersion}"
//Used in the initial generation of keys when working with a new jenkins instance
//****************************************************************
// sh "ssh-keygen -t rsa -b 4096 -C 'jenkins@${environment}' -f ~/.ssh/id_rsa -N ''"
// sh "ssh-keygen -t rsa -b 4096 -C '${env.jenkinsUser}@${environment}' -f ~/.ssh/id_rsa -N ''"
sh "ssh-keyscan -H ${environment} >> ~/.ssh/known_hosts"
// sh "cat /root/.ssh/id_rsa.pub"
//******************************************************
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
package org.dgfoundation.amp.onepager;

import org.apache.wicket.request.IRequestHandler;
import org.apache.wicket.request.cycle.AbstractRequestCycleListener;
import org.apache.wicket.request.cycle.RequestCycle;
import org.digijava.kernel.persistence.PersistenceManager;
import org.hibernate.Session;
import org.hibernate.Transaction;

/**
* Wicket request cycle listener that manages Hibernate session lifecycle
* for each web request.
*/
public class HibernateRequestCycleListener extends AbstractRequestCycleListener {
private static final org.apache.log4j.Logger logger = org.apache.log4j.Logger.getLogger(HibernateRequestCycleListener.class);

@Override
public void onBeginRequest(RequestCycle cycle) {
if (PersistenceManager.isSessionManaged()) {
logger.warn("Session already exists when starting new request - possible nesting issue");
return;
}

try {
Session session = PersistenceManager.getSession();
if (!session.getTransaction().isActive()) {
session.beginTransaction();
}
logger.debug("Started new session and transaction for request");
} catch (Exception e) {
logger.error("Failed to start Hibernate session for request", e);
throw new RuntimeException("Failed to initialize Hibernate session", e);
}
}

@Override
public void onEndRequest(RequestCycle cycle) {
try {
Session session = PersistenceManager.getSession();
if (session == null || !session.isOpen()) {
logger.debug("No active session to close at end of request");
return;
}

Transaction transaction = session.getTransaction();
try {
if (transaction.isActive()) {
if (transaction.getStatus().canRollback()) {
transaction.commit();
logger.debug("Successfully committed transaction");
} else {
logger.warn("Transaction in unexpected state: " + transaction.getStatus());
}
}
} catch (Exception e) {
logger.error("Error during transaction commit - attempting rollback", e);
try {
if (transaction.isActive()) {
transaction.rollback();
logger.debug("Rolled back transaction after error");
}
} catch (Exception rollbackEx) {
logger.error("Failed to rollback transaction", rollbackEx);
}
throw new RuntimeException("Failed to commit transaction", e);
}
} finally {
try {
PersistenceManager.cleanupThread();
logger.debug("Cleaned up thread resources");
} catch (Exception e) {
logger.error("Error during thread cleanup", e);
}
}
}

@Override
public void onDetach(RequestCycle cycle) {
// Ensure cleanup even if request processing fails
PersistenceManager.cleanupThread();
}

@Override
public IRequestHandler onException(RequestCycle cycle, Exception ex) {
logger.error("Exception occurred during request processing - cleaning up session", ex);
PersistenceManager.cleanupThread();
return null;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ public void init() {
WicketSource.configure(this);
IS_DEVELOPMENT_MODE = true;
}
getRequestCycleListeners().add(new HibernateRequestCycleListener());

//getResourceSettings().setStripJavaScriptCommentsAndWhitespace(true);
//getResourceSettings().setAddLastModifiedTimeToResourceReferenceUrl(true);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ public void beginConversation(boolean reset) {
* @return
*/
public static Session getHibernateSession(){
return getHibernateSession(false);
return PersistenceManager.getSession();
}

private static Session getHibernateSession(boolean reset) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,7 @@ public static AmpActivityVersion saveActivityNewVersion(AmpActivityVersion a,
* saves a new version of an activity
* returns newActivity
*/

public static AmpActivityVersion saveActivityNewVersion(AmpActivityVersion a,
Collection<AmpContentTranslation> translations, List<AmpContentTranslation> cumulativeTranslations,
AmpTeamMember ampCurrentMember, boolean draft,
Expand Down Expand Up @@ -234,6 +235,7 @@ public static AmpActivityVersion saveActivityNewVersion(AmpActivityVersion a,
}

session.flush();
session.clear();

} catch (CloneNotSupportedException e) {
logger.error("Can't clone current Activity: ", e);
Expand Down Expand Up @@ -307,6 +309,7 @@ public static AmpActivityVersion saveActivityNewVersion(AmpActivityVersion a,
session.merge(a);
}
session.flush();
session.clear();

updatePerformanceRules(oldA, a);

Expand Down
Loading