FileDocCategorySizeDatePackage
ServerEntryListenerImpl.javaAPI DocGlassfish v2 API4324Thu May 24 06:54:38 BST 2007com.sun.enterprise.server.ondemand

ServerEntryListenerImpl

public class ServerEntryListenerImpl extends Object implements ServerEntryListener
Concrete implementation of ServerEntryListener. This directs the entry to servicegroups.
author
Binod PG
see
ServiceGroup

Fields Summary
private OnDemandServer
server
private ArrayList
listeners
static Logger
_logger
Constructors Summary
public ServerEntryListenerImpl(OnDemandServer server)

    
       
        this.server  = server;
    
Methods Summary
public voidaddServerEntryListener(ServerEntryListener listener)
If some other part of the code want to listen to the events this is a helper methods that can be used to add a listener.

        listeners.add(listener);
    
public booleanisNotified(EntryContext context)
If atleast one servicegroup that need to be started is interested in the entry context, return false. Otherwise return true.

        context.setServerContext(server.getServerContext());
        return this.server.getServiceGroup().isNotified(context);
    
public voidnotifyEntry(EntryContext context)
Notify the main servicegroup about the server entry. If ondemand initialization is switched off, no entry event (other than the one special STARTUP event) will be processed.

        if (server.isOnDemandOff() == true && 
            context.getEntryPointType() != EntryPoint.STARTUP) {
            return;
        }
        context.setServerContext(server.getServerContext());
        try {
            this.server.getServiceGroup().start(context);
        } catch (Exception e) {
            _logger.log(Level.SEVERE, e.getMessage(), e);
            throw new RuntimeException(e);
        }

        Iterator it = listeners.iterator();
        while (it.hasNext()) {
            ServerEntryListener listener = (ServerEntryListener) it.next();
            listener.notifyEntry(context);
        }
    
public voidremoveServerEntryListener(ServerEntryListener listener)
Remove a listener from the list.

        listeners.remove(listener);