本文整理匯總了Java中org.apache.mina.transport.socket.AbstractSocketSessionConfig類的典型用法代碼示例。如果您正苦於以下問題:Java AbstractSocketSessionConfig類的具體用法?Java AbstractSocketSessionConfig怎麽用?Java AbstractSocketSessionConfig使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
AbstractSocketSessionConfig類屬於org.apache.mina.transport.socket包,在下文中一共展示了AbstractSocketSessionConfig類的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: increaseReadBufferSize
import org.apache.mina.transport.socket.AbstractSocketSessionConfig; //導入依賴的package包/類
/**
* Increase the ReadBuffer size (it will double)
*/
public final void increaseReadBufferSize() {
AbstractSocketSessionConfig cfg = getConfig();
int readBufferSize = cfg.getReadBufferSize() << 1;
if (readBufferSize <= cfg.getMaxReadBufferSize()) {
cfg.setReadBufferSize(readBufferSize);
}
deferDecreaseReadBuffer = true;
}
示例2: decreaseReadBufferSize
import org.apache.mina.transport.socket.AbstractSocketSessionConfig; //導入依賴的package包/類
/**
* Decrease the ReadBuffer size (it will be divided by a factor 2)
*/
public final void decreaseReadBufferSize() {
if (deferDecreaseReadBuffer) {
deferDecreaseReadBuffer = false;
return;
}
AbstractSocketSessionConfig cfg = getConfig();
int readBufferSize = cfg.getReadBufferSize() >> 1;
if (readBufferSize >= cfg.getMinReadBufferSize()) {
cfg.setReadBufferSize(readBufferSize);
}
deferDecreaseReadBuffer = true;
}
示例3: startNetwork
import org.apache.mina.transport.socket.AbstractSocketSessionConfig; //導入依賴的package包/類
private void startNetwork( Transport transport, IoFilterChainBuilder chainBuilder ) throws Exception
{
if ( transport.getBackLog() < 0 )
{
// Set the backlog to the default value when it's below 0
transport.setBackLog( 50 );
}
chainBuilders.add( chainBuilder );
try
{
SocketAcceptor acceptor = getSocketAcceptor( transport );
// Now, configure the acceptor
// Disable the disconnection of the clients on unbind
acceptor.setCloseOnDeactivation( false );
// No Nagle's algorithm
acceptor.getSessionConfig().setTcpNoDelay( true );
// Inject the chain
acceptor.setFilterChainBuilder( chainBuilder );
// Inject the protocol handler
acceptor.setHandler( getHandler() );
( ( AbstractSocketSessionConfig ) acceptor.getSessionConfig() ).setReadBufferSize( 64 * 1024 );
( ( AbstractSocketSessionConfig ) acceptor.getSessionConfig() ).setSendBufferSize( 64 * 1024 );
// Bind to the configured address
acceptor.bind();
// We are done !
started = true;
if ( LOG.isInfoEnabled() )
{
LOG.info( "Successful bind of an LDAP Service (" + transport.getPort() + ") is completed." );
}
}
catch ( IOException e )
{
String msg = I18n.err( I18n.ERR_171, transport.getPort() );
LdapConfigurationException lce = new LdapConfigurationException( msg );
lce.setCause( e );
LOG.error( msg, e );
throw lce;
}
}
示例4: getConfig
import org.apache.mina.transport.socket.AbstractSocketSessionConfig; //導入依賴的package包/類
@Override
public AbstractSocketSessionConfig getConfig() {
return config;
}
示例5: getConfig
import org.apache.mina.transport.socket.AbstractSocketSessionConfig; //導入依賴的package包/類
/**
* @return the configuration of this session.
*/
AbstractSocketSessionConfig getConfig();