Package com.sun.enterprise.ee.server.group

Examples of com.sun.enterprise.ee.server.group.Barrier


     * send notifications about the messaging status.
     */
    public void initiateMessagingAndWait(String key,
    Message.Route route, CallBack cb) {              
       
        Barrier b = initiateMessaging(key, route, cb);
        if (b != null) {
            b.start();        
        }       
       
    }
View Full Code Here


                setContextClassLoader(saved);
               
                //During load, aggregate the results. So, all the instances
                //will send the notification to the elected instnace. So, the
                //route is ALLTOONE.
                Barrier b = getServerMessageRuntime().initiateMessaging(appName,
                Message.Route.ALLTOONE,impl);
               
                if (b != null)
                    b.start(timeout);
            }
           
            return;
        }   
       
        if (event.getEventType() == ApplicationEvent.BEFORE_APPLICATION_UNLOAD){                  
            ApplicationLoadEventListener loaderListener = __handleEvent(event);
            String appName = event.getApplication().getRegistrationName();
            if (loaderListener != null) {
                MessageCallBackImpl impl =
                new MessageCallBackImpl(loaderListener);
                // In case of unload, an ONETOALL message should be sent so that
                // all instances will wait for clusterwide uload to complete.
                // FIX ME. Would ALLTOONE be better here also?
                getServerMessageRuntime().initiateMessagingAndWait(appName,
                Message.Route.ONETOALL,impl);               

                ClassLoader toSet = loaderListener.getClass().getClassLoader();
                ClassLoader saved = setContextClassLoader(toSet);
                loaderListener.handleUnLoad();
                setContextClassLoader(saved);

                //Lets make sure that message runtime doesnt keep this app any more.
                getServerMessageRuntime().purge(appName);
            }
            return;
        }  
       
        if (event.getEventType() == ApplicationEvent.APPLICATION_LOADFAIL) {
            ApplicationLoadEventListener loaderListener = __handleEvent(event);
            String appName = event.getApplication().getRegistrationName();
            if (loaderListener != null) {
                MessageCallBackImpl impl =
                new MessageCallBackImpl(loaderListener);
                impl.setFailure(true);

                ClassLoader toSet = loaderListener.getClass().getClassLoader();
                ClassLoader saved = setContextClassLoader(toSet);
                // Invoke the per-instance listener.
                loaderListener.handleLoadFailure();           
                setContextClassLoader(saved);
           
                //ALLTOONE message to aggregate failure messages.
                Barrier b = getServerMessageRuntime().initiateMessaging
                (appName+"__fail", Message.Route.ALLTOONE, impl);
               
                if (b != null)
                    b.start(timeout);               
            }
            return;
        }   
    }
View Full Code Here

TOP

Related Classes of com.sun.enterprise.ee.server.group.Barrier

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.