当前位置: 首页>>代码示例>>Java>>正文


Java DisposableBean.destroy方法代码示例

本文整理汇总了Java中org.springframework.beans.factory.DisposableBean.destroy方法的典型用法代码示例。如果您正苦于以下问题:Java DisposableBean.destroy方法的具体用法?Java DisposableBean.destroy怎么用?Java DisposableBean.destroy使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.springframework.beans.factory.DisposableBean的用法示例。


在下文中一共展示了DisposableBean.destroy方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: destroy

import org.springframework.beans.factory.DisposableBean; //导入方法依赖的package包/类
@Override
public void destroy() throws Exception {
    if (executor instanceof DisposableBean) {
        DisposableBean bean = (DisposableBean) executor;
        bean.destroy();
    }
}
 
开发者ID:GastonMauroDiaz,项目名称:buenojo,代码行数:8,代码来源:ExceptionHandlingAsyncTaskExecutor.java

示例2: dispose

import org.springframework.beans.factory.DisposableBean; //导入方法依赖的package包/类
protected void dispose(String name, Object bean) {
	if (DisposableBean.class.isInstance(bean)) {
		DisposableBean disposable = DisposableBean.class.cast(bean);
		try {
			disposable.destroy();
		}
		catch (Exception e) {
			logger.warn("unable to dispose of bean {}", name, bean);
		}
	}
}
 
开发者ID:qas-guru,项目名称:martini-core,代码行数:12,代码来源:ScenarioScope.java

示例3: destroy

import org.springframework.beans.factory.DisposableBean; //导入方法依赖的package包/类
@Override
public void destroy() throws Exception {
  if(executor instanceof DisposableBean) {
    DisposableBean bean = (DisposableBean) executor;
    bean.destroy();
  }
}
 
开发者ID:obiba,项目名称:agate,代码行数:8,代码来源:ExceptionHandlingAsyncTaskExecutor.java

示例4: closeBean

import org.springframework.beans.factory.DisposableBean; //导入方法依赖的package包/类
private void closeBean(DisposableBean bean) {
    try {
        if (bean != null) {
            bean.destroy();
        }
    } catch (Exception e) {
        // ignore
    }
}
 
开发者ID:naver,项目名称:pinpoint,代码行数:10,代码来源:DataReceiverGroupTest.java

示例5: destroyBean

import org.springframework.beans.factory.DisposableBean; //导入方法依赖的package包/类
/**
 * Destroy the given bean. Must destroy beans that depend on the given
 * bean before the bean itself. Should not throw any exceptions.
 * @param beanName the name of the bean
 * @param bean the bean instance to destroy
 */
protected void destroyBean(String beanName, DisposableBean bean) {
	// Trigger destruction of dependent beans first...
	Set<String> dependencies = this.dependentBeanMap.remove(beanName);
	if (dependencies != null) {
		if (logger.isDebugEnabled()) {
			logger.debug("Retrieved dependent beans for bean '" + beanName + "': " + dependencies);
		}
		for (String dependentBeanName : dependencies) {
			destroySingleton(dependentBeanName);
		}
	}

	// Actually destroy the bean now...
	if (bean != null) {
		try {
			bean.destroy();
		}
		catch (Throwable ex) {
			logger.error("Destroy method on bean with name '" + beanName + "' threw an exception", ex);
		}
	}

	// Trigger destruction of contained beans...
	Set<String> containedBeans = this.containedBeanMap.remove(beanName);
	if (containedBeans != null) {
		for (String containedBeanName : containedBeans) {
			destroySingleton(containedBeanName);
		}
	}

	// Remove destroyed bean from other beans' dependencies.
	synchronized (this.dependentBeanMap) {
		for (Iterator<Map.Entry<String, Set<String>>> it = this.dependentBeanMap.entrySet().iterator(); it.hasNext();) {
			Map.Entry<String, Set<String>> entry = it.next();
			Set<String> dependenciesToClean = entry.getValue();
			dependenciesToClean.remove(beanName);
			if (dependenciesToClean.isEmpty()) {
				it.remove();
			}
		}
	}

	// Remove destroyed bean's prepared dependency information.
	this.dependenciesForBeanMap.remove(beanName);
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:52,代码来源:DefaultSingletonBeanRegistry.java


注:本文中的org.springframework.beans.factory.DisposableBean.destroy方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。