Source:
<code>private int tryExecute(final Runnable runnable) { QNode tailNext; TaskNode tail = this.tail; TaskNode node = null; for (;;) { tailNext = tail.getNext(); <START> if (tailNext instanceof PoolThreadNode) { <END> final QNode tailNextNext = tailNext.getNext(); if (tail.compareAndSetNext(tailNext, tailNextNext)) { assert tail instanceof TaskNode; PoolThreadNode consumerNode = (PoolThreadNode) tailNext; if (consumerNode.compareAndSetTask(WAITING, runnable)) { consumerNode.compareAndSetNext(tailNextNext, null); consumerNode.unpark(); return EXE_OK; } } } else if (tailNext == null) { int tr = tryAllocateThread(growthResistance); if (tr == AT_YES) { return EXE_CREATE_THREAD; } if (tr == AT_SHUTDOWN) { return EXE_REJECT_SHUTDOWN; } assert tr == AT_NO; if (!NO_QUEUE_LIMIT && !increaseQueueSize()) { tr = tryAllocateThread(0.0f); if (tr == AT_YES) { return EXE_CREATE_THREAD; } if (tr == AT_SHUTDOWN) { return EXE_REJECT_SHUTDOWN; } assert tr == AT_NO; return EXE_REJECT_QUEUE_FULL; } if (node == null) { node = new TaskNode(runnable); } if (tail.compareAndSetNext(null, node)) { compareAndSetTail(tail, node); return EXE_OK; } if (!NO_QUEUE_LIMIT) decreaseQueueSize(); } else if (tailNext == tail) { } else if (tailNext instanceof TaskNode) { TaskNode tailNextTaskNode = (TaskNode) tailNext; if (compareAndSetTail(tail, tailNextTaskNode)) { tail = tailNextTaskNode; continue; } } else { assert tailNext instanceof TerminateWaiterNode; return EXE_REJECT_SHUTDOWN; } if (UPDATE_STATISTICS) spinMisses.increment(); tail = this.tail; } }</code><technical_language>I left this check executed one, checking instanceof force walking next node reading class word, while ref equality check nope</technical_language>

Target:
private int tryExecute(final Runnable runnable) { QNode tailNext; TaskNode tail = this.tail; TaskNode node = null; for (;;) { tailNext = tail.getNext(); if (tailNext == tail) { } else if (tailNext == null) { int tr = tryAllocateThread(growthResistance); if (tr == AT_YES) { return EXE_CREATE_THREAD; } if (tr == AT_SHUTDOWN) { return EXE_REJECT_SHUTDOWN; } assert tr == AT_NO; if (!NO_QUEUE_LIMIT && !increaseQueueSize()) { tr = tryAllocateThread(0.0f); if (tr == AT_YES) { return EXE_CREATE_THREAD; } if (tr == AT_SHUTDOWN) { return EXE_REJECT_SHUTDOWN; } assert tr == AT_NO; return EXE_REJECT_QUEUE_FULL; } if (node == null) { node = new TaskNode(runnable); } if (tail.compareAndSetNext(null, node)) { compareAndSetTail(tail, node); return EXE_OK; } if (!NO_QUEUE_LIMIT) decreaseQueueSize(); } else if (tailNext instanceof PoolThreadNode) { final QNode tailNextNext = tailNext.getNext(); if (tail.compareAndSetNext(tailNext, tailNextNext)) { assert tail instanceof TaskNode; PoolThreadNode consumerNode = (PoolThreadNode) tailNext; if (consumerNode.compareAndSetTask(WAITING, runnable)) { consumerNode.compareAndSetNext(tailNextNext, null); consumerNode.unpark(); return EXE_OK; } } } else if (tailNext instanceof TaskNode) { TaskNode tailNextTaskNode = (TaskNode) tailNext; if (compareAndSetTail(tail, tailNextTaskNode)) { tail = tailNextTaskNode; continue; } } else { assert tailNext instanceof TerminateWaiterNode; return EXE_REJECT_SHUTDOWN; } if (UPDATE_STATISTICS) spinMisses.increment(); tail = this.tail; } }