1 23 24 package com.sun.enterprise.server.ondemand; 25 26 import java.util.*; 27 import java.util.logging.Level ; 28 import java.util.logging.Logger ; 29 import com.sun.logging.LogDomains; 30 31 import com.sun.enterprise.server.ondemand.entry.*; 32 33 40 public class ServerEntryListenerImpl implements ServerEntryListener { 41 42 private OnDemandServer server = null; 43 private ArrayList listeners = new ArrayList(); 44 45 static Logger _logger = LogDomains.getLogger(LogDomains.CORE_LOGGER); 46 47 public ServerEntryListenerImpl(OnDemandServer server) { 48 this.server = server; 49 } 50 51 55 public boolean isNotified(EntryContext context) { 56 context.setServerContext(server.getServerContext()); 57 return this.server.getServiceGroup().isNotified(context); 58 } 59 60 65 public void notifyEntry(EntryContext context) { 66 if (server.isOnDemandOff() == true && 67 context.getEntryPointType() != EntryPoint.STARTUP) { 68 return; 69 } 70 context.setServerContext(server.getServerContext()); 71 try { 72 this.server.getServiceGroup().start(context); 73 } catch (Exception e) { 74 _logger.log(Level.SEVERE, e.getMessage(), e); 75 } 76 77 Iterator it = listeners.iterator(); 78 while (it.hasNext()) { 79 ServerEntryListener listener = (ServerEntryListener) it.next(); 80 listener.notifyEntry(context); 81 } 82 } 83 84 88 public void addServerEntryListener(ServerEntryListener listener) { 89 listeners.add(listener); 90 } 91 92 95 public void removeServerEntryListener(ServerEntryListener listener) { 96 listeners.remove(listener); 97 } 98 } 99 | Popular Tags |