当JavaPNS发送推送通知时,下面的消息出现了异常。
线程中的
异常“列表模式下的JavaPNS分组通知线程”java.lang.OutOfMemoryError: Java堆空间
我想原因是因为我试图在1次之前将通知发送给太多的用户。
public void send (List<Device> devices, Object keystore, String password, boolean production) {
/* Prepare a simple payload to push */
PushNotificationPayload payload = PushNotificationPayload.alert("Hello World!");
/* Decide how many threads you want to create and use */
int threads = 30;
/* Start threads, wait for them, and get a list of all pushed notifications */
List<PushedNotification> notifications = Push.payload(payload, keystore, password, production, threads, devices);
}我将73,889个设备令牌放到列表devices中,并收到了异常。
你认为我需要发送几次通知吗?有人想过给很多人发通知吗?
谢谢!
发布于 2012-06-15 21:26:19
我可以想出两种解决你问题的方法:
1)分批.比如说20k
或
2)增加堆内存大小
示例: java -Xms512m -Xmx512m
(搜索.)
https://stackoverflow.com/questions/11049207
复制相似问题