Open z3ustb opened 10 years ago
在批量发送时也会出现锁的情况: "pool-1-thread-1" prio=10 tid=0x00007f71f84eb000 nid=0x2f79 runnable [0x00007f71d7076000] java.lang.Thread.State: RUNNABLE at java.net.SocketOutputStream.socketWrite0(Native Method) at java.net.SocketOutputStream.socketWrite(SocketOutputStream.java:92) at java.net.SocketOutputStream.write(SocketOutputStream.java:136) at com.sun.net.ssl.internal.ssl.OutputRecord.writeBuffer(OutputRecord.java:297) at com.sun.net.ssl.internal.ssl.OutputRecord.write(OutputRecord.java:286) at com.sun.net.ssl.internal.ssl.SSLSocketImpl.writeRecordInternal(SSLSocketImpl.java:748) at com.sun.net.ssl.internal.ssl.SSLSocketImpl.writeRecord(SSLSocketImpl.java:736) at com.sun.net.ssl.internal.ssl.AppOutputStream.write(AppOutputStream.java:89)
locked <0x00000000f470c9e0> (a java.lang.Object) at com.dbay.apns4j.impl.ApnsConnectionImpl.sendNotification(ApnsConnectionImpl.java:121) at com.dbay.apns4j.impl.ApnsServiceImpl$1.run(ApnsServiceImpl.java:69) at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) at java.lang.Thread.run(Thread.java:662)
Locked ownable synchronizers:
还有 "Thread-42" prio=10 tid=0x00007f4a08007800 nid=0x3dcf waiting for monitor entry [0x00007f4a21a63000] java.lang.Thread.State: BLOCKED (on object monitor) at com.dbay.apns4j.impl.ApnsConnectionImpl$1.run(ApnsConnectionImpl.java:283)
waiting to lock <0x00000000f469d778> (a java.lang.Object) at java.lang.Thread.run(Thread.java:662)
Locked ownable synchronizers:
Hi : 问题1. WARN com.dbay.apns4j.impl.ApnsConnectionImpl- pro-4 Didn't find error-notification in the queue. Maybe it's time to adjust cache length. -----现在cacheLength设的是100,既然出现了这个错误,建议你通过apnsConfig.setCacheLength()调整为200,然后再观察下。按理来说,从一条消息发送到APNS服务器返回,这个时间特别短,这段时间内应该不至于足够发送100条。另外,可以把log打开看看到底怎么回事
问题2. 这儿是有锁,但一个ApnsConnectionImpl实例最多有两个线程使用,一个发送的线程,一个监听错误返回值的线程。所以不必担心,不会出现多线程竞争造成阻塞的情况。如果同时需要发送的消息比较多,建议你将poolSize调整为更大的值,这样发送更快
lzhc2004
发件人: z3ustb 发送时间: 2014-02-14 11:31 收件人: RamosLi/dbay-apns-for-java 主题: Re: [dbay-apns-for-java] 这个警告需要处理吗 (#3) 在批量发送时也会出现锁的情况: "pool-1-thread-1" prio=10 tid=0x00007f71f84eb000 nid=0x2f79 runnable [0x00007f71d7076000] java.lang.Thread.State: RUNNABLE at java.net.SocketOutputStream.socketWrite0(Native Method) at java.net.SocketOutputStream.socketWrite(SocketOutputStream.java:92) at java.net.SocketOutputStream.write(SocketOutputStream.java:136) at com.sun.net.ssl.internal.ssl.OutputRecord.writeBuffer(OutputRecord.java:297) at com.sun.net.ssl.internal.ssl.OutputRecord.write(OutputRecord.java:286) at com.sun.net.ssl.internal.ssl.SSLSocketImpl.writeRecordInternal(SSLSocketImpl.java:748) at com.sun.net.ssl.internal.ssl.SSLSocketImpl.writeRecord(SSLSocketImpl.java:736) at com.sun.net.ssl.internal.ssl.AppOutputStream.write(AppOutputStream.java:89)
回答这么迅速,给力!我调一下试试。
还有关于发送频率,有文档说一个IP每分钟最多只能发送1000条,您是怎么处理的?
这个说法有待考证,至少苹果官方文档上没有这么说过,实际情况中,我也没有遇到过
lzhc2004
发件人: z3ustb 发送时间: 2014-02-14 12:31 收件人: RamosLi/dbay-apns-for-java 抄送: RamosLi 主题: Re: [dbay-apns-for-java] 这个警告需要处理吗 (#3) 回答这么迅速,给力!我调一下试试。 还有关于发送频率,有文档说一个IP每分钟最多只能发送1000条,您是怎么处理的? — Reply to this email directly or view it on GitHub.
"Thread-1095" prio=10 tid=0x00007f4a00004800 nid=0x7e8d waiting for monitor entry [0x00007f4a21a63000] java.lang.Thread.State: BLOCKED (on object monitor) at com.dbay.apns4j.impl.ApnsConnectionImpl$1.run(ApnsConnectionImpl.java:282)
waiting to lock <0x00000000f46e3770> (a java.lang.Object) at java.lang.Thread.run(Thread.java:662)
Locked ownable synchronizers:
出现这样的情况有问题了吧
能把完整的堆栈信息作为附件发到我的邮箱里么?我看看问题在哪儿,lzhc2004@163.com
我的是没抛异常,打印如下: 十一月 19, 2014 9:12:59 下午 com.dbay.apns4j.impl.ApnsConnectionImpl sendNotification INFO: pro-1 Send success. count: 1, notificaion: id=101 token=d2c0ba32ff658bdcb9b096cad3bee8b309a079472741d1ca724eaaca9bbda4fb payload={"uid":123456,"aps":{"sound":"msg.mp3","alert":"How are you?","badge":1},"type":12} 十一月 19, 2014 9:13:13 下午 com.dbay.apns4j.impl.ApnsConnectionImpl sendNotification INFO: pro-2 Send success. count: 1, notificaion: id=102 token=d2c0ba32ff658bdcb9b096cad3bee8b309a079472741d1ca724eaaca9bbda4fb payload={"aps":{"sound":"default.caf","alert":{"loc-args":["Jenna","Frank"],"loc-key":"GAME_PLAY_REQUEST_FORMAT"},"badge":1}} Wed Nov 19 18:00:08 CST 2014 0053aa4cc91e27a36d8070e5352636224d5bec56c858c36c5fdf6d044956711b Wed Nov 19 18:00:08 CST 2014 02c73b8f4b8a11128f88ada1617c31dbba0821172966571e9cf064b01df7013b Wed Nov 19 17:30:11 CST 2014 0386dc5246d347da5a6898bf83776f93c6faf7917f5513885aa5db6d8746fed9 Wed Nov 19 18:00:08 CST 2014 11d81407e2cafe053c86c947ede4b5d708ea2668e98794c00ec9229940e4cca3 Wed Nov 19 18:00:07 CST 2014 148720a127df1af8311f2d9cc493bfe626f9d60a79abb881ed8228b48c8d89ff Wed Nov 19 18:21:22 CST 2014 213eb36dd9181d393f05d4830a4ef2e0a4209d4fbf320749283ca056d70c0208 Wed Nov 19 18:09:51 CST 2014 2a3d9e3673ade00d39efde7a19de33ee7b270a222147f7b11c9cc248829dae34 Wed Nov 19 18:00:08 CST 2014 30beb3eddcec8811302b76e1b3e0e992d2940ae7d6110470f8a74391b495c0da Wed Nov 19 18:00:07 CST 2014 4332c38603e4e5a6acf027303f1140c068fffcdb84a6a8a0d433aa206ea4b85c Wed Nov 19 18:00:08 CST 2014 592949185f587f38c4f0ce9323f7a5299b806e2f5a0c46eaac3265189a3104fd Wed Nov 19 18:00:07 CST 2014 829da64fcd0cede3947861562f91fd58a37565082d5bd4d709c6387449034ff2 Wed Nov 19 18:00:08 CST 2014 8c9129170ec7f2fc07902444d3b00f98c9eea2b293f3f044edd58d274183d988 Wed Nov 19 20:44:04 CST 2014 9c8b11bb91c9b3d64122ca90bffcf98fb37a76f23ea9e64dd5fbe70064459fa7 Wed Nov 19 18:00:13 CST 2014 a5cd79d6cef399293f42511e012eaea28f2f9b3bf64edc1357b27b6d6a1d359a Wed Nov 19 18:00:07 CST 2014 c64f0545dbefd6a672a9ba8e0f5245ce1a0716ac117595f4783d9e5eaa9ad608 Wed Nov 19 18:00:08 CST 2014 e6044f2642f0a60fac8552b1808b7b8e042cec9d259776c1b99db24ba0175f60 Wed Nov 19 17:56:03 CST 2014 efce36befa89b84ec0a425654b7bf28bdfeab411587d6618cc2f669778100ce2 但是终端没有收到消息。求解!
请检查下两个地方吧: 1.手机有没有禁用通知,在 Settings-->Notifications里找到你的应用,看看是否设置不对 2.检查下代码,看看device_token是由正式证书还是测试证书生成的,再看看发送消息时设置的是正式环境还是测试环境(也叫开发环境)(config.setDevEnv() ),二者必须一致。
谢谢,问题已经解决了,代码没有问题,是联调的时候移动端日志刷太快了,没看到。现在可以推送了,谢谢大牛!
lcqjava@sina.cn
发件人: RamosLi 发送时间: 2014-11-20 10:29 收件人: RamosLi/dbay-apns-for-java 抄送: lcqjava 主题: Re: [dbay-apns-for-java] 这个警告需要处理吗 (#3) 请检查下两个地方吧: 1.手机有没有禁用通知,在 Settings-->Notifications里找到你的应用,看看是否设置不对 2.检查下代码,看看device_token是由正式证书还是测试证书生成的,再看看发送消息时设置的是正式环境还是测试环境(也叫开发环境)(config.setDevEnv() ),二者必须一致。 — Reply to this email directly or view it on GitHub.
WARN com.dbay.apns4j.impl.ApnsConnectionImpl- pro-4 Didn't find error-notification in the queue. Maybe it's time to adjust cache length.