本文整理汇总了Java中org.apache.mina.common.SimpleByteBufferAllocator类的典型用法代码示例。如果您正苦于以下问题:Java SimpleByteBufferAllocator类的具体用法?Java SimpleByteBufferAllocator怎么用?Java SimpleByteBufferAllocator使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
SimpleByteBufferAllocator类属于org.apache.mina.common包,在下文中一共展示了SimpleByteBufferAllocator类的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: run_startup_configurations
import org.apache.mina.common.SimpleByteBufferAllocator; //导入依赖的package包/类
public static void run_startup_configurations() {
ip = ServerConfig.IP_ADDRESS + ":" + PORT;
ByteBuffer.setUseDirectBuffers(false);
ByteBuffer.setAllocator(new SimpleByteBufferAllocator());
acceptor = new SocketAcceptor();
final SocketAcceptorConfig cfg = new SocketAcceptorConfig();
cfg.getSessionConfig().setTcpNoDelay(true);
cfg.setDisconnectOnUnbind(true);
cfg.getFilterChain().addLast("codec", new ProtocolCodecFilter(new MapleCodecFactory()));
players = new PlayerStorage(-10);
try {
InetSocketadd = new InetSocketAddress(PORT);
acceptor.bind(InetSocketadd, new MapleServerHandler(), cfg);
System.out.println("Cash Shop Server is listening on port " + PORT + ".");
} catch (final IOException e) {
System.out.println(" Failed!");
System.err.println("Could not bind to port " + PORT + ".");
throw new RuntimeException("Binding failed.", e);
}
}
开发者ID:ergothvs,项目名称:Lucid2.0,代码行数:24,代码来源:CashShopServer.java
示例2: run_startup_configurations
import org.apache.mina.common.SimpleByteBufferAllocator; //导入依赖的package包/类
public static final void run_startup_configurations() {
userLimit = ServerConfig.USER_LIMIT;
serverName = ServerConfig.SERVER_NAME;
eventMessage = ServerConfig.EVENT_MSG;
maxCharacters = ServerConfig.MAX_CHARACTERS;
ByteBuffer.setUseDirectBuffers(false);
ByteBuffer.setAllocator(new SimpleByteBufferAllocator());
acceptor = new SocketAcceptor();
final SocketAcceptorConfig cfg = new SocketAcceptorConfig();
cfg.getSessionConfig().setTcpNoDelay(true);
cfg.setDisconnectOnUnbind(true);
cfg.getFilterChain().addLast("codec", new ProtocolCodecFilter(new MapleCodecFactory()));
try {
InetSocketadd = new InetSocketAddress(8484);
acceptor.bind(InetSocketadd, new MapleServerHandler(), cfg);
System.out.println("Login Server is listening on port 8484.");
} catch (IOException e) {
System.out.println(" Failed!");
System.err.println("Could not bind to port 8484: " + e);
}
}
开发者ID:ergothvs,项目名称:Lucid2.0,代码行数:25,代码来源:LoginServer.java
示例3: initialize
import org.apache.mina.common.SimpleByteBufferAllocator; //导入依赖的package包/类
@Override
public void initialize(XMPPServer server) {
super.initialize(server);
this.server = server;
serverName = server.getServerInfo().getXMPPDomain();
router = server.getPacketRouter();
routingTable = server.getRoutingTable();
deliverer = server.getPacketDeliverer();
sessionManager = server.getSessionManager();
// Check if we need to configure MINA to use Direct or Heap Buffers
// Note: It has been reported that heap buffers are 50% faster than direct buffers
if (JiveGlobals.getBooleanProperty("xmpp.socket.heapBuffer", true)) {
ByteBuffer.setUseDirectBuffers(false);
ByteBuffer.setAllocator(new SimpleByteBufferAllocator());
}
}
开发者ID:coodeer,项目名称:g3server,代码行数:17,代码来源:ConnectionManagerImpl.java
示例4: startModules
import org.apache.mina.common.SimpleByteBufferAllocator; //导入依赖的package包/类
private void startModules() {
serverSurrogate = new ServerSurrogate();
serverSurrogate.start();
String localIPAddress;
// Setup port info
try {
localIPAddress = InetAddress.getLocalHost().getHostAddress();
}
catch (UnknownHostException e) {
localIPAddress = "Unknown";
}
// Start process that checks health of socket connections
SocketSendingTracker.getInstance().start();
// Check if we need to configure MINA to use Direct or Heap Buffers
// Note: It has been reported that heap buffers are 50% faster than direct buffers
if (!JiveGlobals.getBooleanProperty("xmpp.socket.directBuffer", false)) {
ByteBuffer.setUseDirectBuffers(false);
ByteBuffer.setAllocator(new SimpleByteBufferAllocator());
}
// Start the port listener for clients
startClientListeners(localIPAddress);
// Start the port listener for secured clients
startClientSSLListeners(localIPAddress);
// Start http bind listener
startHttpBindServlet();
}
开发者ID:igniterealtime,项目名称:Openfire-connectionmanager,代码行数:27,代码来源:ConnectionManager.java
示例5: run_startup_configurations
import org.apache.mina.common.SimpleByteBufferAllocator; //导入依赖的package包/类
public static void run_startup_configurations() {
System.out.print("Loading Cash Shop...");
ip = ServerConfig.interface_ + ":" + PORT;
ByteBuffer.setUseDirectBuffers(false);
ByteBuffer.setAllocator(new SimpleByteBufferAllocator());
acceptor = new SocketAcceptor();
final SocketAcceptorConfig cfg = new SocketAcceptorConfig();
cfg.getSessionConfig().setTcpNoDelay(true);
cfg.setDisconnectOnUnbind(true);
cfg.getFilterChain().addLast("codec", new ProtocolCodecFilter(new MapleCodecFactory()));
players = new PlayerStorage(-10);
try {
InetSocketadd = new InetSocketAddress(PORT);
acceptor.bind(InetSocketadd, new MapleServerHandler(), cfg);
System.out.println(" Complete!");
System.out.println("Cash Shop Server is listening on port " + PORT + ".");
} catch (final IOException e) {
System.out.println(" Failed!");
System.err.println("Could not bind to port " + PORT + ".");
throw new RuntimeException("Binding failed.", e);
}
}
开发者ID:skorch37,项目名称:Asteria,代码行数:26,代码来源:CashShopServer.java
示例6: run_startup_configurations
import org.apache.mina.common.SimpleByteBufferAllocator; //导入依赖的package包/类
public static void run_startup_configurations() {
ip = ServerConfig.interface_ + ":" + PORT;
ByteBuffer.setUseDirectBuffers(false);
ByteBuffer.setAllocator(new SimpleByteBufferAllocator());
acceptor = new SocketAcceptor();
SocketAcceptorConfig cfg = new SocketAcceptorConfig();
cfg.getSessionConfig().setTcpNoDelay(true);
cfg.setDisconnectOnUnbind(true);
cfg.getFilterChain().addLast("codec", new ProtocolCodecFilter(new MapleCodecFactory()));
players = new PlayerStorage(-30);
try {
InetSocketadd = new InetSocketAddress(8601);
acceptor.bind(InetSocketadd, new MapleServerHandler(), cfg);
System.out.println("Farm Server is listening on port 8601.");
} catch (IOException e) {
System.err.println("Binding to port 8601 failed");
throw new RuntimeException("Binding failed.", e);
}
}
开发者ID:skorch37,项目名称:Asteria,代码行数:22,代码来源:FarmServer.java
示例7: initialize
import org.apache.mina.common.SimpleByteBufferAllocator; //导入依赖的package包/类
@Override
public void initialize(XMPPServer server) {
super.initialize(server);
serverName = server.getServerInfo().getXMPPDomain();
router = server.getPacketRouter();
routingTable = server.getRoutingTable();
deliverer = server.getPacketDeliverer();
sessionManager = server.getSessionManager();
// Check if we need to configure MINA to use Direct or Heap Buffers
// Note: It has been reported that heap buffers are 50% faster than direct buffers
if (JiveGlobals.getBooleanProperty("xmpp.socket.heapBuffer", true)) {
ByteBuffer.setUseDirectBuffers(false);
ByteBuffer.setAllocator(new SimpleByteBufferAllocator());
}
}
开发者ID:idwanglu2010,项目名称:openfire,代码行数:16,代码来源:ConnectionManagerImpl.java
示例8: run_startup_configurations
import org.apache.mina.common.SimpleByteBufferAllocator; //导入依赖的package包/类
public static final void run_startup_configurations() {
System.out.print("Loading Login Server...");
userLimit = ServerConfig.userLimit;
serverName = ServerConfig.serverName;
eventMessage = ServerConfig.eventMessage;
flag = ServerConfig.flag;
adminOnly = ServerConfig.adminOnly;
maxCharacters = ServerConfig.maxCharacters;
ByteBuffer.setUseDirectBuffers(false);
ByteBuffer.setAllocator(new SimpleByteBufferAllocator());
acceptor = new SocketAcceptor();
final SocketAcceptorConfig cfg = new SocketAcceptorConfig();
cfg.getSessionConfig().setTcpNoDelay(true);
cfg.setDisconnectOnUnbind(true);
cfg.getFilterChain().addLast("codec", new ProtocolCodecFilter(new MapleCodecFactory()));
try {
InetSocketadd = new InetSocketAddress(PORT);
acceptor.bind(InetSocketadd, new MapleServerHandler(), cfg);
System.out.println(" Complete!");
System.out.println("Login Server is listening on port " + PORT + ".");
} catch (IOException e) {
System.out.println(" Failed!");
System.err.println("Could not bind to port " + PORT + ": " + e);
}
}
开发者ID:skorch37,项目名称:Asteria,代码行数:29,代码来源:LoginServer.java
注:本文中的org.apache.mina.common.SimpleByteBufferAllocator类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论