use of org.apache.ignite.spi.deployment.local.LocalDeploymentSpi in project ignite by apache.
the class ExternalNonSpringAopSelfTest method getConfiguration.
/** {@inheritDoc} */
@Override
protected IgniteConfiguration getConfiguration() throws Exception {
IgniteConfiguration cfg = super.getConfiguration();
cfg.setDeploymentSpi(new LocalDeploymentSpi());
cfg.setMetricsUpdateFrequency(500);
cfg.setDeploymentMode(depMode);
return cfg;
}
use of org.apache.ignite.spi.deployment.local.LocalDeploymentSpi in project ignite by apache.
the class AbstractAopTest method getConfiguration.
/** {@inheritDoc} */
@Override
protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName);
cfg.setDeploymentSpi(new LocalDeploymentSpi());
((TcpDiscoverySpi) cfg.getDiscoverySpi()).setIpFinder(IP_FINDER);
cfg.setMetricsUpdateFrequency(500);
cfg.setDeploymentMode(depMode);
return cfg;
}
use of org.apache.ignite.spi.deployment.local.LocalDeploymentSpi in project ignite by apache.
the class GridP2PUndeploySelfTest method processTestUndeployLocalTasks.
/**
* @param depMode deployment mode.
* @throws Exception If failed.
*/
@SuppressWarnings("unchecked")
private void processTestUndeployLocalTasks(DeploymentMode depMode) throws Exception {
try {
this.depMode = depMode;
Ignite ignite1 = startGrid(1);
Ignite ignite2 = startGrid(2);
ClassLoader tstClsLdr = new GridTestClassLoader(GridP2PTestTask.class.getName(), GridP2PTestJob.class.getName());
Class<? extends ComputeTask<?, ?>> task1 = (Class<? extends ComputeTask<?, ?>>) tstClsLdr.loadClass(GridP2PTestTask.class.getName());
ignite1.compute().localDeployTask(task1, tstClsLdr);
ignite1.compute().execute(task1.getName(), 1);
ignite2.compute().localDeployTask(task1, tstClsLdr);
ignite2.compute().execute(task1.getName(), 2);
LocalDeploymentSpi spi1 = spis.get(ignite1.name());
LocalDeploymentSpi spi2 = spis.get(ignite2.name());
assert spi1.findResource(task1.getName()) != null;
assert spi2.findResource(task1.getName()) != null;
assert ignite1.compute().localTasks().containsKey(task1.getName());
assert ignite2.compute().localTasks().containsKey(task1.getName());
ignite2.compute().undeployTask(task1.getName());
// Wait for undeploy.
Thread.sleep(1000);
assert spi1.findResource(task1.getName()) == null;
assert spi2.findResource(task1.getName()) == null;
assert !ignite1.compute().localTasks().containsKey(task1.getName());
assert !ignite2.compute().localTasks().containsKey(task1.getName());
} finally {
stopGrid(2);
stopGrid(1);
}
}
use of org.apache.ignite.spi.deployment.local.LocalDeploymentSpi in project ignite by apache.
the class GridP2PUndeploySelfTest method getConfiguration.
/** {@inheritDoc} */
@Override
protected IgniteConfiguration getConfiguration(String igniteInstanceName, IgniteTestResources rsrcs) throws Exception {
IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName, rsrcs);
LocalDeploymentSpi spi = new LocalDeploymentSpi();
spis.put(igniteInstanceName, spi);
cfg.setDeploymentSpi(spi);
cfg.setDeploymentMode(depMode);
return cfg;
}
use of org.apache.ignite.spi.deployment.local.LocalDeploymentSpi in project ignite by apache.
the class GridP2PUndeploySelfTest method processTestUndeployP2PTasks.
/**
* @param depMode deployment mode.
* @throws Exception If failed.
*/
@SuppressWarnings("unchecked")
private void processTestUndeployP2PTasks(DeploymentMode depMode) throws Exception {
try {
this.depMode = depMode;
Ignite ignite1 = startGrid(1);
Ignite ignite2 = startGrid(2);
ClassLoader ldr = new URLClassLoader(new URL[] { new URL(GridTestProperties.getProperty("p2p.uri.cls")) }, GridP2PSameClassLoaderSelfTest.class.getClassLoader());
Class<? extends ComputeTask<?, ?>> task1 = (Class<? extends ComputeTask<?, ?>>) ldr.loadClass(TEST_TASK_NAME);
ignite1.compute().localDeployTask(task1, ldr);
ignite1.compute().execute(task1.getName(), ignite2.cluster().localNode().id());
LocalDeploymentSpi spi1 = spis.get(ignite1.name());
LocalDeploymentSpi spi2 = spis.get(ignite2.name());
assert spi1.findResource(task1.getName()) != null;
assert ignite1.compute().localTasks().containsKey(task1.getName());
// P2P deployment will not deploy task into the SPI.
assert spi2.findResource(task1.getName()) == null;
ignite1.compute().undeployTask(task1.getName());
// Wait for undeploy.
Thread.sleep(1000);
assert spi1.findResource(task1.getName()) == null;
assert spi2.findResource(task1.getName()) == null;
assert !ignite1.compute().localTasks().containsKey(task1.getName());
assert !ignite2.compute().localTasks().containsKey(task1.getName());
spis = null;
} finally {
stopGrid(2);
stopGrid(1);
}
}
Aggregations