use of org.objectweb.proactive.Service in project scheduling by ow2-proactive.
the class RMCore method runActivity.
/**
* RunActivity periodically send "alive" event to listeners
*/
public void runActivity(Body body) {
Service service = new Service(body);
// recalculating nodes number only once per policy period
while (body.isActive()) {
Request request = null;
try {
request = service.blockingRemoveOldest(PAResourceManagerProperties.RM_ALIVE_EVENT_FREQUENCY.getValueAsLong());
if (request != null) {
try {
try {
caller = checkMethodCallPermission(request.getMethodName(), request.getSourceBodyID());
service.serve(request);
} catch (SecurityException ex) {
logger.warn("Cannot serve request: " + request, ex);
service.serve(new ThrowExceptionRequest(request, ex));
}
} catch (Throwable e) {
logger.error("Cannot serve request: " + request, e);
}
}
} catch (InterruptedException e) {
logger.warn("runActivity interrupted", e);
}
}
}
use of org.objectweb.proactive.Service in project scheduling by ow2-proactive.
the class NodeSource method runActivity.
public void runActivity(Body body) {
Service service = new Service(body);
long timeStamp = System.currentTimeMillis();
long delta = 0;
// recalculating nodes number only once per policy period
while (body.isActive()) {
try {
service.blockingServeOldest(pingFrequency);
delta += System.currentTimeMillis() - timeStamp;
timeStamp = System.currentTimeMillis();
if (delta > pingFrequency) {
logger.info("[" + name + "] Pinging alive nodes : " + getAliveNodes().size());
for (Node node : getAliveNodes()) {
pingNode(node);
}
delta = 0;
}
} catch (InterruptedException e) {
logger.warn("runActivity interrupted", e);
}
}
}
Aggregations