本文整理汇总了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
}
}
}
示例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);
}
示例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);
}
示例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);
}
示例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();
}
}