首页   注册   登录

huxiweng

https://crosslee.github.io/
  •   https://crosslee.github.io/
    V2EX 第 56945 号会员,加入于 2014-02-27 09:56:20 +08:00
    ohfiner
    huxiweng 最近回复了
    5 天前
    回复了 star7th 创建的主题 分享创造 我做了一个创意小产品——时光树洞
    @star7th

    不打算非常精确地投递用户邮件或者短信。排队发出去延迟一些是可接受的。
    -----------
    想请教你的定时任务这块怎么处理的,比如我发了一个信件,定时在 2019-9-16 22:00:00,服务端是怎么在 2019-9-16 22:00:00 这个时间点触发事件(邮件 /短信)的呢?
    5 天前
    回复了 star7th 创建的主题 分享创造 我做了一个创意小产品——时光树洞
    不错,想请教一下如果上万用户都投放了信件(同一天内),服务器怎么十分准确的在这个时间点发送邮件或者短信的呢?就是定时任务怎么实现的?
    购买支持
    告辞😂
    218 天前
    回复了 huxiweng 创建的主题 问与答 第一套房,装修求推荐清单
    主要是餐桌、床、电视、洗衣机、冰箱、空调等软装
    359 天前
    回复了 huxiweng 创建的主题 Java 这是死锁?
    @xixinimei

    改成下面单例,好像死锁了。。。


    private static OkHttpClient okHttpClient = null;


    private HttpTool() {
    }

    public static OkHttpClient getInstance() {
    if (okHttpClient == null) {
    //加同步安全
    synchronized (HttpTool.class) {
    if (okHttpClient == null) {
    //判空 为空创建实例
    okHttpClient = new OkHttpClient();
    }
    }

    }

    return okHttpClient;
    }


    jstack 日志:
    2018-09-27 08:01:43
    Full thread dump Java HotSpot(TM) 64-Bit Server VM (24.80-b11 mixed mode):

    "Attach Listener" daemon prio=10 tid=0x00007f5d1c001000 nid=0x11ba runnable [0x0000000000000000]
    java.lang.Thread.State: RUNNABLE

    "Okio Watchdog" daemon prio=10 tid=0x00007f5d14924800 nid=0x117c in Object.wait() [0x00007f5d20e12000]
    java.lang.Thread.State: TIMED_WAITING (on object monitor)
    at java.lang.Object.wait(Native Method)
    - waiting on <0x00000007889c4fd8> (a java.lang.Class for okio.AsyncTimeout)
    at okio.AsyncTimeout$Companion.awaitTimeout$jvm(AsyncTimeout.kt:341)
    at okio.AsyncTimeout$Watchdog.run(AsyncTimeout.kt:228)
    - locked <0x00000007889c4fd8> (a java.lang.Class for okio.AsyncTimeout)

    "Java2D Disposer" daemon prio=10 tid=0x00007f5d1491e800 nid=0x110d in Object.wait() [0x00007f5d20131000]
    java.lang.Thread.State: WAITING (on object monitor)
    at java.lang.Object.wait(Native Method)
    - waiting on <0x0000000788ba7c48> (a java.lang.ref.ReferenceQueue$Lock)
    at java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:135)
    - locked <0x0000000788ba7c48> (a java.lang.ref.ReferenceQueue$Lock)
    at java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:151)
    at sun.java2d.Disposer.run(Disposer.java:145)
    at java.lang.Thread.run(Thread.java:745)

    "New I/O worker #8" prio=10 tid=0x00007f5d0c014000 nid=0x110c runnable [0x00007f5d2070b000]
    java.lang.Thread.State: RUNNABLE
    at sun.nio.ch.EPollArrayWrapper.epollWait(Native Method)
    at sun.nio.ch.EPollArrayWrapper.poll(EPollArrayWrapper.java:269)
    at sun.nio.ch.EPollSelectorImpl.doSelect(EPollSelectorImpl.java:79)
    at sun.nio.ch.SelectorImpl.lockAndDoSelect(SelectorImpl.java:87)
    - locked <0x00000007fbf15d98> (a sun.nio.ch.Util$2)
    - locked <0x00000007fbf15d88> (a java.util.Collections$UnmodifiableSet)
    - locked <0x00000007fbf02948> (a sun.nio.ch.EPollSelectorImpl)
    at sun.nio.ch.SelectorImpl.select(SelectorImpl.java:98)
    at org.jboss.netty.channel.socket.nio.SelectorUtil.select(SelectorUtil.java:52)
    at org.jboss.netty.channel.socket.nio.AbstractNioWorker.run(AbstractNioWorker.java:208)
    at org.jboss.netty.channel.socket.nio.NioWorker.run(NioWorker.java:38)
    at org.jboss.netty.util.ThreadRenamingRunnable.run(ThreadRenamingRunnable.java:102)
    at org.jboss.netty.util.internal.DeadLockProofWorker$1.run(DeadLockProofWorker.java:42)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
    at java.lang.Thread.run(Thread.java:745)

    "New I/O worker #7" prio=10 tid=0x00007f5d0c011800 nid=0x110b runnable [0x00007f5d2080c000]
    java.lang.Thread.State: RUNNABLE
    at sun.nio.ch.EPollArrayWrapper.epollWait(Native Method)
    at sun.nio.ch.EPollArrayWrapper.poll(EPollArrayWrapper.java:269)
    at sun.nio.ch.EPollSelectorImpl.doSelect(EPollSelectorImpl.java:79)
    at sun.nio.ch.SelectorImpl.lockAndDoSelect(SelectorImpl.java:87)
    - locked <0x000000078859c718> (a sun.nio.ch.Util$2)
    - locked <0x000000078859c708> (a java.util.Collections$UnmodifiableSet)
    - locked <0x000000078855fb30> (a sun.nio.ch.EPollSelectorImpl)
    at sun.nio.ch.SelectorImpl.select(SelectorImpl.java:98)
    at org.jboss.netty.channel.socket.nio.SelectorUtil.select(SelectorUtil.java:52)
    at org.jboss.netty.channel.socket.nio.AbstractNioWorker.run(AbstractNioWorker.java:208)
    at org.jboss.netty.channel.socket.nio.NioWorker.run(NioWorker.java:38)
    at org.jboss.netty.util.ThreadRenamingRunnable.run(ThreadRenamingRunnable.java:102)
    at org.jboss.netty.util.internal.DeadLockProofWorker$1.run(DeadLockProofWorker.java:42)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
    at java.lang.Thread.run(Thread.java:745)

    "New I/O worker #6" prio=10 tid=0x00007f5d0c010000 nid=0x110a runnable [0x00007f5d2090d000]
    java.lang.Thread.State: RUNNABLE
    at sun.nio.ch.EPollArrayWrapper.epollWait(Native Method)
    at sun.nio.ch.EPollArrayWrapper.poll(EPollArrayWrapper.java:269)
    at sun.nio.ch.EPollSelectorImpl.doSelect(EPollSelectorImpl.java:79)
    at sun.nio.ch.SelectorImpl.lockAndDoSelect(SelectorImpl.java:87)
    - locked <0x00000007fbf0fe28> (a sun.nio.ch.Util$2)
    - locked <0x00000007fbf0fe18> (a java.util.Collections$UnmodifiableSet)
    - locked <0x00000007fbf0d818> (a sun.nio.ch.EPollSelectorImpl)
    at sun.nio.ch.SelectorImpl.select(SelectorImpl.java:98)
    at org.jboss.netty.channel.socket.nio.SelectorUtil.select(SelectorUtil.java:52)
    at org.jboss.netty.channel.socket.nio.AbstractNioWorker.run(AbstractNioWorker.java:208)
    at org.jboss.netty.channel.socket.nio.NioWorker.run(NioWorker.java:38)
    at org.jboss.netty.util.ThreadRenamingRunnable.run(ThreadRenamingRunnable.java:102)
    at org.jboss.netty.util.internal.DeadLockProofWorker$1.run(DeadLockProofWorker.java:42)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
    at java.lang.Thread.run(Thread.java:745)

    "New I/O worker #5" prio=10 tid=0x00007f5d0c003800 nid=0x1109 runnable [0x00007f5d20a0e000]
    java.lang.Thread.State: RUNNABLE
    at sun.nio.ch.EPollArrayWrapper.epollWait(Native Method)
    at sun.nio.ch.EPollArrayWrapper.poll(EPollArrayWrapper.java:269)
    at sun.nio.ch.EPollSelectorImpl.doSelect(EPollSelectorImpl.java:79)
    at sun.nio.ch.SelectorImpl.lockAndDoSelect(SelectorImpl.java:87)
    - locked <0x00000007885c1230> (a sun.nio.ch.Util$2)
    - locked <0x00000007885c1220> (a java.util.Collections$UnmodifiableSet)
    - locked <0x00000007885b1078> (a sun.nio.ch.EPollSelectorImpl)
    at sun.nio.ch.SelectorImpl.select(SelectorImpl.java:98)
    at org.jboss.netty.channel.socket.nio.SelectorUtil.select(SelectorUtil.java:52)
    at org.jboss.netty.channel.socket.nio.AbstractNioWorker.run(AbstractNioWorker.java:208)
    at org.jboss.netty.channel.socket.nio.NioWorker.run(NioWorker.java:38)
    at org.jboss.netty.util.ThreadRenamingRunnable.run(ThreadRenamingRunnable.java:102)
    at org.jboss.netty.util.internal.DeadLockProofWorker$1.run(DeadLockProofWorker.java:42)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
    at java.lang.Thread.run(Thread.java:745)
    关于   ·   FAQ   ·   API   ·   我们的愿景   ·   广告投放   ·   感谢   ·   实用小工具   ·   2200 人在线   最高记录 5043   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.3 · 10ms · UTC 15:05 · PVG 23:05 · LAX 08:05 · JFK 11:05
    ♥ Do have faith in what you're doing.