Skip to content

Commit

Permalink
Separate the timeout period for resync by the RecoveryManager from th…
Browse files Browse the repository at this point in the history
…e container managed transaction timeout.
  • Loading branch information
hs536 committed Dec 14, 2023
1 parent b2ba6ea commit 9fc93a2
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ public class EJBContainerTransactionManager {
private final JavaEETransactionManager transactionManager;
private final BaseContainer container;
private final EjbDescriptor ejbDescriptor;
private int cmtTimeoutInSeconds = 120;
private int cmtTimeoutInSeconds = 0;

/**
* Construct new instance and set basic references
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ public interface TransactionService extends ConfigBeanProxy, PropertyBag, Config
* @return possible object is
* {@link String }
*/
@Attribute (defaultValue="120",dataType=Integer.class)
@Attribute (defaultValue="0",dataType=Integer.class)
public String getTimeoutInSeconds();

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1402,19 +1402,17 @@ public static void waitForRecovery() {
}

/**
* Waits for resync to complete with timeout.
*
* @param cmtTimeout Container managed transaction timeout
* Waits for the resync between the resource and the transaction manager to complete with timeout.
*
* @return
*
* @see
*/
public static void waitForResync(int cmtTimeOut) {

public static void waitForResyncWithTimeout(){
if (resyncInProgress != null) {
int resyncTimeout = Integer.getInteger("org.glassfish.jts.CosTransactions.resyncTimeoutInSeconds", 120);
try {
resyncInProgress.waitTimeoutEvent(cmtTimeOut);
resyncInProgress.waitTimeoutEvent(resyncTimeout);
} catch (InterruptedException exc) {
_logger.log(Level.SEVERE,"jts.wait_for_resync_complete_interrupted");
String msg = LogFormatter.getLocalizedMessage(_logger,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -144,9 +144,10 @@ public ControlImpl localCreate(int timeOut) throws SystemException {
throw exc;
}

// Ensure that resync has completed.
// Ensure that the resync between the resource and the transaction
// manager has completed.

RecoveryManager.waitForResync(timeOut);
RecoveryManager.waitForResyncWithTimeout();

// Create a new top-level Coordinator, and initialise it
// with the given time-out value. If the operation fails,
Expand Down

0 comments on commit 9fc93a2

Please sign in to comment.