java集合之DelayedWorkQueue

DelayedWorkQueue 是一个定制的阻塞队列,专门用来存放RunnableScheduledFutures任务,它是有界的,有最大容量,一般达不到,虽然它是队列,它并不能满足先进先出规则,它是按优先级出队,它会将插入的数据进行排序,按优先级出队,底层采用数组实现的二叉堆,它是为定时线程池服务的,它会根据提交进来的任务的延迟时间进行排序,始终将距离当前时间最近的任务排在前面。具体情况,我们根据源码来解释
在这里插入图片描述

1、重要属性
// 队列初始容量
private static final int INITIAL_CAPACITY = 16;
// 存放任务的数组
private RunnableScheduledFuture<?>[] queue =
    new RunnableScheduledFuture<?>[INITIAL_CAPACITY];
// 锁
private final ReentrantLock lock = new ReentrantLock();
// 元素个数
private int size = 0;
// leader一般会存储等待堆顶数据的消费者
private Thread leader = null;
// 等待队列
private final Condition available = lock.newCondition();
2、重要方法
2.1 写入方法
2.1.1 add方法
public boolean add(Runnable e) {
    return offer(e);
}
2.1.2 put方法
public void put(Runnable e) {
  offer(e);
}
2.1.3 offer方法
// offer方法向队列中添加元素
// e 需要添加到队列的数据
// timeout 等待时间
// unit 时间单位
public boolean offer(Runnable e, long timeout, TimeUnit unit) {
  return offer(e);
}
public boolean offer(Runnable x) {
	if (x == null)
	    throw new NullPointerException();
	// 强转
	RunnableScheduledFuture<?> e = (RunnableScheduledFuture<?>)x;
	// 加锁
	final ReentrantLock lock = this.lock;
	lock.lock();
	try {
		// 将size赋值给i,size是当前队列中的元素个数
	    int i = size;
	    // 队列满了,就进行扩容
	    if (i >= queue.length)
	        grow();
        // size+1
	    size = i + 1;
	    // 如果队列中没有元素,默认放在第0个位置
	    if (i == 0) {
	        queue[0] = e;
	        setIndex(e, 0);
	    } else {
	    	// 通过siftUp,比较数据大小,存储数据,并根据优先级排序规则进行移动,保证二叉树平衡
	        siftUp(i, e);
	    }
	    // 队列头部元素变成了当前的e,则需要将leader设置为null,因为leader等待的是之前的队头数据
	    // 唤醒等待队列中的消费者,来等待当前的队头数据
	    if (queue[0] == e) {
	        leader = null;
	        available.signal();
	    }
	} finally {
		// 释放锁
	    lock.unlock();
	}
	return true;
}
// 扩容
private void grow() {
	// 数组当前容量
    int oldCapacity = queue.length;
    // 扩容到原数组的1.5倍
    int newCapacity = oldCapacity + (oldCapacity >> 1); // grow 50%
    // newCapacity变为负数,长度已经大于MAX_VALUE了,则取MAX_VALUE。
    if (newCapacity < 0) // overflow
        newCapacity = Integer.MAX_VALUE;
    // 将当前数组拷贝到新数组
    queue = Arrays.copyOf(queue, newCapacity);
}

// 存储数据,并根据优先级排序规则进行移动,保证二叉树平衡 
// k是当前key要存放的位置,也就是队尾,但是要保证最小堆原值,还需要进行调整
private void siftUp(int k, RunnableScheduledFuture<?> key) {
   while (k > 0) {
   		// 找到父节点的位置
        int parent = (k - 1) >>> 1;
        // 取出父元素
        RunnableScheduledFuture<?> e = queue[parent];
        // 如果当前加入队列的元素比父节点大,则直接放
        if (key.compareTo(e) >= 0)
            break;
        // 如果加入的元素比父节点小,则将父节点放到k位置,也就是父节点往下移动
        queue[k] = e;
        setIndex(e, k);
        // 重新设置x节点需要放置的位置。k就来到了父节点原本的位置,此时再进行while判断,
        // 如果合适则放下,不合适继续重复刚才的操作,直到找到合适的位置,或者找到根节点
        k = parent;
    }
    // 将key放在找到的k位置
    queue[k] = key;
    setIndex(key, k);
}

2.2 读取操作
2.2.1 peek方法

查看堆顶元素

public RunnableScheduledFuture<?> peek() {
  final ReentrantLock lock = this.lock;
    lock.lock();
    try {
        // 直接返回堆顶元素
        return queue[0];
    } finally {
        lock.unlock();
    }
}
2.2.2 poll方法

不阻塞的poll,取出堆顶元素,如果堆顶元素还没到出队时间或者堆顶元素为空,直接返回null,否则返回堆顶元素
阻塞的poll,等待阻塞时间,指定时间内拿到元素返回,拿不到元素,时间到了返回null

public RunnableScheduledFuture<?> poll() {
    // 加锁
    final ReentrantLock lock = this.lock;
    lock.lock();
    try {
    	// 获取堆顶元素
        RunnableScheduledFuture<?> first = queue[0];
        // 堆顶元素为空或者还没到出队时间 返回null
        if (first == null || first.getDelay(NANOSECONDS) > 0)
            return null;
        else
        	// 将最后一个元素放到堆顶,并向下堆化(最后一个元素的延迟时间肯定是最大的,
        	// 将它放到堆顶之后,需要重新给他找位置)
            return finishPoll(first);
    } finally {
    	// 释放锁
        lock.unlock();
    }
}
private RunnableScheduledFuture<?> finishPoll(RunnableScheduledFuture<?> f) {
	// 元素个数减1
   int s = --size;
   // 取出最后一个元素
    RunnableScheduledFuture<?> x = queue[s];
    // 将最后一个位置置为null
    queue[s] = null;
    // 如果s== 0 说明已经是最后一个元素,不需要保证堆结构
    if (s != 0)
    	// 由于堆顶元素出队列后,就破坏了堆的结构,需要组织整理,将堆尾元素移到堆顶,然后向下堆化
        siftDown(0, x);
    // 出堆后,将index置为-1
    setIndex(f, -1);
    return f;
}
// key堆底元素
// k堆底元素放置的位置(默认为0)
private void siftDown(int k, RunnableScheduledFuture<?> key) {
	// 无符号右移,相当于size/2
	// // 因为二叉堆是一个二叉满树,所以在保证二叉堆结构时,只需要做一半就可以
    int half = size >>> 1;
    // 做了超过一半,就不需要再往下找了。
    while (k < half) {
    	// 寻找子节点
        int child = (k << 1) + 1;
        // 左子节点
        RunnableScheduledFuture<?> c = queue[child];
        // 又子节点的位置
        int right = child + 1;
        // right < size 保证右子节点存在
        // c.compareTo(queue[right]) > 0 左子节点比右子节点大
        if (right < size && c.compareTo(queue[right]) > 0)
        	// 取出较小的子节点
            c = queue[child = right];
        // 如果堆尾元素比当前较小的子节点小 则不用继续寻找,跳出循环
        if (key.compareTo(c) <= 0)
            break;
        // 否则将较小的子节点c向上提,放到堆顶
        queue[k] = c;
        setIndex(c, k);
        k = child;
    }
    // 最终将key放到找到的k位置
    queue[k] = key;
    setIndex(key, k);
}

public RunnableScheduledFuture<?> poll(long timeout, TimeUnit unit)
  throws InterruptedException {
   long nanos = unit.toNanos(timeout);
   final ReentrantLock lock = this.lock;
   lock.lockInterruptibly();
   try {
       for (;;) {
           RunnableScheduledFuture<?> first = queue[0];
           if (first == null) {
               if (nanos <= 0)
                   return null;
               else
                   nanos = available.awaitNanos(nanos);
           } else {
               long delay = first.getDelay(NANOSECONDS);
               if (delay <= 0)
                   return finishPoll(first);
               if (nanos <= 0)
                   return null;
               first = null; // don't retain ref while waiting
               if (nanos < delay || leader != null)
                   nanos = available.awaitNanos(nanos);
               else {
                   Thread thisThread = Thread.currentThread();
                   leader = thisThread;
                   try {
                       long timeLeft = available.awaitNanos(delay);
                       nanos -= delay - timeLeft;
                   } finally {
                       if (leader == thisThread)
                           leader = null;
                   }
               }
           }
       }
   } finally {
       if (leader == null && queue[0] != null)
           available.signal();
       lock.unlock();
   }
}
2.2.3 take方法

如果取不到元素就死等,直到取到元素为止

public RunnableScheduledFuture<?> take() throws InterruptedException {
	// 加锁
    final ReentrantLock lock = this.lock;
    lock.lockInterruptibly();
    try {
        for (;;) {
        	// 堆顶元素为空,当前读线程阻塞
            RunnableScheduledFuture<?> first = queue[0];
            if (first == null)
                available.await();
            else {
            	// 取出堆顶元素的出堆时间
                long delay = first.getDelay(NANOSECONDS);
                if (delay <= 0)
                	// 时间已到 执行出堆
                    return finishPoll(first);
                // 将first置空,线程等待时,不持有堆顶元素的引用(当线程醒来时,堆顶元素可能已经变化)
                first = null; // don't retain ref while waiting
                // leader为当前正在等待堆顶元素的线程,如果已经有人在等堆顶元素,那么当前线程阻塞
                if (leader != null)
                    available.await();
                else {
                	// 走到这里,说明当前消费者的阻塞时间可以拿到数据,并且没有其他消费者在等待堆顶数据
                	// 将leader设置为当前线程
                    Thread thisThread = Thread.currentThread();
                    leader = thisThread;
                    try {
                    	// 阻塞任务的延迟时间 当任务的延时时间到了时,能够自动超时唤醒
                        available.awaitNanos(delay);
                    } finally {
                    	// 将如果leader是当前线程,置为空
                        if (leader == thisThread)
                            leader = null;
                    }
                }
            }
        }
    } finally {
    	// 没有消费者在等待元素,队列中的元素不为null 
        if (leader == null && queue[0] != null)
        	// 只要当前没有leader在等,并且队列有元素,就需要再次唤醒消费者。、
            // 避免队列有元素,但是没有消费者处理的问题
            available.signal();
        // 释放锁
        lock.unlock();
    }
}
"GoogleApiHandler" prio=5 tid=23 Native | group="main" sCount=1 ucsCount=0 flags=1 obj=0x2063538 self=0xb40000778f242c00 | sysTid=10896 nice=9 cgrp=foreground sched=0/0 handle=0x771b9da500 | state=S schedstat=( 77714836 3054941938 494 ) utm=5 stm=2 core=7 HZ=100 | stack=0x771b8d7000-0x771b8d9000 stackSize=1037KB | held mutexes= native: #00 pc 000fa5c8 /apex/com.android.runtime/lib64/bionic/libc.so (__epoll_pwait+8) (BuildId: 65b0c8857610bf85fb81a624be775cc4) native: #01 pc 00016a10 /system/lib64/libutils.so (android::Looper::pollOnce+288) (BuildId: e41f2bc353059dc14cf4ee6b493447a4) native: #02 pc 001e341c /system/lib64/libandroid_runtime.so (android::android_os_MessageQueue_nativePollOnce+44) (BuildId: a0d95d90e274625a9f38a09d50148b89) at android.os.MessageQueue.nativePollOnce(Native method) at android.os.MessageQueue.nextLegacy(MessageQueue.java:934) at android.os.MessageQueue.next(MessageQueue.java:1046) at android.os.Looper.loopOnce(Looper.java:221) at android.os.Looper.loop(Looper.java:412) at android.os.HandlerThread.run(HandlerThread.java:85) DumpLatencyMs: 1162.68 "GhaSingleThread-0" prio=5 tid=24 Waiting | group="main" sCount=1 ucsCount=0 flags=1 obj=0x20804f8 self=0xb40000778f246400 | sysTid=10984 nice=0 cgrp=foreground sched=0/0 handle=0x771994c500 | state=S schedstat=( 95131857 445582605 227 ) utm=2 stm=7 core=5 HZ=100 | stack=0x7719849000-0x771984b000 stackSize=1037KB | held mutexes= at jdk.internal.misc.Unsafe.park(Native method) - waiting on an unknown object at java.util.concurrent.locks.LockSupport.park(LockSupport.java:371) at java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionNode.block(AbstractQueuedSynchronizer.java:519) at java.util.concurrent.ForkJoinPool.unmanagedBlock(ForkJoinPool.java:3805) at java.util.concurrent.ForkJoinPool.managedBlock(ForkJoinPool.java:3746) at java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.await(AbstractQueuedSynchronizer.java:1707) at java.util.concurrent.ScheduledThreadPoolExecutor$DelayedWorkQueue.take(ScheduledThreadPoolExecutor.java:1224) at java.util.concurrent.ScheduledThreadPoolExecutor$DelayedWorkQueue.take(ScheduledThreadPoolExecutor.java:953) at java.util.concurrent.ThreadPoolExecutor.getTask(ThreadPoolExecutor.java:1082) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:651) at java.lang.Thread.run(Thread.java:1119) DumpLatencyMs: 1202.41 "OneGoogle #0" prio=5 tid=25 TimedWaiting | group="main" sCount=1 ucsCount=0 flags=1 obj=0x207e7b8 self=0xb40000778f244800 | sysTid=10981 nice=0 cgrp=foreground sched=0/0 handle=0x7719a5c500 | state=S schedstat=( 14402928 213139691 27 ) utm=1 stm=0 core=5 HZ=100 | stack=0x7719959000-0x771995b000 stackSize=1037KB | held mutexes= at jdk.internal.misc.Unsafe.park(Native method) - waiting on an unknown object at java.util.concurrent.locks.LockSupport.parkNanos(LockSupport.java:410) at java.util.concurrent.LinkedTransferQueue$DualNode.await(LinkedTransferQueue.java:452) at java.util.concurrent.SynchronousQueue$Transferer.xferLifo(SynchronousQueue.java:194) at java.util.concurrent.SynchronousQueue.xfer(SynchronousQueue.java:233) at java.util.concurrent.SynchronousQueue.poll(SynchronousQueue.java:336) at java.util.concurrent.ThreadPoolExecutor.getTask(ThreadPoolExecutor.java:1081) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:651) at java.lang.Thread.run(Thread.java:1119) DumpLatencyMs: 1202.71 "ProtoDataStore-Message-Handler" prio=5 tid=26 Native | group="main" sCount=1 ucsCount=0 flags=1 obj=0x208b560 self=0xb40000778f264000 | sysTid=11002 nice=0 cgrp=foreground sched=0/0 handle=0x771783c500 | state=S schedstat=( 371692 48547539 3 ) utm=0 stm=0 core=7 HZ=100 | stack=0x7717739000-0x771773b000 stackSize=1037KB | held mutexes= native: #00 pc 000fa5c8 /apex/com.android.runtime/lib64/bionic/libc.so (__epoll_pwait+8) (BuildId: 65b0c8857610bf85fb81a624be775cc4) native: #01 pc 00016a10 /system/lib64/libutils.so (android::Looper::pollOnce+288) (BuildId: e41f2bc353059dc14cf4ee6b493447a4) native: #02 pc 001e341c /system/lib64/libandroid_runtime.so (android::android_os_MessageQueue_nativePollOnce+44) (BuildId: a0d95d90e274625a9f38a09d50148b89) at android.os.MessageQueue.nativePollOnce(Native method) at android.os.MessageQueue.nextLegacy(MessageQueue.java:934) at android.os.MessageQueue.next(MessageQueue.java:1046) at android.os.Looper.loopOnce(Looper.java:221) at android.os.Looper.loop(Looper.java:412) at android.os.HandlerThread.run(HandlerThread.java:85) DumpLatencyMs: 1202.89 "OneGoogle #2" prio=5 tid=27 TimedWaiting | group="main" sCount=1 ucsCount=0 flags=1 obj=0x208fbf0 self=0xb40000778f267800 | sysTid=11020 nice=0 cgrp=foreground sched=0/0 handle=0x77154f2500 | state=S schedstat=( 27159610 751780158 94 ) utm=0 stm=2 core=7 HZ=100 | stack=0x77153ef000-0x77153f1000 stackSize=1037KB | held mutexes= at jdk.internal.misc.Unsafe.park(Native method) - waiting on an unknown object at java.util.concurrent.locks.LockSupport.parkNanos(LockSupport.java:410) at java.util.concurrent.LinkedTransferQueue$DualNode.await(LinkedTransferQueue.java:452) at java.util.concurrent.SynchronousQueue$Transferer.xferLifo(SynchronousQueue.java:194) at java.util.concurrent.SynchronousQueue.xfer(SynchronousQueue.java:233) at java.util.concurrent.SynchronousQueue.poll(SynchronousQueue.java:336) at java.util.concurrent.ThreadPoolExecutor.getTask(ThreadPoolExecutor.java:1081) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:651) at java.lang.Thread.run(Thread.java:1119) DumpLatencyMs: 1220.74 "ProcessStablePhenotypeFlag" prio=5 tid=28 Waiting | group="main" sCount=1 ucsCount=0 flags=1 obj=0x2090400 self=0xb400007793286c00 | sysTid=11017 nice=0 cgrp=foreground sched=0/0 handle=0x7715602500 | state=S schedstat=( 40540147 1505515933 88 ) utm=0 stm=3 core=2 HZ=100 | stack=0x77154ff000-0x7715501000 stackSize=1037KB | held mutexes= at jdk.internal.misc.Unsafe.park(Native method) - waiting on an unknown object at java.util.concurrent.locks.LockSupport.park(LockSupport.java:371) at java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionNode.block(AbstractQueuedSynchronizer.java:519) at java.util.concurrent.ForkJoinPool.unmanagedBlock(ForkJoinPool.java:3805) at java.util.concurrent.ForkJoinPool.managedBlock(ForkJoinPool.java:3746) at java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.await(AbstractQueuedSynchronizer.java:1707) at java.util.concurrent.ScheduledThreadPoolExecutor$DelayedWorkQueue.take(ScheduledThreadPoolExecutor.java:1224) at java.util.concurrent.ScheduledThreadPoolExecutor$DelayedWorkQueue.take(ScheduledThreadPoolExecutor.java:953) at java.util.concurrent.ThreadPoolExecutor.getTask(ThreadPoolExecutor.java:1082) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:651) at java.lang.Thread.run(Thread.java:1119) DumpLatencyMs: 1221.09 "OneGoogle #1" prio=5 tid=29 Waiting | group="main" sCount=1 ucsCount=0 flags=1 obj=0x208ea50 self=0xb40000778f265c00 | sysTid=11007 nice=0 cgrp=foreground sched=0/0 handle=0x771672c500 | state=S schedstat=( 1920385 1142534924 10 ) utm=0 stm=0 core=5 HZ=100 | stack=0x7716629000-0x771662b000 stackSize=1037KB | held mutexes= at jdk.internal.misc.Unsafe.park(Native method) - waiting on an unknown object at java.util.concurrent.locks.LockSupport.park(LockSupport.java:371) at java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionNode.block(AbstractQueuedSynchronizer.java:519) at java.util.concurrent.ForkJoinPool.unmanagedBlock(ForkJoinPool.java:3805) at java.util.concurrent.ForkJoinPool.managedBlock(ForkJoinPool.java:3746) at java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.await(AbstractQueuedSynchronizer.java:1707) at java.util.concurrent.LinkedBlockingQueue.take(LinkedBlockingQueue.java:435) at xzb.a(PG:15) at xln.m(PG:27) at xln.e(PG:2) at aanb.call(PG:64) at amwq.call(PG:17) at amyz.a(PG:3) at amyg.run(PG:19) at amza.run(PG:5) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1156) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:651) at java.lang.Thread.run(Thread.java:1119) DumpLatencyMs: 1221.33 "GoogleApiHandler" prio=5 tid=30 Native | group="main" sCount=1 ucsCount=0 flags=1 obj=0x20c10e8 self=0xb40000779328a400 | sysTid=11098 nice=9 cgrp=foreground sched=0/0 handle=0x77123e2500 | state=S schedstat=( 11361537 1887484927 53 ) utm=1 stm=0 core=4 HZ=100 | stack=0x77122df000-0x77122e1000 stackSize=1037KB | held mutexes= native: #00 pc 000fa5c8 /apex/com.android.runtime/lib64/bionic/libc.so (__epoll_pwait+8) (BuildId: 65b0c8857610bf85fb81a624be775cc4) native: #01 pc 00016a10 /system/lib64/libutils.so (android::Looper::pollOnce+288) (BuildId: e41f2bc353059dc14cf4ee6b493447a4) native: #02 pc 001e341c /system/lib64/libandroid_runtime.so (android::android_os_MessageQueue_nativePollOnce+44) (BuildId: a0d95d90e274625a9f38a09d50148b89) at android.os.MessageQueue.nativePollOnce(Native method) at android.os.MessageQueue.nextLegacy(MessageQueue.java:934) at android.os.MessageQueue.next(MessageQueue.java:1046) at android.os.Looper.loopOnce(Looper.java:221) at android.os.Looper.loop(Looper.java:412) at android.os.HandlerThread.run(HandlerThread.java:85) DumpLatencyMs: 1224.76 "queued-work-looper" prio=5 tid=31 Runnable | group="main" sCount=0 ucsCount=0 flags=0 obj=0x20f1290 self=0xb400007793385c00 | sysTid=11118 nice=-2 cgrp=foreground sched=0/0 handle=0x77111c2500 | state=R schedstat=( 9850536 424751538 46 ) utm=0 stm=0 core=4 HZ=100 | stack=0x77110bf000-0x77110c1000 stackSize=1037KB | held mutexes= "mutator lock"(shared held) at android.os.MessageQueue.nextLegacy(MessageQueue.java:936) at android.os.MessageQueue.next(MessageQueue.java:1046) at android.os.Looper.loopOnce(Looper.java:221) at android.os.Looper.loop(Looper.java:412) at android.os.HandlerThread.run(HandlerThread.java:85) DumpLatencyMs: 460.153 "Measurement Worker" prio=5 tid=32 Runnable | group="main" sCount=0 ucsCount=0 flags=0 obj=0x20eee68 self=0xb400007793384000 | sysTid=11113 nice=10 cgrp=foreground sched=0/0 handle=0x77112d2500 | state=R schedstat=( 175447300 6121264325 1276 ) utm=7 stm=10 core=7 HZ=100 | stack=0x77111cf000-0x77111d1000 stackSize=1037KB | held mutexes= "mutator lock"(shared held) native: #00 pc 004f3874 /apex/com.android.art/lib64/libart.so (art::DumpNativeStack+108) (BuildId: eb4ec0f1d1c7267591d83fa87cb36390) native: #01 pc 00444858 /apex/com.android.art/lib64/libart.so (art::Thread::DumpStack const+436) (BuildId: eb4ec0f1d1c7267591d83fa87cb36390) native: #02 pc 00444574 /apex/com.android.art/lib64/libart.so (art::DumpCheckpoint::Run+120) (BuildId: eb4ec0f1d1c7267591d83fa87cb36390) native: #03 pc 002d6c08 /apex/com.android.art/lib64/libart.so (art::Thread::RunCheckpointFunction+144) (BuildId: eb4ec0f1d1c7267591d83fa87cb36390) native: #04 pc 0043caf8 /apex/com.android.art/lib64/libart.so (artTestSuspendFromCode+256) (BuildId: eb4ec0f1d1c7267591d83fa87cb36390) native: #05 pc 0032deec /apex/com.android.art/lib64/libart.so (art_quick_test_suspend+156) (BuildId: eb4ec0f1d1c7267591d83fa87cb36390) at java.lang.VMClassLoader.findLoadedClass(Native method) at java.lang.ClassLoader.findLoadedClass(ClassLoader.java:1276) at java.lang.ClassLoader.loadClass(ClassLoader.java:621) at java.lang.ClassLoader.loadClass(ClassLoader.java:573) at m7.qb.s(:com.google.android.gms.dynamite_measurementdynamite@253830035@25.38.30 (260400-0):297) at m7.uz.q(:com.google.android.gms.dynamite_measurementdynamite@253830035@25.38.30 (260400-0):24) at m7.tc.D(:com.google.android.gms.dynamite_measurementdynamite@253830035@25.38.30 (260400-0):81) at m7.qz.run(:com.google.android.gms.dynamite_measurementdynamite@253830035@25.38.30 (260400-0):1186) at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:524) at java.util.concurrent.FutureTask.run(FutureTask.java:317) at m7.qw.run(:com.google.android.gms.dynamite_measurementdynamite@253830035@25.38.30 (260400-0):48) DumpLatencyMs: 966.115 "Thread-7" prio=5 tid=34 Waiting | group="main" sCount=1 ucsCount=0 flags=1 obj=0x2126e30 self=0xb40000778f26cc00 | sysTid=11136 nice=10 cgrp=foreground sched=0/0 handle=0x770de92500 | state=S schedstat=( 316231 270293616 3 ) utm=0 stm=0 core=6 HZ=100 | stack=0x770dd8f000-0x770dd91000 stackSize=1037KB | held mutexes= at jdk.internal.misc.Unsafe.park(Native method) - waiting on an unknown object at java.util.concurrent.locks.LockSupport.park(LockSupport.java:371) at java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionNode.block(AbstractQueuedSynchronizer.java:519) at java.util.concurrent.ForkJoinPool.unmanagedBlock(ForkJoinPool.java:3805) at java.util.concurrent.ForkJoinPool.managedBlock(ForkJoinPool.java:3746) at java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.await(AbstractQueuedSynchronizer.java:1707) at java.util.concurrent.PriorityBlockingQueue.take(PriorityBlockingQueue.java:538) at ibf.a(PG:5) at ibf.run(PG:6) DumpLatencyMs: 1227.22 "Thread-9" prio=5 tid=35 Waiting | group="main" sCount=1 ucsCount=0 flags=1 obj=0x2126fa0 self=0xb40000778f270400 | sysTid=11138 nice=10 cgrp=foreground sched=0/0 handle=0x770cc72500 | state=S schedstat=( 273538 268433154 3 ) utm=0 stm=0 core=6 HZ=100 | stack=0x770cb6f000-0x770cb71000 stackSize=1037KB | held mutexes= at jdk.internal.misc.Unsafe.park(Native method) - waiting on an unknown object at java.util.concurrent.locks.LockSupport.park(LockSupport.java:371) at java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionNode.block(AbstractQueuedSynchronizer.java:519) at java.util.concurrent.ForkJoinPool.unmanagedBlock(ForkJoinPool.java:3805) at java.util.concurrent.ForkJoinPool.managedBlock(ForkJoinPool.java:3746) at java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.await(AbstractQueuedSynchronizer.java:1707) at java.util.concurrent.PriorityBlockingQueue.take(PriorityBlockingQueue.java:538) at ibf.a(PG:5) at ibf.run(PG:6) DumpLatencyMs: 1243.31 "Thread-8" prio=5 tid=36 Waiting | group="main" sCount=1 ucsCount=0 flags=1 obj=0x2126ee8 self=0xb40000778f26e800 | sysTid=11137 nice=10 cgrp=foreground sched=0/0 handle=0x770dd82500 | state=S schedstat=( 555923 343065080 4 ) utm=0 stm=0 core=6 HZ=100 | stack=0x770dc7f000-0x770dc81000 stackSize=1037KB | held mutexes= at jdk.internal.misc.Unsafe.park(Native method) - waiting on an unknown object at java.util.concurrent.locks.LockSupport.park(LockSupport.java:371) at java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionNode.block(AbstractQueuedSynchronizer.java:519) at java.util.concurrent.ForkJoinPool.unmanagedBlock(ForkJoinPool.java:3805) at java.util.concurrent.ForkJoinPool.managedBlock(ForkJoinPool.java:3746) at java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.await(AbstractQueuedSynchronizer.java:1707) at java.util.concurrent.PriorityBlockingQueue.take(PriorityBlockingQueue.java:538) at ibf.a(PG:5) at ibf.run(PG:6) DumpLatencyMs: 1244.91 "Thread-6" prio=5 tid=37 Waiting | group="main" sCount=1 ucsCount=0 flags=1 obj=0x2126bf8 self=0xb40000778f26b000 | sysTid=11134 nice=10 cgrp=foreground sched=0/0 handle=0x770dfa2500 | state=S schedstat=( 751693 117886077 7 ) utm=0 stm=0 core=7 HZ=100 | stack=0x770de9f000-0x770dea1000 stackSize=1037KB | held mutexes= at jdk.internal.misc.Unsafe.park(Native method) - waiting on an unknown object at java.util.concurrent.locks.LockSupport.park(LockSupport.java:371) at java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionNode.block(AbstractQueuedSynchronizer.java:519) at java.util.concurrent.ForkJoinPool.unmanagedBlock(ForkJoinPool.java:3805) at java.util.concurrent.ForkJoinPool.managedBlock(ForkJoinPool.java:3746) at java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.await(AbstractQueuedSynchronizer.java:1707) at java.util.concurrent.PriorityBlockingQueue.take(PriorityBlockingQueue.java:538) at iba.b(PG:5) at iba.run(PG:11) DumpLatencyMs: 1246.69 "Thread-10" prio=5 tid=38 Waiting | group="main" sCount=1 ucsCount=0 flags=1 obj=0x2127058 self=0xb40000778f272000 | sysTid=11139 nice=10 cgrp=foreground sched=0/0 handle=0x770ab62500 | state=S schedstat=( 344000 376216541 3 ) utm=0 stm=0 core=5 HZ=100 | stack=0x770aa5f000-0x770aa61000 stackSize=1037KB | held mutexes= at jdk.internal.misc.Unsafe.park(Native method) - waiting on an unknown object at java.util.concurrent.locks.LockSupport.park(LockSupport.java:371) at java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionNode.block(AbstractQueuedSynchronizer.java:519) at java.util.concurrent.ForkJoinPool.unmanagedBlock(ForkJoinPool.java:3805) at java.util.concurrent.ForkJoinPool.managedBlock(ForkJoinPool.java:3746) at java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.await(AbstractQueuedSynchronizer.java:1707) at java.util.concurrent.PriorityBlockingQueue.take(PriorityBlockingQueue.java:538) at ibf.a(PG:5) at ibf.run(PG:6) DumpLatencyMs: 1246.99 "BG Thread #0" daemon prio=4 tid=39 Waiting | group="main" sCount=1 ucsCount=0 flags=1 obj=0x2151c68 self=0xb40000778f273c00 | sysTid=11202 nice=10 cgrp=foreground sched=0/0 handle=0x7708a52500 | state=S schedstat=( 52208314 4031469156 484 ) utm=0 stm=5 core=7 HZ=100 | stack=0x770894f000-0x7708951000 stackSize=1037KB | held mutexes= at jdk.internal.misc.Unsafe.park(Native method) - waiting on an unknown object at java.util.concurrent.locks.LockSupport.park(LockSupport.java:221) at amqt.run(PG:226) at zcg.run(PG:869) at zar.run(PG:534) at java.lang.Thread.run(Thread.java:1119) at zzj.run(PG:51) DumpLatencyMs: 1248.63 "ProcessStablePhenotypeFlag" prio=5 tid=41 Waiting | group="main" sCount=1 ucsCount=0 flags=1 obj=0x21634b0 self=0xb400007793387800 | sysTid=11206 nice=0 cgrp=foreground sched=0/0 handle=0x7706832500 | state=S schedstat=( 18786464 418011768 92 ) utm=1 stm=0 core=4 HZ=100 | stack=0x770672f000-0x7706731000 stackSize=1037KB | held mutexes= at jdk.internal.misc.Unsafe.park(Native method) - waiting on an unknown object at java.util.concurrent.locks.LockSupport.park(LockSupport.java:371) at java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionNode.block(AbstractQueuedSynchronizer.java:519) at java.util.concurrent.ForkJoinPool.unmanagedBlock(ForkJoinPool.java:3805) at java.util.concurrent.ForkJoinPool.managedBlock(ForkJoinPool.java:3746) at java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.await(AbstractQueuedSynchronizer.java:1707) at java.util.concurrent.ScheduledThreadPoolExecutor$DelayedWorkQueue.take(ScheduledThreadPoolExecutor.java:1224) at java.util.concurrent.ScheduledThreadPoolExecutor$DelayedWorkQueue.take(ScheduledThreadPoolExecutor.java:953) at java.util.concurrent.ThreadPoolExecutor.getTask(ThreadPoolExecutor.java:1082) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:651) at java.lang.Thread.run(Thread.java:1119) DumpLatencyMs: 2750.61 "OneGoogle #3" prio=5 tid=42 TimedWaiting | group="main" sCount=1 ucsCount=0 flags=1 obj=0x2180838 self=0xb40000778f277400 | sysTid=11213 nice=0 cgrp=foreground sched=0/0 handle=0x7705722500 | state=S schedstat=( 2015849 122471692 8 ) utm=0 stm=0 core=5 HZ=100 | stack=0x770561f000-0x7705621000 stackSize=1037KB | held mutexes= at jdk.internal.misc.Unsafe.park(Native method) - waiting on an unknown object at java.util.concurrent.locks.LockSupport.parkNanos(LockSupport.java:269) at java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.awaitNanos(AbstractQueuedSynchronizer.java:1758) at java.util.concurrent.ScheduledThreadPoolExecutor$DelayedWorkQueue.take(ScheduledThreadPoolExecutor.java:1236) at java.util.concurrent.ScheduledThreadPoolExecutor$DelayedWorkQueue.take(ScheduledThreadPoolExecutor.java:953) at java.util.concurrent.ThreadPoolExecutor.getTask(ThreadPoolExecutor.java:1082) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:651) at java.lang.Thread.run(Thread.java:1119) DumpLatencyMs: 2753 "WM.task-1" prio=5 tid=43 Waiting | group="main" sCount=1 ucsCount=0 flags=1 obj=0x218ab98 self=0xb40000778f279000 | sysTid=11234 nice=0 cgrp=foreground sched=0/0 handle=0x7704612500 | state=S schedstat=( 40139693 672182998 145 ) utm=1 stm=2 core=6 HZ=100 | stack=0x770450f000-0x7704511000 stackSize=1037KB | held mutexes= at jdk.internal.misc.Unsafe.park(Native method) - waiting on an unknown object at java.util.concurrent.locks.LockSupport.park(LockSupport.java:371) at java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionNode.block(AbstractQueuedSynchronizer.java:519) at java.util.concurrent.ForkJoinPool.unmanagedBlock(ForkJoinPool.java:3805) at java.util.concurrent.ForkJoinPool.managedBlock(ForkJoinPool.java:3746) at java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.await(AbstractQueuedSynchronizer.java:1707) at java.util.concurrent.LinkedBlockingQueue.take(LinkedBlockingQueue.java:435) at java.util.concurrent.ThreadPoolExecutor.getTask(ThreadPoolExecutor.java:1082) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:651) at java.lang.Thread.run(Thread.java:1119) DumpLatencyMs: 2753.16 "WM.task-2" prio=5 tid=44 Waiting | group="main" sCount=1 ucsCount=0 flags=1 obj=0x21a4aa0 self=0xb40000778f27c800 | sysTid=11260 nice=0 cgrp=foreground sched=0/0 handle=0x77033f2500 | state=S schedstat=( 15020459 416558388 53 ) utm=0 stm=1 core=6 HZ=100 | stack=0x77032ef000-0x77032f1000 stackSize=1037KB | held mutexes= at jdk.internal.misc.Unsafe.park(Native method) - waiting on an unknown object at java.util.concurrent.locks.LockSupport.park(LockSupport.java:371) at java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionNode.block(AbstractQueuedSynchronizer.java:519) at java.util.concurrent.ForkJoinPool.unmanagedBlock(ForkJoinPool.java:3805) at java.util.concurrent.ForkJoinPool.managedBlock(ForkJoinPool.java:3746) at java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.await(AbstractQueuedSynchronizer.java:1707) at java.util.concurrent.LinkedBlockingQueue.take(LinkedBlockingQueue.java:435) at java.util.concurrent.ThreadPoolExecutor.getTask(ThreadPoolExecutor.java:1082) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:651) at java.lang.Thread.run(Thread.java:1119) DumpLatencyMs: 2753.29 "WM.task-3" prio=5 tid=45 Waiting | group="main" sCount=1 ucsCount=0 flags=1 obj=0x21a8708 self=0xb400007793389400 | sysTid=11268 nice=0 cgrp=foreground sched=0/0 handle=0x77022e2500 | state=S schedstat=( 62694210 1739679555 258 ) utm=1 stm=4 core=6 HZ=100 | stack=0x77021df000-0x77021e1000 stackSize=1037KB | held mutexes= at jdk.internal.misc.Unsafe.park(Native method) - waiting on an unknown object at java.util.concurrent.locks.LockSupport.park(LockSupport.java:371) at java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionNode.block(AbstractQueuedSynchronizer.java:519) at java.util.concurrent.ForkJoinPool.unmanagedBlock(ForkJoinPool.java:3805) at java.util.concurrent.ForkJoinPool.managedBlock(ForkJoinPool.java:3746) at java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.await(AbstractQueuedSynchronizer.java:1707) at java.util.concurrent.LinkedBlockingQueue.take(LinkedBlockingQueue.java:435) at java.util.concurrent.ThreadPoolExecutor.getTask(ThreadPoolExecutor.java:1082) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:651) at java.lang.Thread.run(Thread.java:1119) DumpLatencyMs: 2754.6 "BG Thread #1" daemon prio=4 tid=47 Waiting | group="main" sCount=1 ucsCount=0 flags=1 obj=0x2158400 self=0xb40000778f27e400 | sysTid=11277 nice=10 cgrp=foreground sched=0/0 handle=0x77001d2500 | state=S schedstat=( 11354998 2759772701 28 ) utm=0 stm=1 core=7 HZ=100 | stack=0x77000cf000-0x77000d1000 stackSize=1037KB | held mutexes= at jdk.internal.misc.Unsafe.park(Native method) - waiting on an unknown object at java.util.concurrent.locks.LockSupport.park(LockSupport.java:221) at amqt.run(PG:226) at zcg.run(PG:869) at zar.run(PG:534) at java.lang.Thread.run(Thread.java:1119) at zzj.run(PG:51) DumpLatencyMs: 2754.79 "binder:10177_4" prio=5 tid=48 Native | group="main" sCount=1 ucsCount=0 flags=1 obj=0x21bda38 self=0xb4000077933a8c00 | sysTid=11309 nice=0 cgrp=foreground sched=0/0 handle=0x767fff8500 | state=S schedstat=( 4722615 1040842769 18 ) utm=0 stm=0 core=6 HZ=100 | stack=0x767ff01000-0x767ff03000 stackSize=989KB | held mutexes= native: #00 pc 000f8588 /apex/com.android.runtime/lib64/bionic/libc.so (__ioctl+8) (BuildId: 65b0c8857610bf85fb81a624be775cc4) native: #01 pc 000974ec /apex/com.android.runtime/lib64/bionic/libc.so (ioctl+156) (BuildId: 65b0c8857610bf85fb81a624be775cc4) native: #02 pc 00079940 /system/lib64/libbinder.so (android::IPCThreadState::joinThreadPool+592) (BuildId: dfa6b032e92a8e38cf45c512e231ee8a) native: #03 pc 00079450 /system/lib64/libbinder.so (android::PoolThread::threadLoop+96) (BuildId: dfa6b032e92a8e38cf45c512e231ee8a) native: #04 pc 00019368 /system/lib64/libutils.so (android::Thread::_threadLoop+248) (BuildId: e41f2bc353059dc14cf4ee6b493447a4) native: #05 pc 00134b1c /system/lib64/libandroid_runtime.so (android::AndroidRuntime::javaThreadShell+140) (BuildId: a0d95d90e274625a9f38a09d50148b89) native: #06 pc 0001bac4 /system/lib64/libutils.so (libutil_thread_trampoline +20) (BuildId: e41f2bc353059dc14cf4ee6b493447a4) native: #07 pc 0009c9b8 /apex/com.android.runtime/lib64/bionic/libc.so (__pthread_start+232) (BuildId: 65b0c8857610bf85fb81a624be775cc4) native: #08 pc 0008ef10 /apex/com.android.runtime/lib64/bionic/libc.so (__start_thread+64) (BuildId: 65b0c8857610bf85fb81a624be775cc4) (no managed stack frames) DumpLatencyMs: 2759.62 "Lite Thread #0" daemon prio=5 tid=49 Waiting | group="main" sCount=1 ucsCount=0 flags=1 obj=0x21b15e8 self=0xb4000077933a7000 | sysTid=11328 nice=0 cgrp=foreground sched=0/0 handle=0x767fef4500 | state=S schedstat=( 7028539 1316541313 13 ) utm=0 stm=0 core=7 HZ=100 | stack=0x767fdf1000-0x767fdf3000 stackSize=1037KB | held mutexes= at jdk.internal.misc.Unsafe.park(Native method) - waiting on an unknown object at java.util.concurrent.locks.LockSupport.park(LockSupport.java:221) at amqt.run(PG:226) at zcg.run(PG:869) at zar.run(PG:534) at java.lang.Thread.run(Thread.java:1119) at zzj.run(PG:51) DumpLatencyMs: 2760.14 "BG Thread #3" daemon prio=4 tid=50 Waiting | group="main" sCount=1 ucsCount=0 flags=1 obj=0x21bef80 self=0xb40000778f309c00 | sysTid=11425 nice=10 cgrp=foreground sched=0/0 handle=0x767ccd4500 | state=S schedstat=( 4124001 896250615 28 ) utm=0 stm=0 core=7 HZ=100 | stack=0x767cbd1000-0x767cbd3000 stackSize=1037KB | held mutexes= at jdk.internal.misc.Unsafe.park(Native method) - waiting on an unknown object at java.util.concurrent.locks.LockSupport.park(LockSupport.java:221) at amqt.run(PG:226) at zcg.run(PG:869) at zar.run(PG:534) at java.lang.Thread.run(Thread.java:1119) at zzj.run(PG:51) DumpLatencyMs: 2761.79 "BG Thread #2" daemon prio=4 tid=51 Waiting | group="main" sCount=1 ucsCount=0 flags=1 obj=0x21a1110 self=0xb40000778f308000 | sysTid=11410 nice=10 cgrp=foreground sched=0/0 handle=0x767cde4500 | state=S schedstat=( 1815769 95449769 3 ) utm=0 stm=0 core=1 HZ=100 | stack=0x767cce1000-0x767cce3000 stackSize=1037KB | held mutexes= at jdk.internal.misc.Unsafe.park(Native method) - waiting on an unknown object at java.util.concurrent.locks.LockSupport.park(LockSupport.java:221) at amqt.run(PG:226) at zcg.run(PG:869) at zar.run(PG:534) at java.lang.Thread.run(Thread.java:1119) at zzj.run(PG:51) DumpLatencyMs: 2763.28 "GhaSingleThread-0" prio=5 tid=52 Waiting | group="main" sCount=1 ucsCount=0 flags=1 obj=0x21a1a58 self=0xb40000778f30b800 | sysTid=11427 nice=0 cgrp=foreground sched=0/0 handle=0x767abc4500 | state=S schedstat=( 4975462 76273537 15 ) utm=0 stm=0 core=7 HZ=100 | stack=0x767aac1000-0x767aac3000 stackSize=1037KB | held mutexes= at jdk.internal.misc.Unsafe.park(Native method) - waiting on an unknown object at java.util.concurrent.locks.LockSupport.park(LockSupport.java:371) at java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionNode.block(AbstractQueuedSynchronizer.java:519) at java.util.concurrent.ForkJoinPool.unmanagedBlock(ForkJoinPool.java:3805) at java.util.concurrent.ForkJoinPool.managedBlock(ForkJoinPool.java:3746) at java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.await(AbstractQueuedSynchronizer.java:1707) at java.util.concurrent.ScheduledThreadPoolExecutor$DelayedWorkQueue.take(ScheduledThreadPoolExecutor.java:1224) at java.util.concurrent.ScheduledThreadPoolExecutor$DelayedWorkQueue.take(ScheduledThreadPoolExecutor.java:953) at java.util.concurrent.ThreadPoolExecutor.getTask(ThreadPoolExecutor.java:1082) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:651) at java.lang.Thread.run(Thread.java:1119) DumpLatencyMs: 2764.65 "WM.task-4" prio=5 tid=53 Waiting | group="main" sCount=1 ucsCount=0 flags=1 obj=0x21c9e28 self=0xb40000778f30d400 | sysTid=11450 nice=0 cgrp=foreground sched=0/0 handle=0x77c2909500 | state=S schedstat=( 25403692 377713385 134 ) utm=0 stm=1 core=6 HZ=100 | stack=0x77c2806000-0x77c2808000 stackSize=1037KB | held mutexes= at jdk.internal.misc.Unsafe.park(Native method) - waiting on an unknown object at java.util.concurrent.locks.LockSupport.park(LockSupport.java:371) at java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionNode.block(AbstractQueuedSynchronizer.java:519) at java.util.concurrent.ForkJoinPool.unmanagedBlock(ForkJoinPool.java:3805) at java.util.concurrent.ForkJoinPool.managedBlock(ForkJoinPool.java:3746) at java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.await(AbstractQueuedSynchronizer.java:1707) at java.util.concurrent.LinkedBlockingQueue.take(LinkedBlockingQueue.java:435) at java.util.concurrent.ThreadPoolExecutor.getTask(ThreadPoolExecutor.java:1082) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:651) at java.lang.Thread.run(Thread.java:1119) DumpLatencyMs: 2764.82 "ConnectivityThread" prio=5 tid=54 Native | group="main" sCount=1 ucsCount=0 flags=1 obj=0x21da2f0 self=0xb40000778f31d000 | sysTid=11459 nice=0 cgrp=foreground sched=0/0 handle=0x77c2109500 | state=S schedstat=( 485385 41954155 2 ) utm=0 stm=0 core=5 HZ=100 | stack=0x77c2006000-0x77c2008000 stackSize=1037KB | held mutexes= native: #00 pc 000fa5c8 /apex/com.android.runtime/lib64/bionic/libc.so (__epoll_pwait+8) (BuildId: 65b0c8857610bf85fb81a624be775cc4) native: #01 pc 00016a10 /system/lib64/libutils.so (android::Looper::pollOnce+288) (BuildId: e41f2bc353059dc14cf4ee6b493447a4) native: #02 pc 001e341c /system/lib64/libandroid_runtime.so (android::android_os_MessageQueue_nativePollOnce+44) (BuildId: a0d95d90e274625a9f38a09d50148b89) at android.os.MessageQueue.nativePollOnce(Native method) at android.os.MessageQueue.nextLegacy(MessageQueue.java:934) at android.os.MessageQueue.next(MessageQueue.java:1046) at android.os.Looper.loopOnce(Looper.java:221) at android.os.Looper.loop(Looper.java:412) at android.os.HandlerThread.run(HandlerThread.java:85) DumpLatencyMs: 2764.94 Zygote loaded classes=43616 post zygote classes=3553 Dumping registered class loaders #0 dalvik.system.PathClassLoader: [], parent #1 #1 java.lang.BootClassLoader: [], no parent #2 dalvik.system.PathClassLoader: [/my_product/del-app-pre/GoogleHome/GoogleHome.apk!classes4.dex:/my_product/del-app-pre/GoogleHome/GoogleHome.apk!classes3.dex:/my_product/del-app-pre/GoogleHome/GoogleHome.apk:/my_product/del-app-pre/GoogleHome/GoogleHome.apk!classes6.dex:/my_product/del-app-pre/GoogleHome/GoogleHome.apk!classes5.dex:/my_product/del-app-pre/GoogleHome/GoogleHome.apk!classes2.dex], parent #1 #3 dalvik.system.DelegateLastClassLoader: [/data/user_de/0/com.google.android.gms/app_chimera/m/00000002/DynamiteLoader.apk:/data/user_de/0/com.google.android.gms/app_chimera/m/00000002/DynamiteLoader.apk!classes2.dex], parent #0 #4 dalvik.system.DelegateLastClassLoader: [/data/user_de/0/com.google.android.gms/app_chimera/m/00000007/MeasurementDynamite.apk!classes2.dex:/data/user_de/0/com.google.android.gms/app_chimera/m/00000007/MeasurementDynamite.apk], parent #2 Done dumping class loaders Classes initialized: 0 in 0 Intern table: 69244 strong; 1247 weak JNI: CheckJNI is off; globals=472 (plus 120 weak) Libraries: libSchedAssistJni.so libUahPerf_Jni.so libandroid.so libaudioeffect_jni.so libcompiler_rt.so libframework-connectivity-jni.so libframework-connectivity-tiramisu-jni.so libicu_jni.so libjavacore.so libjavacrypto.so libjnigraphics.so libmainlinecronet.139.0.7205.3.so libmedia_jni.so libonetrace_jni.so libopenjdk.so liboplus_framework_jni.so liboplusextzawgyi.so liboplusgui_jni.so liboplushwui_jni.so libphoenix_jni.so librs_jni.so librtp_jni.so libsoundpool.so libstats_jni.so libvintf_jni.so libwebviewchromium_loader.so (26) Heap: 58% free, 4171KB/10026KB Image spaces: /data/user/0/com.google.android.apps.chromecast.app/cache/oat_primary/arm64/GoogleHome.art /system/framework/arm64/boot.art /system/framework/arm64/boot-core-libart.art /system/framework/arm64/boot-okhttp.art /system/framework/arm64/boot-bouncycastle.art /system/framework/arm64/boot-apache-xml.art /system/framework/arm64/boot-framework.art /system/framework/arm64/boot-framework-graphics.art /system/framework/arm64/boot-framework-location.art /system/framework/arm64/boot-ext.art /system/framework/arm64/boot-telephony-common.art /system/framework/arm64/boot-voip-common.art /system/framework/arm64/boot-ims-common.art /system/framework/arm64/boot-framework-ondeviceintelligence-platform.art /system/framework/arm64/boot-framework-nfc.art /system/framework/arm64/boot-oplus-framework.art /system/framework/arm64/boot-com.android.fmradio.art /system/framework/arm64/boot-subsystem-framework.art /system/framework/arm64/boot-mediatek-common.art /system/framework/arm64/boot-mediatek-framework.art /system/framework/arm64/boot-mediatek-ims-common.art /system/framework/arm64/boot-mediatek-ims-base.art /system/framework/arm64/boot-core-icu4j.art /system/framework/arm64/boot-framework-adservices.art Dumping cumulative Gc timings Start Dumping Averages for 1 iterations for concurrent mark compact MarkConcurrentRoots: Sum: 1.047s Avg: 1.047s MarkRootsCheckpoint: Sum: 887.398ms Avg: 887.398ms RunningThreadFlips: Sum: 265.589ms Avg: 265.589ms ProcessMarkStackNonNull: Sum: 262.772ms Avg: 262.772ms UpdateAndMarkImageModUnionTable: Sum: 129.391ms Avg: 129.391ms ProcessMarkStack: Sum: 65.034ms Avg: 65.034ms ThreadListFlip: Sum: 21.931ms Avg: 21.931ms (Paused)ScanGrayAllocSpaceObjects: Sum: 9.688ms Avg: 9.688ms CompactMovingSpace: Sum: 9.635ms Avg: 9.635ms ScanGrayImmuneSpaceObjects: Sum: 7.594ms Avg: 7.594ms CompactionPhase: Sum: 4.329ms Avg: 4.329ms (Paused)MarkingPause: Sum: 3.121ms Avg: 3.121ms PrepareForCompaction: Sum: 1.408ms Avg: 1.408ms SweepSystemWeaks: Sum: 1.385ms Avg: 1.385ms ScanGrayAllocSpaceObjects: Sum: 960us Avg: 960us FinishPhase: Sum: 796us Avg: 796us PrepareForMarking: Sum: 740us Avg: 740us (Paused)UpdateImmuneSpaces: Sum: 706us Avg: 706us ForwardSoftReferences: Sum: 657us Avg: 657us (Paused)ScanGrayImmuneSpaceObjects: Sum: 563us Avg: 563us (Paused)UpdateRoots: Sum: 539us Avg: 539us UpdateAndMarkZygoteModUnionTable: Sum: 525us Avg: 525us MarkAllocStackAsLive: Sum: 371us Avg: 371us MarkingPhase: Sum: 273us Avg: 273us (Paused)KernelPreparation: Sum: 201us Avg: 201us ProcessReferences: Sum: 91us Avg: 91us ReclaimPhase: Sum: 85us Avg: 85us EnqueueFinalizerReferences: Sum: 77us Avg: 77us SweepLargeObjects: Sum: 69us Avg: 69us Sweep: Sum: 60us Avg: 60us InitializePhase: Sum: 56us Avg: 56us (Paused)SweepSystemWeaks: Sum: 52us Avg: 52us MarkNonThreadRoots: Sum: 49us Avg: 49us SwapBitmaps: Sum: 42us Avg: 42us SweepMallocSpace: Sum: 40us Avg: 40us (Paused)UpdateCompactionDataStructures: Sum: 35us Avg: 35us PreCleanCards: Sum: 34us Avg: 34us FlipThreadSuspension: Sum: 28us Avg: 28us ScanGrayZygoteSpaceObjects: Sum: 23us Avg: 23us CompactionPause: Sum: 23us Avg: 23us (Paused)UpdateNonMovingSpace: Sum: 22us Avg: 22us MarkRoots: Sum: 14us Avg: 14us (Paused)ScanGrayZygoteSpaceObjects: Sum: 3us Avg: 3us ReMarkRoots: Sum: 3us Avg: 3us UnBindBitmaps: Sum: 2us Avg: 2us SwapStacks: Sum: 1us Avg: 1us Done Dumping Averages concurrent mark compact paused: Sum: 37.582ms 99% C.I. 14.160ms-23.422ms Avg: 18.791ms Max: 23.422ms concurrent mark compact freed-bytes: Avg: 12MB Max: 12MB Min: 12MB Freed-bytes histogram: 11520:1 concurrent mark compact total time: 2.723s mean time: 2.723s concurrent mark compact freed: 12MB concurrent mark compact throughput: 4618KB/s per cpu-time: 299465674/s / 285MB/s concurrent mark compact tracing throughput: 998KB/s per cpu-time: 61MB/s Total time spent in GC: 2.723s Mean GC size throughput: 4617KB/s per cpu-time: 283MB/s Total bytes allocated 16MB Total bytes freed 12MB Free memory 5854KB Free memory until GC 5854KB Free memory until OOME 379MB Total memory 10026KB Max memory 384MB Zygote space size 7400KB Total mutator paused time: 37.582ms Total time waiting for GC to complete: 0 Total GC count: 1 Total GC time: 2.723s Total blocking GC count: 0 Total blocking GC time: 0 Total pre-OOME GC count: 0 Histogram of GC count per 10000 ms: 0:2 Histogram of blocking GC count per 10000 ms: 0:2 Native bytes total: 9446340 registered: 1232388 Total native bytes at last GC: 9588756 /system_ext/framework/oat/arm64/androidx.window.sidecar.odex: verify /data/dalvik-cache/arm64/my_product@del-app-pre@GoogleHome@GoogleHome.apk@classes.dex: verify /system/framework/oat/arm64/android.hidl.base-V1.0-java.odex: verify /system/framework/oat/arm64/android.hidl.manager-V1.0-java.odex: verify /system/framework/oat/arm64/android.test.base.odex: verify /system/framework/oat/arm64/org.apache.http.legacy.odex: speed-profile /system/framework/oat/arm64/com.android.media.remotedisplay.odex: verify /system/framework/oat/arm64/com.android.location.provider.odex: speed /system_ext/framework/oat/arm64/androidx.window.extensions.odex: verify Current JIT code cache size (used / resident): 0KB / 32KB Current JIT data cache size (used / resident): 0KB / 32KB Zygote JIT code cache size (at point of fork): 0KB / 32KB Zygote JIT data cache size (at point of fork): 0KB / 32KB Current JIT mini-debug-info size: 128B Current JIT capacity: 64KB Current number of JIT JNI stub entries: 0 Current number of JIT code cache entries: 0 Total number of JIT baseline compilations: 0 Total number of JIT optimized compilations: 0 Total number of JIT compilations for on stack replacement: 0 Total number of JIT code cache collections: 0 Memory used for stack maps: <no data> Memory used for compiled code: <no data> Memory used for profiling info: <no data> Start Dumping Averages for 0 iterations for JIT timings Done Dumping Averages Memory used for compilation: <no data> ProfileSaver total_bytes_written=0 ProfileSaver total_number_of_writes=0 ProfileSaver total_number_of_code_cache_queries=0 ProfileSaver total_number_of_skipped_writes=0 ProfileSaver total_number_of_failed_writes=0 ProfileSaver total_ms_of_sleep=0 ProfileSaver total_ms_of_work=0 ProfileSaver total_number_of_hot_spikes=0 ProfileSaver total_number_of_wake_ups=0 *** ART internal metrics *** Metadata: timestamp_since_start_ms: 23887 Metrics: ClassLoadingTotalTime: count = 15627853 ClassVerificationTotalTime: count = 3736031 ClassVerificationCount: count = 666 WorldStopTimeDuringGCAvg: count = 37583 YoungGcCount: count = 0 FullGcCount: count = 1 TotalBytesAllocated: count = 6397888 TotalGcCollectionTime: count = 2724 YoungGcThroughputAvg: count = 0 FullGcThroughputAvg: count = 268 YoungGcTracingThroughputAvg: count = 0 FullGcTracingThroughputAvg: count = 0 JitMethodCompileTotalTime: count = 0 JitMethodCompileCount: count = 0 YoungGcCollectionTime: range = 0...60000, buckets: 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 FullGcCollectionTime: range = 0...60000, buckets: 1,0,0,0,0,0,0,0,0,0,0,0,0,0,0 YoungGcThroughput: range = 0...10000, buckets: 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 FullGcThroughput: range = 0...10000, buckets: 1,0,0,0,0,0,0,0,0,0,0,0,0,0,0 YoungGcTracingThroughput: range = 0...10000, buckets: 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 FullGcTracingThroughput: range = 0...10000, buckets: 1,0,0,0,0,0,0,0,0,0,0,0,0,0,0 GcWorldStopTime: count = 37583 GcWorldStopCount: count = 1 YoungGcScannedBytes: count = 0 YoungGcFreedBytes: count = 0 YoungGcDuration: count = 0 FullGcScannedBytes: count = 2783512 FullGcFreedBytes: count = 12397792 FullGcDuration: count = 2724 GcWorldStopTimeDelta: count = 37583 GcWorldStopCountDelta: count = 1 YoungGcScannedBytesDelta: count = 0 YoungGcFreedBytesDelta: count = 0 YoungGcDurationDelta: count = 0 FullGcScannedBytesDelta: count = 2783512 FullGcFreedBytesDelta: count = 12397792 FullGcDurationDelta: count = 2724 JitMethodCompileTotalTimeDelta: count = 0 JitMethodCompileCountDelta: count = 0 ClassVerificationTotalTimeDelta: count = 3736031 ClassVerificationCountDelta: count = 666 ClassLoadingTotalTimeDelta: count = 15621644 TotalBytesAllocatedDelta: count = 6397888 TotalGcCollectionTimeDelta: count = 2724 YoungGcCountDelta: count = 0 FullGcCountDelta: count = 1 TimeElapsedDelta: count = 88388551 AppSlowPathDuringYoungGcDurationDelta: count = 0 AppSlowPathDuringFullGcDurationDelta: count = 280 *** Done dumping ART internal metrics *** ----- end 10177 ----- ----- Waiting Channels: pid 10177 at 2025-12-17 16:00:49.732878182+0800 ----- Cmd line: com.google.android.apps.chromecast.app sysTid=10177 0 sysTid=10206 do_sigtimedwait sysTid=10207 pipe_read sysTid=10208 futex_wait sysTid=10209 futex_wait sysTid=10210 0 sysTid=10212 futex_wait sysTid=10213 futex_wait sysTid=10215 binder_thread_read sysTid=10216 binder_thread_read sysTid=10280 binder_thread_read sysTid=10285 do_epoll_wait sysTid=10376 futex_wait sysTid=10638 futex_wait sysTid=10639 futex_wait sysTid=10640 futex_wait sysTid=10643 futex_wait sysTid=10647 futex_wait sysTid=10655 futex_wait sysTid=10657 futex_wait sysTid=10815 futex_wait sysTid=10883 futex_wait sysTid=10896 do_epoll_wait sysTid=10981 futex_wait sysTid=10984 futex_wait sysTid=11002 do_epoll_wait sysTid=11007 futex_wait sysTid=11017 futex_wait sysTid=11020 futex_wait sysTid=11098 do_epoll_wait sysTid=11113 0 sysTid=11118 0 sysTid=11126 0 sysTid=11134 futex_wait sysTid=11136 futex_wait sysTid=11137 futex_wait sysTid=11138 futex_wait sysTid=11139 futex_wait sysTid=11202 futex_wait sysTid=11203 futex_wait sysTid=11206 futex_wait sysTid=11213 futex_wait sysTid=11234 futex_wait sysTid=11260 futex_wait sysTid=11268 futex_wait sysTid=11269 0 sysTid=11277 futex_wait sysTid=11309 binder_thread_read sysTid=11328 futex_wait sysTid=11410 futex_wait sysTid=11425 futex_wait sysTid=11427 futex_wait sysTid=11450 futex_wait sysTid=11459 do_epoll_wait sysTid=11505 0 ----- end 10177 ----- DurationsV5: 88395543,15,25,103,129,302,7,0,33,0,0,8,0,0,0,77,3017,27,1,2733,2,1,0,0,0 ----- dumping ended at 88398629
最新发布
12-27
### **ANR(Application Not Responding)问题分析** 根据提供的日志,`com.google.android.apps.chromecast.app` 进程发生了 **ANR(Application Not Responding)** 问题。以下是关键分析: --- ## **1. ANR 的基本信息** - **进程名**:`com.google.android.apps.chromecast.app`(Google Home应用) - **触发时间**:`2025-12-17 16:00:49.732878182+0800` - **主要线程状态**: - 多个线程处于 `futex_wait`、`binder_thread_read`、`do_epoll_wait` 等待状态。 - **主线程(`GoogleApiHandler`)阻塞**: ```plaintext "GoogleApiHandler" prio=5 tid=23 Native | state=S schedstat=( 77714836 3054941938 494 ) utm=5 stm=2 core=7 HZ=100 | held mutexes= native: #00 pc 000fa5c8 /apex/com.android.runtime/lib64/bionic/libc.so (__epoll_pwait+8) at android.os.MessageQueue.nativePollOnce(Native method) at android.os.MessageQueue.nextLegacy(MessageQueue.java:934) at android.os.MessageQueue.next(MessageQueue.java:1046) at android.os.Looper.loopOnce(Looper.java:221) at android.os.Looper.loop(Looper.java:412) at android.os.HandlerThread.run(HandlerThread.java:85) ``` - **其他线程**: - `"GhaSingleThread-0"` 在 `Unsafe.park`(等待锁) - `"OneGoogle #0"` 在 `futex_wait` - **多个线程处于 `futex_wait`**(可能因锁竞争导致) --- ## **2. 可能的原因** ### **(1) 主线程阻塞** - **主线程**(`GoogleApiHandler`)在 `nativePollOnce` 等待消息,但可能被长时间运行的同步任务阻塞。 - **UI 线程未响应**:某些任务在主线程执行过久(如网络请求、数据库查询、文件 I/O)。 ### **(2) 锁竞争(futex_wait)** - **多线程竞争**导致 `futex_wait`,如: - `"GhaSingleThread-0"` 等待 `Unsafe.park`(可能因任务队列超载)。 - 其他线程(`OneGoogle #0`、`ProtoDataStore-Message-Handler`)在 `futex_wait` 或 `binder_thread_read`。 ### **(3) Binder 通信问题** - 多个线程在 `binder_thread_read` 等待远程调用(可能涉及跨进程通信阻塞)。 - **Binder 线程池耗尽**:若 Binder 调用被阻塞,可能导致 ANR。 ### **(4) 高 CPU 或 I/O 负载** - **GC 压力**: - 日志显示 `FullGcCount: count = 1`,可能有内存压力。 - **I/O 竞争**: - 某些线程可能在等待磁盘或网络 I/O。 --- ## **3. 解决方案** ### **(1)优化主线程** ✅ **检查主线程任务**: - 避免在主线程执行网络请求、数据库查询、文件读写等耗时操作。 - 使用 `StrictMode` 检测主线程阻塞: ```java StrictMode.setThreadPolicy(new StrictMode.ThreadPolicy.Builder() .detectDiskReads() .detectDiskWrites() .detectNetwork() .penaltyLog() .build()); ``` ✅ **使用异步任务**: - 使用 `AsyncTask`、`RxJava`、`Coroutines` 或 `ExecutorService` 执行耗时任务: ```kotlin viewModelScope.launch(Dispatchers.IO) { // 后台任务 withContext(Dispatchers.Main) { // 更新 UI } } ``` ### **(2)减少锁竞争** ✅ **检查同步锁**: - 避免全局锁(如 `synchronized`、`ReentrantLock`)长期持有。 - 使用 `ConcurrentHashMap` 或 `CopyOnWriteArrayList` 替代同步集合。 ✅ **任务队列优化**: - 检查 `"GhaSingleThread-0"` 的任务队列是否过载。 - 增加线程池大小或优化任务调度逻辑。 ### **(3)Binder 优化** ✅ **减少跨进程调用**: - 检查 `Binder` 调用(如 `binder_thread_read`)是否阻塞。 - 使用 `oneway` 接口(非阻塞)或缓存数据。 ✅ **增加 Binder 线程池**: - 修改 `ProcessState` 的 `Binder` 线程数(需 root): ```java ProcessState::self()->setThreadPoolMaxThreadCount(16); // 默认 15 ``` ### **(4)内存优化** ✅ **减少 GC 压力**: - 检查内存泄漏(`LeakCanary`、`Android Profiler`)。 - 避免频繁创建对象(如循环内 `new`)。 ✅ **优化 Bitmap 加载**: - 使用 `Glide` 或 `Picasso` 并设置合适的大小: ```kotlin Glide.with(context) .load(url) .override(1024, 768) // 限制尺寸 .into(imageView) ``` --- ## **4. 如何验证修复?** | **测试项** | **方法** | **预期结果** | |------------|----------|--------------| | **主线程响应** | 快速操作 UI(如滑动、点击) | 无卡顿/ANR | | **线程状态** | `adb shell ps -t <pid>` | 无长时间 `futex_wait` | | **Binder 调用** | `adb shell dumpsys activity services` | 无 `binder_thread_read` 阻塞 | | **内存占用** | `adb shell dumpsys meminfo <package>` | 无异常增长 | --- ## **5. 相关问题**
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值