Package org.rioproject.monitor.service.tasks

Examples of org.rioproject.monitor.service.tasks.RedeploymentTask


        throws OperationalStringException {

        if (!isActive())
            throw new OperationalStringException("not the primary OperationalStringManager");
        ServiceElementManager svcElemMgr = null;
        RedeploymentTask scheduledTask = null;
        if (sElem != null) {
            svcElemMgr = getServiceElementManager(sElem);
            scheduledTask = getScheduledRedeploymentTask(sElem, null);
        } else if (instance != null) {
            svcElemMgr = getServiceElementManager(instance);
            scheduledTask = getScheduledRedeploymentTask(null, instance);
        }

        if (svcElemMgr == null) {
            String message =
                sElem==null? "Unmanaged ServiceElement" :"Unmanaged ServiceElement [" + sElem.getName() + "]";
            throw new OperationalStringException(message);
        }

        if (scheduledTask != null) {
            long exec = (scheduledTask.scheduledExecutionTime() - System.currentTimeMillis()) / 1000;
            if (exec > 0) {
                String item = (sElem == null ? "ServiceBeanInstance" : "ServiceElement");
                throw new OperationalStringException(item+" already scheduled for redeployment in "+exec+" seconds");
            }
        }
View Full Code Here


                                           final ServiceElement sElem,
                                           final ServiceBeanInstance instance,
                                           final boolean clean,
                                           final boolean sticky,
                                           final ServiceProvisionListener listener) throws OperationalStringException {
        RedeploymentTask scheduledTask = getScheduledRedeploymentTask(sElem, instance);
        if (scheduledTask != null) {
            long exec = (scheduledTask.scheduledExecutionTime() - System.currentTimeMillis()) / 1000;
            throw new OperationalStringException("Already " +
                                                 "scheduled " +
                                                 "for redeployment " +
                                                 "in " +
                                                 exec + " seconds");
        }
        RedeploymentTask task = new RedeploymentTask(this, sElem, instance, clean, sticky, listener);
        addTask(task);
        TaskTimer.getInstance().schedule(task, delay);
        Date redeployDate = new Date(System.currentTimeMillis() + delay);
        Object[] parms = new Object[]{redeployDate, clean, sticky, listener};
        ProvisionMonitorEvent event = new ProvisionMonitorEvent(serviceProxy,
View Full Code Here

     * @param instance The corresponding ServiceBeanInstance
     * @return The scheduled RedeploymentTask, or null if not found
     */
    RedeploymentTask getScheduledRedeploymentTask(final ServiceElement sElem, final ServiceBeanInstance instance) {
        TimerTask[] tasks = getTasks();
        RedeploymentTask scheduledTask = null;
        for (TimerTask task : tasks) {
            if (task instanceof RedeploymentTask) {
                RedeploymentTask rTask = (RedeploymentTask) task;
                if (sElem != null && rTask.getServiceElement() != null) {
                    if (rTask.getServiceElement().equals(sElem)) {
                        scheduledTask = rTask;
                        break;
                    }
                    if (instance != null && rTask.getInstance() != null) {
                        if (rTask.getInstance().equals(instance)) {
                            scheduledTask = rTask;
                            break;
                        }
                    }
                }
View Full Code Here

TOP

Related Classes of org.rioproject.monitor.service.tasks.RedeploymentTask

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.