81,094
社区成员
发帖
与我相关
我的任务
分享
<Connector port="8080" protocol="HTTP/1.1"
connectionTimeout="20000" maxThreads="600" maxConnections="5000" acceptCount="2000"
redirectPort="8443" />
[root@iZ94n26lu8iZ bin]# ulimit -n
1000000
[root@iZ94n26lu8iZ bin]# cat /proc/sys/fs/file-max
794576
* soft nofile 1024000
* hard nofile 1024000
root hard nofile 1000000
root soft nofile 1000000
protected void start() {
WebSocketContainer container = ContainerProvider
.getWebSocketContainer();
Date now = new Date();
String uri = "ws://*******/websocket?device_id="
+ deviceId
+ "&api_id=55×tamp="
+ now.getTime() + "&sign=55";
System.out.println("Connecting to " + uri);
try {
session = container
.connectToServer(MyClient.class, URI.create(uri));
System.out.println("count: " + (++count));
} catch (Exception e) {
e.printStackTrace();
writeLog(e.getMessage());
// System.exit(-1);
}
}
public static void main(String args[]) {
List<App> clientList = new Vector<App>(CLIENT_COUNT);
try {
for (; true;) {
App client = new App();
client.start();
clientList.add(client);
if (clientList.size() >= CLIENT_COUNT) {
break;
}
sleep(200);
}
} catch (Exception e) {
e.printStackTrace();
writeLog(e.getMessage());
// System.exit(-1);
}
}