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