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

Java IoSessionConfig类代码示例

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

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



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

示例1: testFrames

import org.apache.mina.core.session.IoSessionConfig; //导入依赖的package包/类
protected void testFrames ( final String resourceName, final Frame... expectedFrames ) throws Exception
{
    final FrameDecoder decoder = new FrameDecoder ();
    final MockProtocolDecoderOutput out = new MockProtocolDecoderOutput ();
    final DummySession session = new DummySession ();

    session.setTransportMetadata ( new DefaultTransportMetadata ( "eclipse.scada", "test", false, true, SocketAddress.class, IoSessionConfig.class, Object.class ) );

    for ( final IoBuffer data : BufferLoader.loadBuffersFromResource ( FrameDecoderTest.class, resourceName ) )
    {
        System.out.println ( "Pushing data packet - " + data.getHexDump () );
        decoder.decode ( session, data, out );
    }

    out.assertMessages ( expectedFrames );
}
 
开发者ID:eclipse,项目名称:neoscada,代码行数:17,代码来源:FrameDecoderTest.java


示例2: serverStart

import org.apache.mina.core.session.IoSessionConfig; //导入依赖的package包/类
@Override
protected void serverStart() throws RemotingException {

    acceptor = new NioSocketAcceptor(); //TCP Acceptor

    // acceptor.getFilterChain().addFirst("logging", new MinaLoggingFilter());
    acceptor.getFilterChain().addLast("codec", new ProtocolCodecFilter(new MinaCodecFactory(getCodec())));
    acceptor.getFilterChain().addLast("mdc", new MdcInjectionFilter());

    acceptor.setHandler(new MinaHandler(this));
    IoSessionConfig cfg = acceptor.getSessionConfig();
    cfg.setReaderIdleTime(remotingServerConfig.getReaderIdleTimeSeconds());
    cfg.setWriterIdleTime(remotingServerConfig.getWriterIdleTimeSeconds());
    cfg.setBothIdleTime(remotingServerConfig.getServerChannelMaxIdleTimeSeconds());

    bindAddress = new InetSocketAddress(remotingServerConfig.getListenPort());
    try {
        acceptor.bind(bindAddress);
    } catch (IOException e) {
        throw new RemotingException("Start Mina server error", e);
    }
}
 
开发者ID:WenZuHuai,项目名称:light-task-scheduler,代码行数:23,代码来源:MinaRemotingServer.java


示例3: clientStart

import org.apache.mina.core.session.IoSessionConfig; //导入依赖的package包/类
@Override
protected void clientStart() throws RemotingException {
    try {
        connector = new NioSocketConnector(); //TCP Connector

        // connector.getFilterChain().addFirst("logging", new MinaLoggingFilter());
        connector.getFilterChain().addLast("codec", new ProtocolCodecFilter(new MinaCodecFactory(getCodec())));
        connector.getFilterChain().addLast("mdc", new MdcInjectionFilter());

        connector.setHandler(new MinaHandler(this));
        IoSessionConfig cfg = connector.getSessionConfig();
        cfg.setReaderIdleTime(remotingClientConfig.getReaderIdleTimeSeconds());
        cfg.setWriterIdleTime(remotingClientConfig.getWriterIdleTimeSeconds());
        cfg.setBothIdleTime(remotingClientConfig.getClientChannelMaxIdleTimeSeconds());
    } catch (Exception e) {
        throw new RemotingException("Mina Client start error", e);
    }
}
 
开发者ID:WenZuHuai,项目名称:light-task-scheduler,代码行数:19,代码来源:MinaRemotingClient.java


示例4: handleHostQuit

import org.apache.mina.core.session.IoSessionConfig; //导入依赖的package包/类
/**
 * Handles host's attempt to quit game
 */
public static void handleHostQuit(IoSession session, Packet pktIn, Queue<Packet> queue, Connection con) throws MGOException {
	int uid = (Integer) session.getAttribute("userid");

	//Update database
	ResultSet rs = null;
	PreparedStatement stmt = null;
	try {
		//Delete game, due to table relationship with players; players will be deleted automatically
		stmt = con.prepareStatement("DELETE FROM games WHERE host_id=?");
		stmt.setInt(1,uid);
		stmt.executeUpdate();
	} catch(SQLException e) {
		//Fail silently, failing here causes problems
	}
	//Set idle time
	IoSessionConfig ic= session.getConfig();
	ic.setIdleTime(IdleStatus.READER_IDLE, 900); //10Minutes
	//Send reply
	queue.add(new Packet(0x4381,new byte[4]));

}
 
开发者ID:curi0us,项目名称:mgops,代码行数:25,代码来源:LobbyHost.java


示例5: AbstractIoService

import org.apache.mina.core.session.IoSessionConfig; //导入依赖的package包/类
/**
 * Constructor for {@link AbstractIoService}. You need to provide a default
 * session configuration and an {@link Executor} for handling I/O events. If
 * a null {@link Executor} is provided, a default one will be created using
 * {@link Executors#newCachedThreadPool()}.
 * 
 * @param sessionConfig
 *            the default configuration for the managed {@link IoSession}
 * @param executor
 *            the {@link Executor} used for handling execution of I/O
 *            events. Can be <code>null</code>.
 */
protected AbstractIoService(IoSessionConfig sessionConfig, Executor executor) {
    if (sessionConfig == null) {
        throw new IllegalArgumentException("sessionConfig");
    }

    if (getTransportMetadata() == null) {
        throw new IllegalArgumentException("TransportMetadata");
    }

    if (!getTransportMetadata().getSessionConfigType().isAssignableFrom(sessionConfig.getClass())) {
        throw new IllegalArgumentException("sessionConfig type: " + sessionConfig.getClass() + " (expected: "
                + getTransportMetadata().getSessionConfigType() + ")");
    }

    // Create the listeners, and add a first listener : a activation listener
    // for this service, which will give information on the service state.
    listeners = new IoServiceListenerSupport(this);
    listeners.add(serviceActivationListener);

    // Stores the given session configuration
    this.sessionConfig = sessionConfig;

    // Make JVM load the exception monitor before some transports
    // change the thread context class loader.
    ExceptionMonitor.getInstance();

    if (executor == null) {
        this.executor = Executors.newCachedThreadPool();
        createdExecutor = true;
    } else {
        this.executor = executor;
        createdExecutor = false;
    }

    threadName = getClass().getSimpleName() + '-' + id.incrementAndGet();
}
 
开发者ID:eclipse,项目名称:neoscada,代码行数:49,代码来源:AbstractIoService.java


示例6: sessionCreated

import org.apache.mina.core.session.IoSessionConfig; //导入依赖的package包/类
public void sessionCreated(IoSession session) {
System.out.println("Session created");
IoSessionConfig sessionConfig=session.getConfig();

if (false) {
    MessageLoop rb = new MessageLoop();
    rb.session = session;
    Thread t = new Thread(rb);

    t.start();
}
   }
 
开发者ID:sics-sse,项目名称:moped,代码行数:13,代码来源:ServerHandler.java


示例7: adjustReadBufferSize

import org.apache.mina.core.session.IoSessionConfig; //导入依赖的package包/类
private void adjustReadBufferSize(IoSession session) {
	int maxReadThroughput = this.maxReadThroughput;
	if (maxReadThroughput == 0) {
		return;
	}
	IoSessionConfig config = session.getConfig();
	if (config.getReadBufferSize() > maxReadThroughput) {
		config.setReadBufferSize(maxReadThroughput);
	}
	if (config.getMaxReadBufferSize() > maxReadThroughput) {
		config.setMaxReadBufferSize(maxReadThroughput);
	}
}
 
开发者ID:cwpenhale,项目名称:red5-mobileconsole,代码行数:14,代码来源:TrafficShapingFilter.java


示例8: ProxyConnector

import org.apache.mina.core.session.IoSessionConfig; //导入依赖的package包/类
/**
 * Creates a new proxy connector. 
 * @see AbstractIoConnector(IoSessionConfig, Executor).
 */
public ProxyConnector(final SocketConnector connector, IoSessionConfig config, Executor executor) {
    super(config, executor);
    setConnector(connector);
}
 
开发者ID:eclipse,项目名称:neoscada,代码行数:9,代码来源:ProxyConnector.java


示例9: getSessionConfig

import org.apache.mina.core.session.IoSessionConfig; //导入依赖的package包/类
/**
 * {@inheritDoc}
 */
@Override
public IoSessionConfig getSessionConfig() {
    return connector.getSessionConfig();
}
 
开发者ID:eclipse,项目名称:neoscada,代码行数:8,代码来源:ProxyConnector.java


示例10: doSetAll

import org.apache.mina.core.session.IoSessionConfig; //导入依赖的package包/类
@Override
protected void doSetAll(IoSessionConfig config) {
    // Do nothing
}
 
开发者ID:eclipse,项目名称:neoscada,代码行数:5,代码来源:DefaultVmPipeSessionConfig.java


示例11: getSessionConfig

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


示例12: DefaultTransportMetadata

import org.apache.mina.core.session.IoSessionConfig; //导入依赖的package包/类
public DefaultTransportMetadata(String providerName, String name, boolean connectionless, boolean fragmentation,
        Class<? extends SocketAddress> addressType, Class<? extends IoSessionConfig> sessionConfigType,
        Class<?>... envelopeTypes) {

    if (providerName == null) {
        throw new IllegalArgumentException("providerName");
    }
    if (name == null) {
        throw new IllegalArgumentException("name");
    }

    providerName = providerName.trim().toLowerCase();
    if (providerName.length() == 0) {
        throw new IllegalArgumentException("providerName is empty.");
    }
    name = name.trim().toLowerCase();
    if (name.length() == 0) {
        throw new IllegalArgumentException("name is empty.");
    }

    if (addressType == null) {
        throw new IllegalArgumentException("addressType");
    }

    if (envelopeTypes == null) {
        throw new IllegalArgumentException("envelopeTypes");
    }

    if (envelopeTypes.length == 0) {
        throw new IllegalArgumentException("envelopeTypes is empty.");
    }

    if (sessionConfigType == null) {
        throw new IllegalArgumentException("sessionConfigType");
    }

    this.providerName = providerName;
    this.name = name;
    this.connectionless = connectionless;
    this.fragmentation = fragmentation;
    this.addressType = addressType;
    this.sessionConfigType = sessionConfigType;

    Set<Class<? extends Object>> newEnvelopeTypes = new IdentityHashSet<Class<? extends Object>>();
    for (Class<? extends Object> c : envelopeTypes) {
        newEnvelopeTypes.add(c);
    }
    this.envelopeTypes = Collections.unmodifiableSet(newEnvelopeTypes);
}
 
开发者ID:eclipse,项目名称:neoscada,代码行数:50,代码来源:DefaultTransportMetadata.java


示例13: getSessionConfigType

import org.apache.mina.core.session.IoSessionConfig; //导入依赖的package包/类
public Class<? extends IoSessionConfig> getSessionConfigType() {
    return sessionConfigType;
}
 
开发者ID:eclipse,项目名称:neoscada,代码行数:4,代码来源:DefaultTransportMetadata.java


示例14: AbstractPollingConnectionlessIoAcceptor

import org.apache.mina.core.session.IoSessionConfig; //导入依赖的package包/类
/**
 * Creates a new instance.
 */
protected AbstractPollingConnectionlessIoAcceptor( IoSessionConfig sessionConfig )
{
    this( sessionConfig, null );
}
 
开发者ID:eclipse,项目名称:neoscada,代码行数:8,代码来源:AbstractPollingConnectionlessIoAcceptor.java


示例15: getConfig

import org.apache.mina.core.session.IoSessionConfig; //导入依赖的package包/类
/**
 * Does nothing.
 */
@Override
public IoSessionConfig getConfig() {
	return null;
}
 
开发者ID:316181444,项目名称:Hxms,代码行数:8,代码来源:MockIOSession.java


示例16: getConfig

import org.apache.mina.core.session.IoSessionConfig; //导入依赖的package包/类
@Override
public IoSessionConfig getConfig() {
    // TODO Auto-generated method stub
    return null;
}
 
开发者ID:Red5,项目名称:red5-websocket,代码行数:6,代码来源:WebSocketServerTest.java


示例17: sessionOpened

import org.apache.mina.core.session.IoSessionConfig; //导入依赖的package包/类
public void sessionOpened(IoSession session) throws Exception {
	//Set idle time
	IoSessionConfig ic= session.getConfig();
	ic.setIdleTime(IdleStatus.READER_IDLE, 900); //10Minutes
}
 
开发者ID:curi0us,项目名称:mgops,代码行数:6,代码来源:ServerHandler.java


示例18: getConfig

import org.apache.mina.core.session.IoSessionConfig; //导入依赖的package包/类
/**
    * @see IoSession#getConfig()
    */
   public IoSessionConfig getConfig() {
return wrappedSession.getConfig();
   }
 
开发者ID:saaconsltd,项目名称:mina-ftpserver,代码行数:7,代码来源:FtpIoSession.java


示例19: AbstractIoAcceptor

import org.apache.mina.core.session.IoSessionConfig; //导入依赖的package包/类
/**
 * Constructor for {@link AbstractIoAcceptor}. You need to provide a default
 * session configuration and an {@link Executor} for handling I/O events. If
 * null {@link Executor} is provided, a default one will be created using
 * {@link Executors#newCachedThreadPool()}.
 *
 * {@see AbstractIoService#AbstractIoService(IoSessionConfig, Executor)}
 * 
 * @param sessionConfig
 *            the default configuration for the managed {@link IoSession}
 * @param executor
 *            the {@link Executor} used for handling execution of I/O
 *            events. Can be <code>null</code>.
 */
protected AbstractIoAcceptor(IoSessionConfig sessionConfig, Executor executor) {
    super(sessionConfig, executor);
    defaultLocalAddresses.add(null);
}
 
开发者ID:eclipse,项目名称:neoscada,代码行数:19,代码来源:AbstractIoAcceptor.java


示例20: getSessionConfig

import org.apache.mina.core.session.IoSessionConfig; //导入依赖的package包/类
/**
 * Returns the default configuration of the new {@link IoSession}s
 * created by this service.
 */
IoSessionConfig getSessionConfig();
 
开发者ID:eclipse,项目名称:neoscada,代码行数:6,代码来源:IoService.java



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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