FileDocCategorySizeDatePackage
JTSConfigChangeEventListener.javaAPI DocGlassfish v2 API7841Fri May 04 22:35:58 BST 2007com.sun.enterprise.transaction

JTSConfigChangeEventListener

public class JTSConfigChangeEventListener extends Object implements com.sun.enterprise.admin.event.tx.JTSEventListener

Fields Summary
private static com.sun.enterprise.util.i18n.StringManager
sm
static Logger
_logger
public String
xPath
private static ConfigChangeCategory
category
Constructors Summary
Methods Summary
public static ConfigChangeCategorygetCategory()

 
	     
		return category; 
	
public voidhandleCreate(com.sun.enterprise.admin.event.tx.JTSEvent event)

        throw new AdminEventListenerException("handleCreate is not valid for JTSEvent");
    
public voidhandleDelete(com.sun.enterprise.admin.event.tx.JTSEvent event)

        throw new AdminEventListenerException("handleDelete is not valid for JTSEvent");
    
public voidhandleUpdate(com.sun.enterprise.admin.event.tx.JTSEvent event)

	    //Bug Id: 4666390 Handle no event in event list case
	    if(event==null){
			//do nothing
			return;
		}
        ArrayList configChangeList = event.getConfigChangeList();
	    if(configChangeList==null){
			//do nothing
			return;
		}
	    //Bug Id: 4666390 End

        ConfigUpdate configUpdate = null;
        boolean match = false;
        for (int i = 0; i < configChangeList.size(); i++) {
            configUpdate = (ConfigUpdate) configChangeList.get(i);
             if (configUpdate.getXPath() != null &&
                configUpdate.getXPath().endsWith(ServerTags.TRANSACTION_SERVICE)) {
                if (xPath.equals(configUpdate.getXPath())) {
                    match = true;
                    break;
                }
             }
        }
        if (match) { // TransactionService has been changed
            Set attributeSet = configUpdate.getAttributeSet();
            String next = null;
            for (Iterator iter = attributeSet.iterator(); iter.hasNext();) {
                next = (String) iter.next();
                if (next.equals(ServerTags.TIMEOUT_IN_SECONDS)) {
			        _logger.log(Level.FINE," Transaction Timeout interval event occurred");
                    String oldTimeout = configUpdate.getOldValue(ServerTags.TIMEOUT_IN_SECONDS);
                    String newTimeout = configUpdate.getNewValue(ServerTags.TIMEOUT_IN_SECONDS);
                    if (oldTimeout.equals(newTimeout)) {
                    }
                    else {
                        try {
                            Switch.getSwitch().getTransactionManager().setDefaultTransactionTimeout(
                                                                        Integer.parseInt(newTimeout,10));
                        } catch (Exception ex) {
							_logger.log(Level.WARNING,"transaction.reconfig_txn_timeout_failed",ex);
                        }
                    } // timeout-in-seconds
                }else if (next.equals(ServerTags.KEYPOINT_INTERVAL)) {
			        _logger.log(Level.FINE,"Keypoint interval event occurred");
                    String oldKeyPoint = configUpdate.getOldValue(ServerTags.KEYPOINT_INTERVAL);
                    String newKeyPoint = configUpdate.getNewValue(ServerTags.KEYPOINT_INTERVAL);
                    if (oldKeyPoint.equals(newKeyPoint)) {
                    }
                    else {
                        Configuration.setKeypointTrigger(Integer.parseInt(newKeyPoint,10));
                    }
                }else if (next.equals(ServerTags.RETRY_TIMEOUT_IN_SECONDS)) {
                    String oldRetryTiemout = configUpdate.getOldValue(ServerTags.RETRY_TIMEOUT_IN_SECONDS);
                    String newRetryTiemout = configUpdate.getNewValue(ServerTags.RETRY_TIMEOUT_IN_SECONDS);
			        _logger.log(Level.FINE,"retry_timeout_in_seconds reconfig event occurred " + newRetryTiemout);
                    if (oldRetryTiemout.equals(newRetryTiemout)) {
                    }
                    else {
                        Configuration.setCommitRetryVar(newRetryTiemout);
                    }
                }
				else {
            		// Not handled dynamically. Restart is required.
            		AdminEventMulticaster.notifyFailure(event, AdminEventResult.RESTART_NEEDED);
				}
				
                /*
		//This feature is currently dropped as it's not implemented totally
		else if (next.equals("commit-retries")) {
                    String oldCommitRetries = configUpdate.getOldValue("commit-retries");
                    String newCommitRetries = configUpdate.getNewValue("commit-retries");
                    if (oldCommitRetries.equals(newCommitRetries)) {
                    }
                    else {
                        Configuration.setCommitRetryVar(newCommitRetries);
                    }
                } // commit-retries
                */

            }
        }