當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。