亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關(guān)于我們
? 蟲蟲下載站

?? abstractremoteslsbinvokerinterceptor.java

?? spring framework 2.5.4源代碼
?? JAVA
字號:
/*
 * Copyright 2002-2008 the original author or authors.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package org.springframework.ejb.access;

import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.rmi.RemoteException;

import javax.ejb.EJBHome;
import javax.ejb.EJBObject;
import javax.naming.NamingException;
import javax.rmi.PortableRemoteObject;

import org.aopalliance.intercept.MethodInvocation;

import org.springframework.remoting.RemoteConnectFailureException;
import org.springframework.remoting.RemoteLookupFailureException;
import org.springframework.remoting.rmi.RmiClientInterceptorUtils;

/**
 * Base class for interceptors proxying remote Stateless Session Beans.
 * Designed for EJB 2.x, but works for EJB 3 Session Beans as well.
 *
 * <p>Such an interceptor must be the last interceptor in the advice chain.
 * In this case, there is no target object.
 *
 * @author Rod Johnson
 * @author Juergen Hoeller
 */
public abstract class AbstractRemoteSlsbInvokerInterceptor extends AbstractSlsbInvokerInterceptor {
	
	private Class homeInterface;

	private boolean refreshHomeOnConnectFailure = false;

	private volatile boolean homeAsComponent = false;



	/**
	 * Set a home interface that this invoker will narrow to before performing
	 * the parameterless SLSB <code>create()</code> call that returns the actual
	 * SLSB proxy.
	 * <p>Default is none, which will work on all J2EE servers that are not based
	 * on CORBA. A plain <code>javax.ejb.EJBHome</code> interface is known to be
	 * sufficient to make a WebSphere 5.0 Remote SLSB work. On other servers,
	 * the specific home interface for the target SLSB might be necessary.
	 */
	public void setHomeInterface(Class homeInterface) {
		if (homeInterface != null && !homeInterface.isInterface()) {
			throw new IllegalArgumentException(
					"Home interface class [" + homeInterface.getClass() + "] is not an interface");
		}
		this.homeInterface = homeInterface;
	}

	/**
	 * Set whether to refresh the EJB home on connect failure.
	 * Default is "false".
	 * <p>Can be turned on to allow for hot restart of the EJB server.
	 * If a cached EJB home throws an RMI exception that indicates a
	 * remote connect failure, a fresh home will be fetched and the
	 * invocation will be retried.
	 * @see java.rmi.ConnectException
	 * @see java.rmi.ConnectIOException
	 * @see java.rmi.NoSuchObjectException
	 */
	public void setRefreshHomeOnConnectFailure(boolean refreshHomeOnConnectFailure) {
		this.refreshHomeOnConnectFailure = refreshHomeOnConnectFailure;
	}

	protected boolean isHomeRefreshable() {
		return this.refreshHomeOnConnectFailure;
	}


	/**
	 * This overridden lookup implementation performs a narrow operation
	 * after the JNDI lookup, provided that a home interface is specified.
	 * @see #setHomeInterface
	 * @see javax.rmi.PortableRemoteObject#narrow
	 */
	protected Object lookup() throws NamingException {
		Object homeObject = super.lookup();
		if (this.homeInterface != null) {
			try {
				homeObject = PortableRemoteObject.narrow(homeObject, this.homeInterface);
			}
			catch (ClassCastException ex) {
				throw new RemoteLookupFailureException(
						"Could not narrow EJB home stub to home interface [" + this.homeInterface.getName() + "]", ex);
			}
		}
		return homeObject;
	}

	/**
	 * Check for EJB3-style home object that serves as EJB component directly.
	 */
	protected Method getCreateMethod(Object home) throws EjbAccessException {
		if (this.homeAsComponent) {
			return null;
		}
		if (!(home instanceof EJBHome)) {
			// An EJB3 Session Bean...
			this.homeAsComponent = true;
			return null;
		}
		return super.getCreateMethod(home);
	}


	/**
	 * Fetches an EJB home object and delegates to doInvoke.
	 * If configured to refresh on connect failure, it will call
	 * refreshAndRetry on corresponding RMI exceptions.
	 * @see #getHome
	 * @see #doInvoke
	 * @see #refreshAndRetry
	 * @see java.rmi.ConnectException
	 * @see java.rmi.ConnectIOException
	 * @see java.rmi.NoSuchObjectException
	 */
	public Object invoke(MethodInvocation invocation) throws Throwable {
		try {
			return doInvoke(invocation);
		}
		catch (RemoteConnectFailureException ex) {
			return handleRemoteConnectFailure(invocation, ex);
		}
		catch (RemoteException ex) {
			if (isConnectFailure(ex)) {
				return handleRemoteConnectFailure(invocation, ex);
			}
			else {
				throw ex;
			}
		}
	}

	/**
	 * Determine whether the given RMI exception indicates a connect failure.
	 * Default implementation delegates to RmiClientInterceptorUtils.
	 * @param ex the RMI exception to check
	 * @return whether the exception should be treated as connect failure
	 * @see org.springframework.remoting.rmi.RmiClientInterceptorUtils#isConnectFailure
	 */
	protected boolean isConnectFailure(RemoteException ex) {
		return RmiClientInterceptorUtils.isConnectFailure(ex);
	}

	private Object handleRemoteConnectFailure(MethodInvocation invocation, Exception ex) throws Throwable {
		if (this.refreshHomeOnConnectFailure) {
			if (logger.isDebugEnabled()) {
				logger.debug("Could not connect to remote EJB [" + getJndiName() + "] - retrying", ex);
			}
			else if (logger.isWarnEnabled()) {
				logger.warn("Could not connect to remote EJB [" + getJndiName() + "] - retrying");
			}
			return refreshAndRetry(invocation);
		}
		else {
			throw ex;
		}
	}

	/**
	 * Refresh the EJB home object and retry the given invocation.
	 * Called by invoke on connect failure.
	 * @param invocation the AOP method invocation
	 * @return the invocation result, if any
	 * @throws Throwable in case of invocation failure
	 * @see #invoke
	 */
	protected Object refreshAndRetry(MethodInvocation invocation) throws Throwable {
		try {
			refreshHome();
		}
		catch (NamingException ex) {
			throw new RemoteLookupFailureException("Failed to locate remote EJB [" + getJndiName() + "]", ex);
		}
		return doInvoke(invocation);
	}


	/**
	 * Perform the given invocation on the current EJB home.
	 * Template method to be implemented by a subclass.
	 * @param invocation the AOP method invocation
	 * @return the invocation result, if any
	 * @throws Throwable in case of invocation failure
	 * @see #getHome
	 * @see #newSessionBeanInstance
	 */
	protected abstract Object doInvoke(MethodInvocation invocation) throws Throwable;


	/**
	 * Return a new instance of the stateless session bean.
	 * To be invoked by concrete remote SLSB invoker subclasses.
	 * <p>Can be overridden to change the algorithm.
	 * @throws NamingException if thrown by JNDI
	 * @throws InvocationTargetException if thrown by the create method
	 * @see #create
	 */
	protected EJBObject newSessionBeanInstance() throws NamingException, InvocationTargetException {
		if (logger.isDebugEnabled()) {
			logger.debug("Trying to create reference to remote EJB");
		}

		// invoke the superclass' generic create method
		Object ejbInstance = create();
		if (!(ejbInstance instanceof EJBObject)) {
			throw new RemoteLookupFailureException(
					"EJB instance [" + ejbInstance + "] is not a Remote Stateless Session Bean");
		}
		// if it throws remote exception (wrapped in InvocationTargetException), retry?

		if (logger.isDebugEnabled()) {
			logger.debug("Obtained reference to remote EJB: " + ejbInstance);
		}
		return (EJBObject) ejbInstance;
	}

	/**
	 * Remove the given EJB instance.
	 * To be invoked by concrete remote SLSB invoker subclasses.
	 * @param ejb the EJB instance to remove
	 * @see javax.ejb.EJBObject#remove
	 */
	protected void removeSessionBeanInstance(EJBObject ejb) {
		if (ejb != null && !this.homeAsComponent) {
			try {
				ejb.remove();
			}
			catch (Throwable ex) {
				logger.warn("Could not invoke 'remove' on remote EJB proxy", ex);
			}
		}
	}

}

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
亚洲一区欧美一区| 亚洲激情成人在线| 成人99免费视频| 青青草国产精品97视觉盛宴| 国产欧美一区二区精品久导航| 在线视频欧美区| av一区二区三区黑人| 韩国一区二区视频| 日韩精品欧美精品| 亚洲精品伦理在线| 国产精品国产三级国产普通话三级| 欧美一区二区大片| 欧美日韩一区中文字幕| 99久久99久久精品国产片果冻| 韩国视频一区二区| 欧美aaa在线| 亚洲大片在线观看| 亚洲日本在线a| 国产精品色在线观看| 欧美不卡激情三级在线观看| 欧美日韩五月天| 91免费版在线看| 成人福利在线看| 国产精品88888| 黄页视频在线91| 另类小说欧美激情| 美女视频一区二区三区| 日韩精品五月天| 日韩黄色在线观看| 视频一区视频二区中文| 性欧美疯狂xxxxbbbb| 亚洲一区二区五区| 亚洲一区国产视频| 午夜精品在线视频一区| 亚洲国产精品久久不卡毛片| 一区二区三区四区亚洲| 一区二区三区波多野结衣在线观看| 日韩毛片视频在线看| 中文一区在线播放| 日韩毛片高清在线播放| 亚洲视频在线一区二区| 亚洲精选免费视频| 亚洲一区二区黄色| 亚洲bdsm女犯bdsm网站| 五月天亚洲婷婷| 免费在线看成人av| 激情文学综合网| 国产999精品久久久久久绿帽| 国产精品一品视频| 99久久er热在这里只有精品15| 91伊人久久大香线蕉| 色综合天天综合网天天看片| 91福利在线免费观看| 精品视频在线免费观看| 日韩一区二区三区四区五区六区| 69成人精品免费视频| 日韩欧美的一区二区| 精品少妇一区二区| 欧美精彩视频一区二区三区| 亚洲人精品一区| 亚洲一区二三区| 久久国产日韩欧美精品| 国产成人免费av在线| 99精品久久久久久| 欧美日韩三级视频| wwwwxxxxx欧美| 亚洲欧洲99久久| 亚洲成人免费视| 国产九色sp调教91| 91免费在线看| 日韩欧美在线一区二区三区| 国产精品视频在线看| 亚洲午夜电影在线| 精品一区二区三区在线播放| 波多野结衣在线aⅴ中文字幕不卡| 欧洲国产伦久久久久久久| 日韩女优av电影| 日韩毛片一二三区| 美女国产一区二区| 91在线视频网址| 4438亚洲最大| 中文字幕中文字幕一区二区| 性久久久久久久| 成人黄色国产精品网站大全在线免费观看| 欧美性生活影院| 久久蜜桃av一区二区天堂| 一区二区欧美视频| 国产精品资源站在线| 欧美日韩专区在线| 国产精品色噜噜| 久久99精品久久久久久| 色婷婷激情久久| 久久精品人人做人人爽人人| 亚洲gay无套男同| 99这里都是精品| 久久影院午夜论| 香蕉久久夜色精品国产使用方法 | 奇米影视在线99精品| 99在线精品观看| 久久久久久久一区| 日韩电影一二三区| 日本高清不卡在线观看| 日本一区二区在线不卡| 麻豆精品在线看| 欧美日韩成人在线一区| 亚洲少妇最新在线视频| 国产成人亚洲精品狼色在线| 欧美电影在线免费观看| 亚洲日本va在线观看| 国产成人在线影院| 精品国产免费人成电影在线观看四季 | 亚洲一区av在线| www.亚洲国产| 久久久美女毛片| 精品一区二区三区视频| 欧美高清性hdvideosex| 亚洲欧美福利一区二区| 国产成人免费视频网站高清观看视频| 欧美va亚洲va香蕉在线| 日韩av电影天堂| 5月丁香婷婷综合| 亚洲国产精品嫩草影院| 欧美性感一类影片在线播放| 亚洲免费资源在线播放| 波多野结衣亚洲一区| 国产精品色在线| www.日韩在线| 国产精品福利影院| 成人免费看视频| 日本一区二区不卡视频| 成人免费毛片app| 国产精品久久久久久久久免费桃花 | 欧美巨大另类极品videosbest| 亚洲小少妇裸体bbw| 欧美色区777第一页| 午夜欧美2019年伦理| 欧美男男青年gay1069videost| 婷婷中文字幕综合| 91精品国产综合久久久蜜臀图片 | 日韩av中文字幕一区二区三区| 欧美日韩国产综合一区二区| 亚洲成a天堂v人片| 日韩一区二区三区在线视频| 久久99这里只有精品| wwwwww.欧美系列| 成人免费观看视频| 亚洲人快播电影网| 欧美日韩高清不卡| 久久国产精品99久久久久久老狼| 精品国产欧美一区二区| 国产成人一区在线| 亚洲视频 欧洲视频| 欧美人与禽zozo性伦| 老司机午夜精品99久久| 国产天堂亚洲国产碰碰| 国产精品一区二区x88av| 91伊人久久大香线蕉| 日本乱码高清不卡字幕| 国产精品99久久久久久宅男| 99久久99久久久精品齐齐| 国产成人av电影在线观看| 午夜精品爽啪视频| 午夜成人免费视频| 一级中文字幕一区二区| 亚洲在线一区二区三区| 亚洲欧美国产77777| 日韩精品一二三四| 九色|91porny| 欧美日韩一区二区在线观看| 日本成人在线看| 久久女同性恋中文字幕| 91丨porny丨在线| 青青草成人在线观看| 亚洲国产激情av| 欧美日韩国产美女| 国产成人免费在线观看不卡| 亚洲国产精品综合小说图片区| 精品美女一区二区| 色94色欧美sute亚洲线路一ni| 老司机精品视频在线| 亚洲欧美偷拍三级| 日韩美一区二区三区| 91蜜桃视频在线| 久久成人久久爱| 91污片在线观看| xnxx国产精品| 久久久青草青青国产亚洲免观| 久久精品国产亚洲高清剧情介绍| 国产精品亚洲а∨天堂免在线| 91蜜桃免费观看视频| 国产精品视频一二三| 亚洲一区二区三区三| 亚洲主播在线观看| 色综合欧美在线视频区| 国产情人综合久久777777| 青青国产91久久久久久| 欧美色欧美亚洲另类二区| 亚洲一区二区三区在线| 在线精品国精品国产尤物884a| 一区二区三区视频在线看|