1 23 24 package com.sun.enterprise.admin.mbeans; 25 26 import com.sun.enterprise.admin.event.AdminEventResult; 27 import com.sun.enterprise.admin.event.AdminEvent; 28 import com.sun.enterprise.admin.event.AdminEventMulticaster; 29 import com.sun.enterprise.admin.event.tx.TransactionsRecoveryEvent; 30 31 import com.sun.enterprise.server.ApplicationServer; 32 33 import com.sun.enterprise.admin.config.BaseConfigMBean; 34 import com.sun.enterprise.admin.config.MBeanConfigException; 35 36 import com.sun.enterprise.util.i18n.StringManager; 37 import java.util.Collection ; 38 import java.util.Iterator ; 39 import java.util.HashMap ; 40 import java.util.logging.Level ; 41 42 49 public class TransactionsRecoveryMBean extends BaseConfigMBean 50 { 51 52 public TransactionsRecoveryMBean() 53 { 54 super(); 55 } 56 57 64 public void recoverTransactions() throws MBeanConfigException 65 { 66 67 fine("TransactionsRecoverytMBean.recoveryTransactions for server"); 68 69 sendTransactionsRecoveryEvent(getServerName(), getServerName(), null); 70 71 } 72 73 75 76 private void sendTransactionsRecoveryEvent(String destinationServer, String serverToRecover, 77 String transactionLogDir) throws MBeanConfigException 78 { 79 AdminEvent event = new TransactionsRecoveryEvent(getServerName(), 80 serverToRecover, 81 transactionLogDir); 82 event.setTargetDestination(destinationServer); 83 AdminEventResult res = forwardEvent(event); 84 if(!AdminEventResult.SUCCESS.equals(res.getResultCode())) 85 { 86 Throwable exc = null; 87 exc = res.getFirstThrowable(); 88 if (exc != null) { 89 throw new MBeanConfigException(_strMgr.getString("tx.exceptionInTargetServer", 90 exc.getMessage())); 91 } 92 throw new MBeanConfigException(_strMgr.getString("tx.notSuccessInSendReturn", 93 res.getResultCode())); 94 } 95 } 96 97 98 private AdminEventResult forwardEvent(AdminEvent e) { 99 AdminEventResult result = null; 100 result = AdminEventMulticaster.multicastEvent(e); 101 return result; 102 } 103 104 private void fine(String s) { 105 _sLogger.log(Level.FINE, s); 106 } 107 108 private String getServerName() 109 { 110 return ApplicationServer.getServerContext().getInstanceName(); 111 } 112 113 115 private static final StringManager _strMgr = 116 StringManager.getManager(EJBTimerManagementMBean.class); 117 119 } 120 | Popular Tags |