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


Java CloseFuture类代码示例

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


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

示例1: doStop

import org.apache.mina.core.future.CloseFuture; //导入依赖的package包/类
@Override
protected void doStop() throws Exception {
    if (configuration.isClientMode() && configuration.getProtocol().equals("tcp")) {
        LOG.info("Disconnect from server address: {} using connector: {}", address, connector);
        if (session != null) {
            CloseFuture closeFuture = session.close(true);
            closeFuture.awaitUninterruptibly();
        }
        connector.dispose(true);
    } else {
        LOG.info("Unbinding from server address: {} using acceptor: {}", address, acceptor);
        if (address instanceof InetSocketAddress) {
            // need to check if the address is IPV4 all network address
            if ("0.0.0.0".equals(((InetSocketAddress)address).getAddress().getHostAddress())) {
                LOG.info("Unbind the server address {}", acceptor.getLocalAddresses());
                acceptor.unbind(acceptor.getLocalAddresses());
            } else {
                acceptor.unbind(address);
            }
        } else {
            acceptor.unbind(address);
        }
    }
    super.doStop();
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:26,代码来源:Mina2Consumer.java

示例2: operationComplete

import org.apache.mina.core.future.CloseFuture; //导入依赖的package包/类
public void operationComplete(CloseFuture future) {
    AbstractIoSession session = (AbstractIoSession) future.getSession();
    session.scheduledWriteBytes.set(0);
    session.scheduledWriteMessages.set(0);
    session.readBytesThroughput = 0;
    session.readMessagesThroughput = 0;
    session.writtenBytesThroughput = 0;
    session.writtenMessagesThroughput = 0;
}
 
开发者ID:eclipse,项目名称:neoscada,代码行数:10,代码来源:AbstractIoSession.java

示例3: close

import org.apache.mina.core.future.CloseFuture; //导入依赖的package包/类
/**
 * {@inheritDoc}
 */
public final CloseFuture close(boolean rightNow) {
    if (!isClosing()) {
        if (rightNow) {
            return close();
        }

        return closeOnFlush();
    } else {
        return closeFuture;
    }
}
 
开发者ID:eclipse,项目名称:neoscada,代码行数:15,代码来源:AbstractIoSession.java

示例4: addSession

import org.apache.mina.core.future.CloseFuture; //导入依赖的package包/类
/**
 * Add the session for being checked for idle. 
 * @param session the session to check
 */
public void addSession(AbstractIoSession session) {
    sessions.add(session);
    CloseFuture closeFuture = session.getCloseFuture();

    // isn't service reponsability to remove the session nicely ?
    closeFuture.addListener(sessionCloseListener);
}
 
开发者ID:eclipse,项目名称:neoscada,代码行数:12,代码来源:IdleStatusChecker.java

示例5: closeConnection

import org.apache.mina.core.future.CloseFuture; //导入依赖的package包/类
private void closeConnection() {
    if (session != null) {
        CloseFuture closeFuture = session.close(true);
        closeFuture.awaitUninterruptibly();
    }

    connector.dispose(true);
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:9,代码来源:Mina2Producer.java

示例6: close

import org.apache.mina.core.future.CloseFuture; //导入依赖的package包/类
@Override
public void close() throws IOException {
	CloseFuture closeFuture = session.close(false);
	closeFuture.awaitUninterruptibly();
	if (!closeFuture.isClosed())
		throw new IOException("Session not closed");
}
 
开发者ID:ugcs,项目名称:ugcs-java-sdk,代码行数:8,代码来源:MinaMessageSession.java

示例7: run

import org.apache.mina.core.future.CloseFuture; //导入依赖的package包/类
/**
 * Run the test suites.
 */
public void run() {
	logger.info("client runs");
	try {
		for ( currentIndex = 0; currentIndex < this.testcases.size(); currentIndex++ ) {
			Class clazz = this.testcaseClasses.get(currentIndex);
			Object object = this.testcases.get(currentIndex);
			
			ProtoTest protoTest = (ProtoTest) clazz.getAnnotation(ProtoTest.class);
			int times = protoTest.times();
			
			logger.info("run the " + this.testcaseClasses.get(currentIndex) + " cases for " + times + " times.");
			
			for ( int i=0; i<times; i++ ) {
				Method method = clazz.getDeclaredMethod("generateMessge", Map.class);
				MessageLite request = (MessageLite)method.invoke(object, context);
				sendRequest(request);

				sema.acquire();
			}
		}
		
		if ( !longRunning ) {
			CloseFuture future = session.close(false);
			future.await();
			logger.info("client exit");
		}
		
	} catch (Throwable e) {
		logger.error(e.getMessage(), e);
	}
}
 
开发者ID:wangqi,项目名称:gameserver,代码行数:35,代码来源:Client.java

示例8: disconnect

import org.apache.mina.core.future.CloseFuture; //导入依赖的package包/类
/**
 * disconnect existing connection to LLRP device.
 */

public void disconnect(){
	//IoSession session = future.getSession();
	if (session != null && session.isConnected()){
		CloseFuture future = session.close();
		// MINA 2.0
		// future.awaitUninterruptibly();
	}
}
 
开发者ID:gs1oliot,项目名称:oliot-fc,代码行数:13,代码来源:LLRPConnector.java

示例9: closeOnFlush

import org.apache.mina.core.future.CloseFuture; //导入依赖的package包/类
@SuppressWarnings("unchecked")
@Override
public final CloseFuture closeOnFlush() {
	if (!isClosing()) {
		getWriteRequestQueue().offer(CLOSE_REQUEST);
		getProcessor().flush(this);
	}

	return closeFuture;
}
 
开发者ID:dwing4g,项目名称:jane,代码行数:11,代码来源:AbstractIoSession.java

示例10: closeNow

import org.apache.mina.core.future.CloseFuture; //导入依赖的package包/类
@Override
public final CloseFuture closeNow() {
	synchronized (closeFuture) {
		if (isClosing()) {
			return closeFuture;
		}

		closing = true;
	}

	getFilterChain().fireFilterClose();

	return closeFuture;
}
 
开发者ID:dwing4g,项目名称:jane,代码行数:15,代码来源:AbstractIoSession.java

示例11: disconnect

import org.apache.mina.core.future.CloseFuture; //导入依赖的package包/类
/** {@inheritDoc} */
@Override
public void disconnect() {
    if (future != null) {
        try {
            // session will be null if connect failed
            if (session != null) {
                // close, now
                CloseFuture closeFuture = session.closeNow();
                // now wait for the close to be completed
                if (closeFuture.await(1000, TimeUnit.MILLISECONDS)) {
                    if (!future.isCanceled()) {
                        if (future.cancel()) {
                            log.debug("Connect future cancelled after close future");
                        }
                    }
                }
            } else if (future.cancel()) {
                log.debug("Connect future cancelled");
            }
        } catch (Exception e) {
            log.warn("Exception during disconnect", e);
        } finally {
            // we can now dispose the connector
            socketConnector.dispose(false);
        }
    }
    super.disconnect();
}
 
开发者ID:Red5,项目名称:red5-client,代码行数:30,代码来源:RTMPClient.java

示例12: getCloseFuture

import org.apache.mina.core.future.CloseFuture; //导入依赖的package包/类
/**
 * {@inheritDoc}
 */
public final CloseFuture getCloseFuture() {
    return closeFuture;
}
 
开发者ID:eclipse,项目名称:neoscada,代码行数:7,代码来源:AbstractIoSession.java

示例13: closeOnFlush

import org.apache.mina.core.future.CloseFuture; //导入依赖的package包/类
private final CloseFuture closeOnFlush() {
    getWriteRequestQueue().offer(this, CLOSE_REQUEST);
    getProcessor().flush(this);
    return closeFuture;
}
 
开发者ID:eclipse,项目名称:neoscada,代码行数:6,代码来源:AbstractIoSession.java

示例14: close

import org.apache.mina.core.future.CloseFuture; //导入依赖的package包/类
@Override
public ChannelHandler close() {
    CloseFuture closeFuture = session.close(false);
    return new MinaChannelHandler(closeFuture);
}
 
开发者ID:WenZuHuai,项目名称:light-task-scheduler,代码行数:6,代码来源:MinaChannel.java

示例15: close

import org.apache.mina.core.future.CloseFuture; //导入依赖的package包/类
@Override
public CloseFuture close(boolean bln) {
    return null;
}
 
开发者ID:icelemon1314,项目名称:mapleLemon,代码行数:5,代码来源:MockIOSession.java


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