Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
 package org.jboss.jbossts.xts.recovery.coordinator;
 
 
manager allowing XTS coordinator recovery modules to be registered at startup and unregistered at shutdown.
{
    
the list of XTS recovery modules actually registered with the JBossTS recovery manager
    private static List<XTSRecoveryModulerecoveryModules = new ArrayList<XTSRecoveryModule>();

    
flag to identify if we have already been initialised
    private static boolean initialised = false;
    
initialisation routine which registers all configured XTS recovery modules
    public static void startup()
    {
        if () {
            return;
        }
        RecoveryEnvironmentBean recoveryEnvironmentBean = XTSPropertyManager.getRecoveryEnvironmentBean();
        List<Stringmodules = recoveryEnvironmentBean.getCoordinatorRecoveryModules();
        Iterator<Stringiterator = modules.iterator();
        while (iterator.hasNext())
        {
            String className = (Stringiterator.next();
            Class<?> clazz = null;
            try {
                clazz = CoordinatorRecoveryInitialisation.class.getClassLoader().loadClass(className);
            } catch (ClassNotFoundException cnfe) {
                continue;
            }
            if (!RecoveryModule.class.isAssignableFrom(clazz)) {
                continue;
            }
            
            try {
                XTSRecoveryModule module = (XTSRecoveryModule)clazz.newInstance();
                module.install();
                RecoveryManager.manager().addModule(module);
                .add(module);
            } catch (InstantiationException ie) {
            } catch (IllegalAccessException iae) {
            }
        }
         = true;
    }

    
shutdown routine which removes all installed recovery modules
    public static void shutdown()
    {
        if (!) {
            return;
        }
        
        Iterator<XTSRecoveryModuleiterator = .iterator();
        while (iterator.hasNext()) {
            XTSRecoveryModule module = iterator.next();
            RecoveryManager.manager().removeModule(moduletrue);
            module.uninstall();
        }
        .clear();
        
         = false;
    }
New to GrepCode? Check out our FAQ X