• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java ConnectIOException类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: getRealRun

import java.rmi.ConnectIOException; //导入依赖的package包/类
@Override
protected RemoteSingleRun getRealRun(UsernamePrincipal creator,
		Workflow workflow, UUID id) throws Exception {
	@Nonnull
	byte[] wf = serializeWorkflow(workflow);
	for (int i = 0; i < 3; i++) {
		initFactory();
		try {
			return getRealRun(creator, wf, id);
		} catch (ConnectException | ConnectIOException e) {
			// factory was lost; try to recreate
		}
		killFactory();
	}
	throw new NoCreateException("total failure to connect to factory "
			+ factoryProcessName + "despite attempting restart");
}
 
开发者ID:apache,项目名称:incubator-taverna-server,代码行数:18,代码来源:ForkRunFactory.java


示例2: getRealRun

import java.rmi.ConnectIOException; //导入依赖的package包/类
@Override
protected RemoteSingleRun getRealRun(UsernamePrincipal creator,
		Workflow workflow, UUID id) throws Exception {
	byte[] wf = serializeWorkflow(workflow);
	String username = mapper == null ? null : mapper
			.getUsernameForPrincipal(creator);
	if (username == null)
		throw new Exception("cannot determine who to run workflow as; "
				+ "local identity mapper returned null");
	for (int i = 0; i < 3; i++) {
		if (!factory.containsKey(username))
			initFactory(username);
		try {
			return getRealRun(creator, username, wf, id);
		} catch (ConnectException | ConnectIOException e) {
			// factory was lost; try to recreate
		}
		factory.remove(username);
	}
	throw new NoCreateException("total failure to connect to factory "
			+ factoryProcessName + "despite attempting restart");
}
 
开发者ID:apache,项目名称:incubator-taverna-server,代码行数:23,代码来源:IdAwareForkRunFactory.java


示例3: RmiTransport

import java.rmi.ConnectIOException; //导入依赖的package包/类
public RmiTransport(ClientMonitor clientMonitor, ScheduledExecutorService executorService, ConnectionPinger connectionPinger, SocketDetails addr) throws ConnectionException {

        super(clientMonitor, executorService, connectionPinger, RmiTransport.class.getClassLoader());

        url = "rmi://" + addr.getHostName() + ":" + addr.getPort() + "/" + RmiInvoker.class.getName();

        try {
            rmiInvoker = (RmiInvoker) Naming.lookup(url);
        } catch (NotBoundException nbe) {
            throw new ConnectionException("Cannot bind to the remote RMI service.  Either an IP or RMI issue.");
        } catch (MalformedURLException mfue) {
            throw new ConnectionException("Malformed URL, host/port (" + addr.getHostName() + "/" + addr.getPort() + ") must be wrong: " + mfue.getMessage());
        } catch (ConnectIOException cioe) {
            throw new ConnectionException("Cannot connect to remote RMI server. " + "It is possible that transport mismatch", cioe);
        } catch (RemoteException re) {
            throw new ConnectionException("Unknown Remote Exception : " + re.getMessage());
        }
    }
 
开发者ID:paul-hammant,项目名称:JRemoting,代码行数:19,代码来源:RmiTransport.java


示例4: writeHeader

import java.rmi.ConnectIOException; //导入依赖的package包/类
/**
 * Writes RMI protocol header and RMI protocol version to the open
 * OutputStream.
 *
 * @param dout DataOutputStream to write header to
 *
 * @throws RemoteException if any I/O error occurred while writing header
 */
protected void writeHeader(DataOutputStream dout) throws RemoteException {
    try {
        dout.writeInt(RMI_HEADER);
        dout.writeShort(PROTOCOL_VER);
    } catch (IOException ioe) {
        // rmi.41=Unable to write RMI protocol header
        throw new ConnectIOException(Messages.getString("rmi.41"), ioe); //$NON-NLS-1$
    }

    if (transportLog.isLoggable(RMILog.VERBOSE)) {
        // rmi.log.94=Using protocol version {0}
        transportLog.log(RMILog.VERBOSE, Messages.getString("rmi.log.94", //$NON-NLS-1$
                PROTOCOL_VER));
    }
}
 
开发者ID:shannah,项目名称:cn1,代码行数:24,代码来源:ClientConnection.java


示例5: createSocket

import java.rmi.ConnectIOException; //导入依赖的package包/类
/**
 * Creates and returns socket.
 *
 * @return created socket
 */
public Socket createSocket() throws RemoteException {
    Socket s;

    try {
        s = DefaultRMISocketFactory.getNonNullClientFactory(csf)
                .createSocket(host, port);
    } catch (java.net.UnknownHostException uhe) {
        // rmi.80=Unable to connect to server {0}
        throw new java.rmi.UnknownHostException(
                Messages.getString("rmi.80", toString()), uhe); //$NON-NLS-1$
    } catch (java.net.ConnectException ce) {
        throw new java.rmi.ConnectException(
                Messages.getString("rmi.80", toString()), ce); //$NON-NLS-1$
    } catch (IOException ioe) {
        throw new ConnectIOException(
                Messages.getString("rmi.80", toString()), ioe); //$NON-NLS-1$
    }
    return s;
}
 
开发者ID:shannah,项目名称:cn1,代码行数:25,代码来源:Endpoint.java


示例6: AbstractClientConnection

import java.rmi.ConnectIOException; //导入依赖的package包/类
/**
 * Creates a new connection to the specified
 * {@link org.apache.harmony.rmi.internal.transport.Endpoint} using the underlying
 * {@link java.net.Socket}
 * 
 * @param sock
 *            the {@link java.net.Socket} to which the connection belongs
 * @param ep
 *            the {@link org.apache.harmony.rmi.internal.transport.Endpoint} for this
 *            connection
 * @throws ConnectIOException
 *             if an IOException occurs while making a connection to the
 *             remote host
 */
public AbstractClientConnection(Socket sock, Endpoint ep)
        throws ConnectIOException {
    this.ep = ep;
    this.lastUsageTime = null;
    clientConnectionID = ++clientConnectionCounter;
    this.sock = sock;
    try {
        this.out = new DataOutputStream(new BufferedOutputStream(sock
                .getOutputStream()));
        this.in = new DataInputStream(new BufferedInputStream(sock
                .getInputStream()));
    } catch (IOException e) {
        throw new ConnectIOException("I/O exception Creating Connection", e);
    }
    protocolHandler = new ClientProtocolHandler(this.in, this.out);
}
 
开发者ID:freeVM,项目名称:freeVM,代码行数:31,代码来源:AbstractClientConnection.java


示例7: getClientConnection

import java.rmi.ConnectIOException; //导入依赖的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


示例8: AbstractClientConnection

import java.rmi.ConnectIOException; //导入依赖的package包/类
/**
 * Creates a new connection to the specified
 * {@link ar.org.fitc.rmi.transport.Endpoint} using the underlying
 * {@link java.net.Socket}
 * 
 * @param sock
 *            the {@link java.net.Socket} to which the connection belongs
 * @param ep
 *            the {@link ar.org.fitc.rmi.transport.Endpoint} for this
 *            connection
 * @throws ConnectIOException
 *             if an IOException occurs while making a connection to the
 *             remote host
 */
public AbstractClientConnection(Socket sock, Endpoint ep)
        throws ConnectIOException {
    this.ep = ep;
    this.lastUsageTime = null;
    clientConnectionID = ++clientConnectionCounter;
    this.sock = sock;
    try {
        this.out = new DataOutputStream(new BufferedOutputStream(sock
                .getOutputStream()));
        this.in = new DataInputStream(new BufferedInputStream(sock
                .getInputStream()));
    } catch (IOException e) {
        throw new ConnectIOException("I/O exception Creating Connection", e);
    }
    protocolHandler = new ClientProtocolHandler(this.in, this.out);
}
 
开发者ID:freeVM,项目名称:freeVM,代码行数:31,代码来源:AbstractClientConnection.java


示例9: writeTransportHeader

import java.rmi.ConnectIOException; //导入依赖的package包/类
/**
 * Send transport header over stream.
 */
private void writeTransportHeader(DataOutputStream out)
    throws RemoteException
{
    try {
        // write out transport header
        DataOutputStream dataOut =
            new DataOutputStream(out);
        dataOut.writeInt(TransportConstants.Magic);
        dataOut.writeShort(TransportConstants.Version);
    } catch (IOException e) {
        throw new ConnectIOException(
            "error writing JRMP transport header", e);
    }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:18,代码来源:TCPChannel.java


示例10: isLocalProblem

import java.rmi.ConnectIOException; //导入依赖的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


示例11: getRemoteFactoryHandle

import java.rmi.ConnectIOException; //导入依赖的package包/类
private RemoteRunFactory getRemoteFactoryHandle(String name)
		throws RemoteException, NotBoundException {
	log.info("about to look up resource called " + name);
	try {
		// Validate registry connection first
		getTheRegistry().list();
	} catch (ConnectException | ConnectIOException e) {
		log.warn("connection problems with registry", e);
	}
	RemoteRunFactory rrf = (RemoteRunFactory) getTheRegistry().lookup(name);
	log.info("successfully connected to factory subprocess "
			+ factoryProcessName);
	return rrf;
}
 
开发者ID:apache,项目名称:incubator-taverna-server,代码行数:15,代码来源:ForkRunFactory.java


示例12: serverProtocolAck

import java.rmi.ConnectIOException; //导入依赖的package包/类
/**
 * Acknowledge protocol with server side.
 *
 * @return acknowledged protocol number
 *
 * @throws RemoteException if any I/O exception occurred during protocol
 *         acknowledgement
 */
protected int serverProtocolAck() throws RemoteException {
    try {
        DataOutputStream dout = new DataOutputStream(out);

        // write RMI header and protocol version
        writeHeader(dout);

        // write protocol type
        dout.writeByte(SINGLEOP_PROTOCOL);
        dout.flush();

        if (proxyTransportLog.isLoggable(RMILog.VERBOSE)) {
            // rmi.log.130=Using singleop RMI protocol
            proxyTransportLog.log(RMILog.VERBOSE,Messages.getString("rmi.log.130")); //$NON-NLS-1$
        }
        dout.flush();
    } catch (RemoteException re) {
        close();
        throw re;
    } catch (IOException ioe) {
        close();
        // rmi.8E=Unable to acknowledge protocol with server
        throw new ConnectIOException(Messages.getString("rmi.8E"), ioe); //$NON-NLS-1$
    }

    // protocol is agreed
    return SINGLEOP_PROTOCOL;
}
 
开发者ID:shannah,项目名称:cn1,代码行数:37,代码来源:HttpConnection.java


示例13: testConnectIOExceptionStringException

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


示例14: testConnectIOExceptionString

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


示例15: main

import java.rmi.ConnectIOException; //导入依赖的package包/类
public static void main(String[] args) throws Exception {

        System.setProperty("sun.rmi.transport.tcp.handshakeTimeout",
                           String.valueOf(TIMEOUT / 2));

        /*
         * Listen on port, but never process connections made to it.
         */
        ServerSocket serverSocket = new ServerSocket(PORT);

        /*
         * Attempt RMI call to port in separate thread.
         */
        Registry registry = LocateRegistry.getRegistry(PORT);
        Connector connector = new Connector(registry);
        Thread t = new Thread(connector);
        t.setDaemon(true);
        t.start();

        /*
         * Wait for call attempt to finished, and analyze result.
         */
        t.join(TIMEOUT);
        synchronized (connector) {
            if (connector.success) {
                throw new RuntimeException(
                    "TEST FAILED: remote call succeeded??");
            }
            if (connector.exception == null) {
                throw new RuntimeException(
                    "TEST FAILED: remote call did not time out");
            } else {
                System.err.println("remote call failed with exception:");
                connector.exception.printStackTrace();
                System.err.println();

                if (connector.exception instanceof MarshalException) {
                    System.err.println(
                        "TEST FAILED: MarshalException thrown, expecting " +
                        "java.rmi.ConnectException or ConnectIOException");
                } else if (connector.exception instanceof ConnectException ||
                           connector.exception instanceof ConnectIOException)
                {
                    System.err.println(
                        "TEST PASSED: java.rmi.ConnectException or " +
                        "ConnectIOException thrown");
                } else {
                    throw new RuntimeException(
                        "TEST FAILED: unexpected Exception thrown",
                        connector.exception);
                }
            }
        }
    }
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:55,代码来源:HandshakeTimeout.java


示例16: main

import java.rmi.ConnectIOException; //导入依赖的package包/类
public static void main(String[] args) throws Exception {

        /*
         * Listen on port...
         */
        ServerSocket serverSocket = new ServerSocket(PORT);

        /*
         * (Attempt RMI call to port in separate thread.)
         */
        Registry registry = LocateRegistry.getRegistry(PORT);
        Connector connector = new Connector(registry);
        Thread t = new Thread(connector);
        t.setDaemon(true);
        t.start();

        /*
         * ...accept one connection from port and send non-JRMP data.
         */
        Socket socket = serverSocket.accept();
        socket.getOutputStream().write("Wrong way".getBytes());
        socket.close();

        /*
         * Wait for call attempt to finish, and analyze result.
         */
        t.join(TIMEOUT);
        synchronized (connector) {
            if (connector.success) {
                throw new RuntimeException(
                    "TEST FAILED: remote call succeeded??");
            }
            if (connector.exception == null) {
                throw new RuntimeException(
                    "TEST FAILED: remote call did not time out");
            } else {
                System.err.println("remote call failed with exception:");
                connector.exception.printStackTrace();
                System.err.println();

                if (connector.exception instanceof MarshalException) {
                    System.err.println(
                        "TEST FAILED: MarshalException thrown, expecting " +
                        "java.rmi.ConnectException or ConnectIOException");
                } else if (connector.exception instanceof ConnectException ||
                           connector.exception instanceof ConnectIOException)
                {
                    System.err.println(
                        "TEST PASSED: java.rmi.ConnectException or " +
                        "ConnectIOException thrown");
                } else {
                    throw new RuntimeException(
                        "TEST FAILED: unexpected Exception thrown",
                        connector.exception);
                }
            }
        }
    }
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:59,代码来源:HandshakeFailure.java


示例17: main

import java.rmi.ConnectIOException; //导入依赖的package包/类
public static void main(String[] args) throws Exception {

        System.setProperty("sun.rmi.transport.tcp.handshakeTimeout",
                           String.valueOf(TIMEOUT / 2));

        /*
         * Listen on port, but never process connections made to it.
         */
        ServerSocket serverSocket = new ServerSocket(0);
        int port = serverSocket.getLocalPort();

        /*
         * Attempt RMI call to port in separate thread.
         */
        Registry registry = LocateRegistry.getRegistry(port);
        Connector connector = new Connector(registry);
        Thread t = new Thread(connector);
        t.setDaemon(true);
        t.start();

        /*
         * Wait for call attempt to finished, and analyze result.
         */
        t.join(TIMEOUT);
        synchronized (connector) {
            if (connector.success) {
                throw new RuntimeException(
                    "TEST FAILED: remote call succeeded??");
            }
            if (connector.exception == null) {
                throw new RuntimeException(
                    "TEST FAILED: remote call did not time out");
            } else {
                System.err.println("remote call failed with exception:");
                connector.exception.printStackTrace();
                System.err.println();

                if (connector.exception instanceof MarshalException) {
                    throw new RuntimeException(
                        "TEST FAILED: MarshalException thrown, expecting " +
                        "java.rmi.ConnectException or ConnectIOException");
                } else if (connector.exception instanceof ConnectException ||
                           connector.exception instanceof ConnectIOException)
                {
                    System.err.println(
                        "TEST PASSED: java.rmi.ConnectException or " +
                        "ConnectIOException thrown");
                } else {
                    throw new RuntimeException(
                        "TEST FAILED: unexpected Exception thrown",
                        connector.exception);
                }
            }
        }
    }
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:56,代码来源:HandshakeTimeout.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java SimpleOAuthValidator类代码示例发布时间:2022-05-21
下一篇:
Java SplitLayoutPanel类代码示例发布时间:2022-05-21
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap