2012-06-15 61 views
0

在通过JavaPNS发送推送通知时,发生下面的消息时发生异常。在通过JavaPNS发送通知时发生异常

Exception in thread "JavaPNS grouped notification thread in LIST mode" java.lang.OutOfMemoryError: Java heap space

我想是因为我试图发送通知给太多的用户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); 


} 

我把73889个设备令牌列表devices和接收到异常。

您是否认为我需要多次发送通知? 有没有人有关于向很多人发送notificaion的想法?

谢谢!

回答

1

我能想到的2个解决你的问题:

1)发送的......说20K

2批)增加你的堆内存大小

例如: java -Xms512m -Xmx512m

(做搜索...)

相关问题