1 23 package com.sun.enterprise.admin.event; 24 25 import com.sun.logging.LogDomains; 26 import java.util.Set ; 27 import java.util.HashSet ; 28 import java.util.Iterator ; 29 import java.util.ArrayList ; 30 import java.util.logging.Level ; 31 import java.util.logging.Logger ; 32 33 import com.sun.enterprise.admin.target.Target; 34 import com.sun.enterprise.admin.server.core.channel.RMIClient; 35 import com.sun.enterprise.admin.server.core.channel.AdminChannel; 36 37 import com.sun.enterprise.admin.event.AdminEvent; 38 import com.sun.enterprise.admin.event.AdminEventResult; 39 40 import com.sun.enterprise.admin.server.core.AdminService; 41 import com.sun.enterprise.admin.target.TargetBuilder; 42 import com.sun.enterprise.admin.target.Target; 43 import com.sun.enterprise.admin.target.TargetType; 44 import com.sun.enterprise.config.serverbeans.Server; 45 import com.sun.enterprise.admin.event.ElementChangeHelper; 46 import com.sun.enterprise.config.ConfigContext; 47 48 import com.sun.enterprise.server.ApplicationServer; 49 import com.sun.enterprise.server.ServerContext; 50 51 import com.sun.enterprise.util.i18n.StringManager; 53 54 60 public class RRPersistenceHelper{ 61 62 private static Logger _logger = null; 64 65 public RRPersistenceHelper() { 66 } 67 68 75 public void setRestartRequiredForServer(AdminEvent event, 76 AdminEventResult result ) { 77 78 if (AdminService.getAdminService() == null) { 79 return; 81 } 82 83 String resCode = null; 84 try { 86 if (result != null) { 87 resCode = result.getResultCode(); 88 } 89 if ((resCode == null) || 90 (!resCode.equals(AdminEventResult.SUCCESS)) ){ 91 92 if (event != null) { 93 setRestartRequired( event.getInstanceName(), true); 94 } 95 } 96 } catch (Throwable t) { 97 getLogger().log(Level.INFO, 98 "event.exception_during_restart_reset",t); 99 } 100 101 } 102 103 109 public void setRestartRequired(String inst, boolean restart) { 110 111 try { 112 RMIClient client = AdminChannel.getRMIClient(inst); 113 if (client == null) { 114 getLogger().log(Level.INFO, "event.rmi_client_not_found"); 115 } else { 116 client.setRestartNeeded(restart); 117 } 118 } catch (Throwable t) { 119 getLogger().log(Level.INFO, 120 "event.exception_during_restart_reset", t); 121 } 122 } 123 124 131 public void setRestartRequired(boolean restart) { 132 String inst = null; 133 ServerContext svrCtx = ApplicationServer.getServerContext(); 134 if (svrCtx !=null) { 135 inst = svrCtx.getInstanceName(); 136 } 137 setRestartRequired(inst, restart); 138 } 139 140 private static Logger getLogger() { 141 if (_logger == null) { 142 _logger = Logger.getLogger(LogDomains.ADMIN_LOGGER); 143 } 144 return _logger; 145 } 146 147 } 148 | Popular Tags |