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


Java Connection类代码示例

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


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

示例1: shedCache

import sun.rmi.transport.Connection; //导入依赖的package包/类
/**
 * Closes all the connections in the cache, whether timed out or not.
 */
public void shedCache() {
    // Build a list of connections, to avoid holding the freeList
    // lock during (potentially long-running) close() calls.
    Connection[] conn;
    synchronized (freeList) {
        conn = freeList.toArray(new Connection[freeList.size()]);
        freeList.clear();
    }

    // Close all the connections that were free
    for (int i = conn.length; --i >= 0; ) {
        Connection c = conn[i];
        conn[i] = null; // help gc
        try {
            c.close();
        } catch (java.io.IOException e) {
            // eat exception
        }
    }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:24,代码来源:TCPChannel.java

示例2: run

import sun.rmi.transport.Connection; //导入依赖的package包/类
/**
 * Give transport next accepted connection, when available.
 */
public void run() {
    Connection conn;

    synchronized (queue) {
        while (queue.size() == 0) {
            try {
                queue.wait();
            } catch (InterruptedException e) {
            }
        }
        startNewAcceptor();
        conn = queue.remove(0);
    }

    transport.handleMessages(conn, true);
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:20,代码来源:TCPChannel.java

示例3: run

import sun.rmi.transport.Connection; //导入依赖的package包/类
/**
 * Give transport next accepted conection, when available.
 */
public void run() {
    Connection conn;

    synchronized (queue) {
        while (queue.size() == 0) {
            try {
                queue.wait();
            } catch (InterruptedException e) {
            }
        }
        startNewAcceptor();
        conn = queue.remove(0);
    }

    transport.handleMessages(conn, true);
}
 
开发者ID:openjdk,项目名称:jdk7-jdk,代码行数:20,代码来源:TCPChannel.java

示例4: acceptMultiplexConnection

import sun.rmi.transport.Connection; //导入依赖的package包/类
/**
 * Accept a connection provided over a multiplexed channel.
 */
void acceptMultiplexConnection(Connection conn) {
    if (acceptor == null) {
        acceptor = new ConnectionAcceptor(tr);
        acceptor.startNewAcceptor();
    }
    acceptor.accept(conn);
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:11,代码来源:TCPChannel.java

示例5: accept

import sun.rmi.transport.Connection; //导入依赖的package包/类
/**
 * Add connection to queue of connections to be accepted.
 */
public void accept(Connection conn) {
    synchronized (queue) {
        queue.add(conn);
        queue.notify();
    }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:10,代码来源:TCPChannel.java


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