本文整理了Java中org.apache.brooklyn.api.mgmt.LocationManager.unmanage()
方法的一些代码示例,展示了LocationManager.unmanage()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。LocationManager.unmanage()
方法的具体详情如下:
包路径:org.apache.brooklyn.api.mgmt.LocationManager
类名称:LocationManager
方法名:unmanage
[英]Causes the given location and its children, recursively, to be removed from the management plane (for instance because the location is no longer relevant). If the given location is not managed (e.g. it has already been unmanaged) then this is a no-op (though it may be logged so duplicate calls are best avoided).
[中]使给定位置及其子对象递归地从管理平面中移除(例如,因为该位置不再相关)。如果给定位置未被管理(例如,它已被非管理),则这是一个无操作(尽管可能会记录该位置,以便最好避免重复调用)。
代码示例来源:origin: org.apache.brooklyn/brooklyn-core
@Override
public void unmanage(Location loc) {
if (isInitialManagementContextReal()) {
initialManagementContext.getLocationManager().unmanage(loc);
} else {
throw new IllegalStateException("Non-deployment context "+this+" is not valid for this operation: cannot unmanage "+loc);
}
}
代码示例来源:origin: org.apache.brooklyn/brooklyn-core
public static void unmanage(Location loc) {
if (isManaged(loc)) {
ManagementContext mgmt = ((LocationInternal)loc).getManagementContext();
mgmt.getLocationManager().unmanage(loc);
}
}
代码示例来源:origin: org.apache.brooklyn/brooklyn-core
public boolean removeChild(Location child) {
boolean removed;
synchronized (children) {
removed = children.remove(child);
}
if (removed) {
if (child instanceof Closeable) {
Streams.closeQuietly((Closeable)child);
}
child.setParent(null);
if (isManaged() && Locations.isManaged(child)) {
// This is called as part of child's LocalLocationManager.unmanage; don't try to
// unmanage it yet again as then would get a log.warn!
getManagementContext().getLocationManager().unmanage(child);
}
}
onChanged();
return removed;
}
代码示例来源:origin: io.brooklyn.clocker/brooklyn-clocker-docker
@Override
public void deleteLocation() {
DockerContainerLocation location = getDynamicLocation();
if (location != null) {
try {
location.close();
} catch (IOException ioe) {
LOG.debug("Error closing container location", ioe);
}
LocationManager mgr = getManagementContext().getLocationManager();
if (mgr.isManaged(location)) {
mgr.unmanage(location);
}
}
sensors().set(DYNAMIC_LOCATION, null);
sensors().set(LOCATION_NAME, null);
}
代码示例来源:origin: org.apache.brooklyn/brooklyn-software-base
@Override
public void deleteLocation() {
LocationManager mgr = getManagementContext().getLocationManager();
ServerPoolLocation location = getDynamicLocation();
if (location != null && mgr.isManaged(location)) {
LOG.debug("{} deleting and unmanaging location {}", this, location);
location.deregister();
mgr.unmanage(location);
}
sensors().set(LOCATION_SPEC, null);
sensors().set(DYNAMIC_LOCATION, null);
sensors().set(LOCATION_NAME, null);
}
代码示例来源:origin: io.brooklyn.clocker/brooklyn-clocker-mesos
@Override
public void deleteLocation() {
MarathonTaskLocation location = getDynamicLocation();
if (location != null) {
LocationManager mgr = getManagementContext().getLocationManager();
if (mgr.isManaged(location)) {
mgr.unmanage(location);
}
}
sensors().set(DYNAMIC_LOCATION, null);
sensors().set(LOCATION_NAME, null);
}
代码示例来源:origin: org.apache.brooklyn/brooklyn-core
@Test
public void testRestoresEntityLocationAndCleansUp() throws Exception {
MyEntity child = origApp.createAndManageChild(EntitySpec.create(MyEntity.class).location(LocationSpec.create(MyLocation.class)));
Location loc = Iterables.getOnlyElement(child.getLocations());
newApp = rebind();
MyEntity newE = (MyEntity) Iterables.find(newApp.getChildren(), Predicates.instanceOf(MyEntity.class));
Assert.assertEquals(newE.getLocations().size(), 1);
Location loc2 = Iterables.getOnlyElement(newE.getLocations());
Assert.assertEquals(loc, loc2);
Assert.assertFalse(loc==loc2);
newApp.stop();
// TODO how to trigger automatic unmanagement? see notes in RebindLocalhostLocationTest
newManagementContext.getLocationManager().unmanage(loc2);
switchOriginalToNewManagementContext();
RebindTestUtils.waitForPersisted(origManagementContext);
BrooklynMementoManifest mf = loadMementoManifest();
Assert.assertTrue(mf.getLocationIdToType().isEmpty(), "Expected no locations; had "+mf.getLocationIdToType());
}
代码示例来源:origin: org.apache.brooklyn/brooklyn-software-base
@Override
public void deleteLocation() {
StubContainerLocation location = getDynamicLocation();
if (location != null) {
try {
location.close();
} catch (IOException ioe) {
LOG.debug("Error closing container location", ioe);
}
LocationManager mgr = getManagementContext().getLocationManager();
if (mgr.isManaged(location)) {
mgr.unmanage(location);
}
}
sensors().set(DYNAMIC_LOCATION, null);
sensors().set(LOCATION_NAME, null);
}
}
代码示例来源:origin: org.apache.brooklyn/brooklyn-core
@Test
public void testManagedLocationsSimpleCreateAndCleanup() {
Asserts.assertThat(locationManager.getLocations(), CollectionFunctionals.sizeEquals(0));
Location loc = mgmt.getLocationRegistry().getLocationManaged("localhost");
Asserts.assertThat(locationManager.getLocations(), CollectionFunctionals.sizeEquals(1));
mgmt.getLocationManager().unmanage(loc);
Asserts.assertThat(locationManager.getLocations(), CollectionFunctionals.sizeEquals(0));
}
代码示例来源:origin: org.apache.brooklyn/brooklyn-core
@Test
public void testManagedLocationsNamedCreateAndCleanup() {
Asserts.assertThat(mgmt.getLocationRegistry().getDefinedLocations(true).keySet(), CollectionFunctionals.sizeEquals(0));
Asserts.assertThat(mgmt.getCatalog().getCatalogItems(), CollectionFunctionals.sizeEquals(0));
Asserts.assertThat(locationManager.getLocations(), CollectionFunctionals.sizeEquals(0));
mgmt.getLocationRegistry().updateDefinedLocationNonPersisted( new BasicLocationDefinition("lh1", "localhost", null) );
Asserts.assertThat(mgmt.getLocationRegistry().getDefinedLocations(true).keySet(), CollectionFunctionals.sizeEquals(1));
Asserts.assertThat(locationManager.getLocations(), CollectionFunctionals.sizeEquals(0));
// currently such defined locations do NOT appear in catalog -- see CatalogYamlLocationTest
Asserts.assertThat(mgmt.getCatalog().getCatalogItems(), CollectionFunctionals.sizeEquals(0));
Location loc = mgmt.getLocationRegistry().getLocationManaged("lh1");
Asserts.assertThat(mgmt.getLocationRegistry().getDefinedLocations(true).keySet(), CollectionFunctionals.sizeEquals(1));
Asserts.assertThat(locationManager.getLocations(), CollectionFunctionals.sizeEquals(1));
mgmt.getLocationManager().unmanage(loc);
Asserts.assertThat(mgmt.getLocationRegistry().getDefinedLocations(true).keySet(), CollectionFunctionals.sizeEquals(1));
Asserts.assertThat(locationManager.getLocations(), CollectionFunctionals.sizeEquals(0));
}
代码示例来源:origin: org.apache.brooklyn/brooklyn-camp
@Test
public void testManagedLocationsCreateAndCleanup() {
assertLocationRegistryCount(0);
assertLocationManagerInstancesCount(0);
assertCatalogCount(0);
String symbolicName = "lh1";
addCatalogLocation(symbolicName, LOCALHOST_LOCATION_TYPE, null);
assertLocationRegistryCount(1);
assertCatalogCount(1);
assertLocationManagerInstancesCount(0);
Location loc = mgmt().getLocationRegistry().getLocationManaged("lh1");
assertLocationRegistryCount(1);
assertCatalogCount(1);
assertLocationManagerInstancesCount(1);
mgmt().getLocationManager().unmanage(loc);
assertLocationRegistryCount(1);
assertCatalogCount(1);
assertLocationManagerInstancesCount(0);
deleteCatalogEntity("lh1");
assertLocationRegistryCount(0);
assertCatalogCount(0);
assertLocationManagerInstancesCount(0);
}
内容来源于网络,如有侵权,请联系作者删除!