use of org.objectweb.proactive.core.util.wrapper.BooleanWrapper in project scheduling by ow2-proactive.
the class RMRestTest method testShutdown_PreemptParameter.
@Test
public void testShutdown_PreemptParameter() throws Exception {
RMProxyUserInterface rm = mock(RMProxyUserInterface.class);
when(rm.shutdown(true)).thenReturn(new BooleanWrapper(true));
String sessionId = SharedSessionStoreTestUtils.createValidSession(rm);
HttpResponse response = callHttpGetMethod("shutdown?preempt=true", sessionId);
assertEquals(HttpURLConnection.HTTP_OK, response.getStatusLine().getStatusCode());
verify(rm).shutdown(true);
}
use of org.objectweb.proactive.core.util.wrapper.BooleanWrapper in project scheduling by ow2-proactive.
the class RMNodeStarter method closeDataSpaceOnShutdown.
private void closeDataSpaceOnShutdown(final Node node) {
Runtime.getRuntime().addShutdownHook(new Thread(new Runnable() {
@Override
public void run() {
try {
DataSpaceNodeConfigurationAgent conf = (DataSpaceNodeConfigurationAgent) PAActiveObject.newActive(DataSpaceNodeConfigurationAgent.class.getName(), null, node);
BooleanWrapper closeNodeConfiguration = conf.closeNodeConfiguration();
PAFuture.waitFor(closeNodeConfiguration, DATASPACE_CLOSE_TIMEOUT);
if (closeNodeConfiguration.getBooleanValue()) {
logger.debug("Dataspaces are successfully closed for node " + node.getNodeInformation().getURL());
}
} catch (Throwable t) {
logger.debug("Cannot close data spaces configuration", t);
}
}
}));
}
use of org.objectweb.proactive.core.util.wrapper.BooleanWrapper in project scheduling by ow2-proactive.
the class ReleaseResourcesWhenSchedulerIdle method activate.
@Override
public BooleanWrapper activate() {
BooleanWrapper activationStatus = super.activate();
if (!activationStatus.getBooleanValue()) {
return activationStatus;
}
activeJobs = state.getPendingJobs().size() + state.getRunningJobs().size();
debug("Policy is activated. Current number of jobs is " + activeJobs);
return new BooleanWrapper(true);
}
use of org.objectweb.proactive.core.util.wrapper.BooleanWrapper in project scheduling by ow2-proactive.
the class RMCore method removeNodeSource.
/**
* {@inheritDoc}
*/
public BooleanWrapper removeNodeSource(String nodeSourceName, boolean preempt) {
if (!this.definedNodeSources.containsKey(nodeSourceName)) {
throw new IllegalArgumentException("Unknown node source " + nodeSourceName);
}
NodeSource nodeSourceToRemove = this.definedNodeSources.get(nodeSourceName);
this.caller.checkPermission(nodeSourceToRemove.getAdminPermission(), this.caller + " is not authorized to remove " + nodeSourceName);
logger.info("Remove node source " + nodeSourceName + " with preempt=" + preempt + REQUESTED_BY_STRING + this.caller.getName());
this.shutDownNodeSourceIfDeployed(nodeSourceName, preempt);
this.removeDefinedNodeSource(nodeSourceName, nodeSourceToRemove);
return new BooleanWrapper(true);
}
use of org.objectweb.proactive.core.util.wrapper.BooleanWrapper in project scheduling by ow2-proactive.
the class RMCore method nodeSourceUnregister.
/**
* Unregisters node source from the resource manager core.
*/
public BooleanWrapper nodeSourceUnregister(String nodeSourceName, NodeSourceStatus nodeSourceStatus, RMNodeSourceEvent evt) {
NodeSource nodeSource = this.deployedNodeSources.remove(nodeSourceName);
if (nodeSource == null) {
logger.warn("Attempt to remove non-existing node source " + nodeSourceName);
return new BooleanWrapper(false);
}
this.disconnectNodeSourceClient(nodeSourceName, nodeSource);
logger.info(NODE_SOURCE_STRING + nodeSourceName + " has been successfully " + evt.getEventType().getDescription());
this.monitoring.nodeSourceEvent(evt);
this.emitRemovedEventIfNodeSourceWasNotUndeployed(nodeSource, nodeSourceStatus);
if ((this.deployedNodeSources.isEmpty()) && this.toShutDown) {
this.finalizeShutdown();
}
return new BooleanWrapper(true);
}
Aggregations