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


Java UnknownHostException类代码示例

本文整理汇总了Java中java.rmi.UnknownHostException的典型用法代码示例。如果您正苦于以下问题:Java UnknownHostException类的具体用法?Java UnknownHostException怎么用?Java UnknownHostException使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: getClientConnection

import java.rmi.UnknownHostException; //导入依赖的package包/类
static final AbstractClientConnection getClientConnection(Endpoint ep)
        throws IOException, UnknownHostException, ConnectException,
        ConnectIOException {
    Socket sock = null;
    AbstractClientConnection ret;
    
    RMIClientSocketFactory csf = (ep.getCsf() != null) ? ep.getCsf()
            : RMISocketFactory.getSocketFactory();
    if (csf == null) {
        csf = RMISocketFactory.getDefaultSocketFactory();
    }
    sock = csf.createSocket(ep.getEndpointID().getHost(), ep.getPort());
    if (SO_TIME_OUT != 0) {
        sock.setSoTimeout(SO_TIME_OUT);
    }
    sock.setTcpNoDelay(true);
    if (sock instanceof HttpSocketClientSide) {
        ret = new SingleOpClientConnection(sock, ep);
    } else {
        ret = new StreamClientConnection(sock, ep);
    }
    return ret;
}
 
开发者ID:freeVM,项目名称:freeVM,代码行数:24,代码来源:ClientConnectionFactory.java

示例2: retryRequest

import java.rmi.UnknownHostException; //导入依赖的package包/类
@Override
public boolean retryRequest(IOException exception, int executionCount, HttpContext context) {
	if (executionCount >= 3) {
		logger.info("Got too many exceptions");
           // Do not retry if over max retry count
           return false;
       }
       if (exception instanceof InterruptedIOException) {
           // Timeout
       	logger.info("Got interrupted exception");
           return true;
       }
       if (exception instanceof SocketException)
       {
       	logger.info("Got socket exception");
       	return true;
       }
       if (exception instanceof org.apache.http.NoHttpResponseException){
           logger.warn("got no http response exception");
           return true;
       }
       if (exception instanceof UnknownHostException) {
           // Unknown host
           return false;
       }
       if (exception instanceof ConnectTimeoutException) {
           // Connection refused
           return true;
       }
       if (exception instanceof SSLException) {
           // SSL handshake exception
           return false;
       }
       
       HttpClientContext clientContext = HttpClientContext.adapt(context);
       HttpRequest request = clientContext.getRequest();
       boolean idempotent = !(request instanceof HttpEntityEnclosingRequest);
       if (idempotent) {
           // Retry if the request is considered idempotent
           return true;
       }
       return false;
}
 
开发者ID:SeldonIO,项目名称:seldon-core,代码行数:44,代码来源:HttpRetryHandler.java

示例3: isLocalProblem

import java.rmi.UnknownHostException; //导入依赖的package包/类
public static boolean isLocalProblem(RemoteException e) {
    if (e instanceof ConnectIOException) {
        return true;
    } else if (e instanceof ConnectException) {
        return true;
    } else if (e instanceof UnknownHostException) {
        return true;
    }
    return false;
}
 
开发者ID:openNaEF,项目名称:openNaEF,代码行数:11,代码来源:ExceptionUtils.java

示例4: createNetSocket

import java.rmi.UnknownHostException; //导入依赖的package包/类
/** @see NetLayer#createNetSocket(Map, NetAddress, NetAddress) */
@Override
public NetSocket createNetSocket(final Map<String, Object> localProperties,
								 final NetAddress localAddress, 
								 final NetAddress remoteAddress)
		throws IOException
{
	final TcpipNetAddress r = (TcpipNetAddress) remoteAddress;

	// read (optional) properties
	final Integer timeoutInMs = PropertiesUtil.getAsInteger(localProperties, TIMEOUT_IN_MS, DEFAULT_TIMEOUT);

	// create connection and open socket
	final Socket socket = SocketGlobalUtil.createOriginalSocket();
	/*if (r.getIpaddress() != null)
	{
		final InetAddress remoteInetAddress = InetAddress.getByAddress(r.getIpaddress());
		final InetSocketAddress remoteInetSocketAddress = new InetSocketAddress(remoteInetAddress, r.getPort());
		socket.connect(remoteInetSocketAddress, timeoutInMs);
	}
	else
	{ */
		// use host name
		final InetSocketAddress remoteInetSocketAddress = new InetSocketAddress(r.getHostname(), r.getPort());
		if (remoteInetSocketAddress.getAddress() == null)
		{
			throw new UnknownHostException("hostlookup didnt worked. for Hostname : " + r.getHostname());
		}
		socket.connect(remoteInetSocketAddress, timeoutInMs);
	//}

	// convert and return result
	return new Socket2NetSocket(socket);
}
 
开发者ID:rovemonteux,项目名称:silvertunnel-monteux,代码行数:35,代码来源:TcpipNetLayer.java

示例5: launchGui

import java.rmi.UnknownHostException; //导入依赖的package包/类
private static void launchGui()
{
	String args[] = { "localhost" , "59125" };
	try
	{
		MaryGUIClient.main(args);
	}
	catch (UnknownHostException uhe) { Log.print(uhe); }
	catch (IOException ioe) { Log.print(ioe); }
	catch (Exception e) { Log.print(e); }
}
 
开发者ID:scbickle,项目名称:maryspeak,代码行数:12,代码来源:Maryspeak.java

示例6: testUnknownHostExceptionStringException

import java.rmi.UnknownHostException; //导入依赖的package包/类
/**
 * {@link java.rmi.UnknownHostException#UnknownHostException(java.lang.String, java.lang.Exception)}.
 */
public void testUnknownHostExceptionStringException() {
    NullPointerException npe = new NullPointerException();
    UnknownHostException e = new UnknownHostException("fixture", npe);
    assertTrue(e.getMessage().indexOf("fixture") > -1);
    assertSame(npe, e.getCause());
    assertSame(npe, e.detail);
}
 
开发者ID:shannah,项目名称:cn1,代码行数:11,代码来源:UnknownHostExceptionTest.java

示例7: testUnknownHostExceptionString

import java.rmi.UnknownHostException; //导入依赖的package包/类
/**
 * {@link java.rmi.UnknownHostException#UnknownHostException(java.lang.String)}.
 */
public void testUnknownHostExceptionString() {
    UnknownHostException e = new UnknownHostException("fixture");
    assertEquals("fixture", e.getMessage());
    assertNull(e.getCause());
    assertNull(e.detail);
}
 
开发者ID:shannah,项目名称:cn1,代码行数:10,代码来源:UnknownHostExceptionTest.java

示例8: rmiProxyFactoryBeanWithUnknownHostException

import java.rmi.UnknownHostException; //导入依赖的package包/类
@Test
public void rmiProxyFactoryBeanWithUnknownHostException() throws Exception {
	doTestRmiProxyFactoryBeanWithException(UnknownHostException.class);
}
 
开发者ID:langtianya,项目名称:spring4-understanding,代码行数:5,代码来源:RmiSupportTests.java

示例9: rmiProxyFactoryBeanWithUnknownHostExceptionAndRefresh

import java.rmi.UnknownHostException; //导入依赖的package包/类
@Test
public void rmiProxyFactoryBeanWithUnknownHostExceptionAndRefresh() throws Exception {
	doTestRmiProxyFactoryBeanWithExceptionAndRefresh(UnknownHostException.class);
}
 
开发者ID:langtianya,项目名称:spring4-understanding,代码行数:5,代码来源:RmiSupportTests.java

示例10: rmiProxyFactoryBeanWithBusinessInterfaceAndUnknownHostException

import java.rmi.UnknownHostException; //导入依赖的package包/类
@Test
public void rmiProxyFactoryBeanWithBusinessInterfaceAndUnknownHostException() throws Exception {
	doTestRmiProxyFactoryBeanWithBusinessInterfaceAndException(
			UnknownHostException.class, RemoteConnectFailureException.class);
}
 
开发者ID:langtianya,项目名称:spring4-understanding,代码行数:6,代码来源:RmiSupportTests.java

示例11: rmiProxyFactoryBeanWithBusinessInterfaceAndUnknownHostExceptionAndRefresh

import java.rmi.UnknownHostException; //导入依赖的package包/类
@Test
public void rmiProxyFactoryBeanWithBusinessInterfaceAndUnknownHostExceptionAndRefresh() throws Exception {
	doTestRmiProxyFactoryBeanWithBusinessInterfaceAndExceptionAndRefresh(
			UnknownHostException.class, RemoteConnectFailureException.class);
}
 
开发者ID:langtianya,项目名称:spring4-understanding,代码行数:6,代码来源:RmiSupportTests.java

示例12: testRmiProxyFactoryBeanWithUnknownHostException

import java.rmi.UnknownHostException; //导入依赖的package包/类
public void testRmiProxyFactoryBeanWithUnknownHostException() throws Exception {
	doTestRmiProxyFactoryBeanWithException(UnknownHostException.class);
}
 
开发者ID:deathspeeder,项目名称:class-guard,代码行数:4,代码来源:RmiSupportTests.java

示例13: testRmiProxyFactoryBeanWithUnknownHostExceptionAndRefresh

import java.rmi.UnknownHostException; //导入依赖的package包/类
public void testRmiProxyFactoryBeanWithUnknownHostExceptionAndRefresh() throws Exception {
	doTestRmiProxyFactoryBeanWithExceptionAndRefresh(UnknownHostException.class);
}
 
开发者ID:deathspeeder,项目名称:class-guard,代码行数:4,代码来源:RmiSupportTests.java

示例14: testRmiProxyFactoryBeanWithBusinessInterfaceAndUnknownHostException

import java.rmi.UnknownHostException; //导入依赖的package包/类
public void testRmiProxyFactoryBeanWithBusinessInterfaceAndUnknownHostException() throws Exception {
	doTestRmiProxyFactoryBeanWithBusinessInterfaceAndException(
			UnknownHostException.class, RemoteConnectFailureException.class);
}
 
开发者ID:deathspeeder,项目名称:class-guard,代码行数:5,代码来源:RmiSupportTests.java

示例15: testRmiProxyFactoryBeanWithBusinessInterfaceAndUnknownHostExceptionAndRefresh

import java.rmi.UnknownHostException; //导入依赖的package包/类
public void testRmiProxyFactoryBeanWithBusinessInterfaceAndUnknownHostExceptionAndRefresh() throws Exception {
	doTestRmiProxyFactoryBeanWithBusinessInterfaceAndExceptionAndRefresh(
			UnknownHostException.class, RemoteConnectFailureException.class);
}
 
开发者ID:deathspeeder,项目名称:class-guard,代码行数:5,代码来源:RmiSupportTests.java


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