Search in sources :

Example 1 with RMEventType

use of org.ow2.proactive.resourcemanager.common.event.RMEventType in project scheduling by ow2-proactive.

the class RMMonitorsHandler method waitForNodeEvent.

public RMNodeEvent waitForNodeEvent(RMEventType eventType, String nodeUrl, long timeout) throws ProActiveTimeoutException {
    NodeEventMonitor monitor = new NodeEventMonitor(eventType, nodeUrl);
    synchronized (this) {
        if (this.nodesEvent.contains(monitor)) {
            RMNodeEvent event = nodesEvent.get(nodesEvent.indexOf(monitor)).getNodeEvent();
            nodesEvent.remove(monitor);
            return event;
        }
        monitor = (NodeEventMonitor) getMonitor(monitor);
    }
    waitWithMonitor(monitor, timeout);
    return monitor.getNodeEvent();
}
Also used : RMNodeEvent(org.ow2.proactive.resourcemanager.common.event.RMNodeEvent)

Example 2 with RMEventType

use of org.ow2.proactive.resourcemanager.common.event.RMEventType in project scheduling by ow2-proactive.

the class RMMonitorsHandler method dumpEvents.

public synchronized void dumpEvents() {
    RMTHelper.log("RM events");
    for (RMEventType e : stateEvents) {
        RMTHelper.log(e.toString());
    }
    RMTHelper.log("RM node source events");
    for (NodeSourceEventMonitor e : nodeSourcesEvent) {
        RMTHelper.log(e.toString());
    }
    RMTHelper.log("RM node events");
    for (NodeEventMonitor e : nodesEvent) {
        RMTHelper.log(e.toString());
    }
}
Also used : RMEventType(org.ow2.proactive.resourcemanager.common.event.RMEventType)

Example 3 with RMEventType

use of org.ow2.proactive.resourcemanager.common.event.RMEventType in project scheduling by ow2-proactive.

the class RMMonitoringImpl method addRMEventListener.

/**
 * Register a new Resource manager listener.
 * Way to a monitor object to ask at RMMonitoring to throw
 * RM events to it.
 * @param stub a listener object which implements {@link RMEventListener}
 * interface.
 * @param events list of wanted events that must be received.
 * @return RMInitialState snapshot of RM's current state : nodes and node sources.
 */
public RMInitialState addRMEventListener(RMEventListener stub, RMEventType... events) {
    UniqueID id = PAActiveObject.getContext().getCurrentRequest().getSourceBodyID();
    logger.debug("Adding the RM listener for " + id.shortString());
    synchronized (dispatchers) {
        Client client = null;
        synchronized (RMCore.clients) {
            client = RMCore.clients.get(id);
        }
        if (client == null) {
            throw new IllegalArgumentException("Unknown client " + id.shortString());
        }
        EventDispatcher eventDispatcher = null;
        if (stub instanceof RMGroupEventListener) {
            eventDispatcher = new GroupEventDispatcher(client, stub, events);
        } else {
            eventDispatcher = new EventDispatcher(client, stub, events);
        }
        this.dispatchers.put(id, eventDispatcher);
        RMInitialState rmInitialState = rmcore.getRMInitialState();
        eventDispatcher.setCounter(rmInitialState.getLatestCounter());
        return rmInitialState;
    }
}
Also used : UniqueID(org.objectweb.proactive.core.UniqueID) Client(org.ow2.proactive.resourcemanager.authentication.Client)

Aggregations

UniqueID (org.objectweb.proactive.core.UniqueID)1 Client (org.ow2.proactive.resourcemanager.authentication.Client)1 RMEventType (org.ow2.proactive.resourcemanager.common.event.RMEventType)1 RMNodeEvent (org.ow2.proactive.resourcemanager.common.event.RMNodeEvent)1