return; try { if (!leftQ.isEmpty()) { R value =fn.apply(leftQ.poll(), (T2) e); if(status.compareAndSet(0,2) && leftQ.isEmpty()) { while (leftQ.isEmpty()) { // VALUE IS COMING if(leftComplete.get() && leftQ.isEmpty()){ handleComplete(completing,onCompleteDs); return; if( (leftComplete.get() && leftQ.isEmpty()) || (rightComplete.get() && rightQ.isEmpty())){ rightSub[0].cancel(); handleComplete(completing,onCompleteDs); if (!rightQ.isEmpty() ) { R value = fn.apply((T1) e, rightQ.poll()); if(status.compareAndSet(0,1) && rightQ.isEmpty()) { while(rightQ.isEmpty()){ // VALUE IS COMING if(rightComplete.get() && rightQ.isEmpty()){ handleComplete(completing,onCompleteDs); return; if( (rightComplete.get() && rightQ.isEmpty()) || (leftComplete.get() && leftQ.isEmpty())){ rightSub[0].cancel(); handleComplete(completing,onCompleteDs);
if (!rightQ.isEmpty() ) { R value = fn.apply((T1) e, rightQ.poll()); sub.requested.decrementAndGet(); if(status.compareAndSet(0,1) && rightQ.isEmpty()) { while(rightQ.isEmpty()){ // VALUE IS COMING - RIGHT IS ADDING TO Q if(rightComplete.get() && rightQ.isEmpty()){ handleComplete(completing,onComplete); return; if( (rightComplete.get() && rightQ.isEmpty()) || (leftComplete.get() && leftQ.isEmpty())){ leftSub[0].cancel(); handleComplete(completing,onComplete); return; try { if (!leftQ.isEmpty()) { R value =fn.apply(leftQ.poll(), (T2) e); if(status.compareAndSet(0,2) && leftQ.isEmpty()) { while (leftQ.isEmpty()) { // VALUE IS COMING - LEFT IS ADDING TO Q if(leftComplete.get() && leftQ.isEmpty()){ handleComplete(completing,onComplete); return; if( (leftComplete.get() && leftQ.isEmpty()) || (rightComplete.get() && rightQ.isEmpty())){ rightSub[0].cancel();
return; try { if (!leftQ.isEmpty()) { R value =fn.apply(leftQ.poll(), (T2) e); if(status.compareAndSet(0,2) && leftQ.isEmpty()) { while (leftQ.isEmpty()) { // VALUE IS COMING if(leftComplete.get() && leftQ.isEmpty()){ handleComplete(completing,onCompleteDs); return; if( (leftComplete.get() && leftQ.isEmpty()) || (rightComplete.get() && rightQ.isEmpty())){ rightSub[0].cancel(); handleComplete(completing,onCompleteDs); if (!rightQ.isEmpty() ) { R value = fn.apply((T1) e, rightQ.poll()); if(status.compareAndSet(0,1) && rightQ.isEmpty()) { while(rightQ.isEmpty()){ // VALUE IS COMING if(rightComplete.get() && rightQ.isEmpty()){ handleComplete(completing,onCompleteDs); return; if( (rightComplete.get() && rightQ.isEmpty()) || (leftComplete.get() && leftQ.isEmpty())){ rightSub[0].cancel(); handleComplete(completing,onCompleteDs);
return; try { if (!leftQ.isEmpty()) { R value =fn.apply(leftQ.poll(), (T2) e); if(status.compareAndSet(0,2) && leftQ.isEmpty()) { while (leftQ.isEmpty()) { // VALUE IS COMING if(leftComplete.get() && leftQ.isEmpty()){ handleComplete(completing,onCompleteDs); return; if( (leftComplete.get() && leftQ.isEmpty()) || (rightComplete.get() && rightQ.isEmpty())){ rightSub[0].cancel(); handleComplete(completing,onCompleteDs); if (!rightQ.isEmpty() ) { R value = fn.apply((T1) e, rightQ.poll()); if(status.compareAndSet(0,1) && rightQ.isEmpty()) { while(rightQ.isEmpty()){ // VALUE IS COMING if(rightComplete.get() && rightQ.isEmpty()){ handleComplete(completing,onCompleteDs); return; if( (rightComplete.get() && rightQ.isEmpty()) || (leftComplete.get() && leftQ.isEmpty())){ rightSub[0].cancel(); handleComplete(completing,onCompleteDs);
if (!rightQ.isEmpty() ) { R value = fn.apply((T1) e, rightQ.poll()); sub.requested.decrementAndGet(); if(status.compareAndSet(0,1) && rightQ.isEmpty()) { while(rightQ.isEmpty()){ // VALUE IS COMING - RIGHT IS ADDING TO Q if(rightComplete.get() && rightQ.isEmpty()){ handleComplete(completing,onComplete); return; if( (rightComplete.get() && rightQ.isEmpty()) || (leftComplete.get() && leftQ.isEmpty())){ leftSub[0].cancel(); handleComplete(completing,onComplete); return; try { if (!leftQ.isEmpty()) { R value =fn.apply(leftQ.poll(), (T2) e); if(status.compareAndSet(0,2) && leftQ.isEmpty()) { while (leftQ.isEmpty()) { // VALUE IS COMING - LEFT IS ADDING TO Q if(leftComplete.get() && leftQ.isEmpty()){ handleComplete(completing,onComplete); return; if( (leftComplete.get() && leftQ.isEmpty()) || (rightComplete.get() && rightQ.isEmpty())){ rightSub[0].cancel();
if (!rightQ.isEmpty() ) { R value = fn.apply((T1) e, rightQ.poll()); sub.requested.decrementAndGet(); if(status.compareAndSet(0,1) && rightQ.isEmpty()) { while(rightQ.isEmpty()){ // VALUE IS COMING - RIGHT IS ADDING TO Q if(rightComplete.get() && rightQ.isEmpty()){ handleComplete(completing,onComplete); return; if( (rightComplete.get() && rightQ.isEmpty()) || (leftComplete.get() && leftQ.isEmpty())){ leftSub[0].cancel(); handleComplete(completing,onComplete); return; try { if (!leftQ.isEmpty()) { R value =fn.apply(leftQ.poll(), (T2) e); if(status.compareAndSet(0,2) && leftQ.isEmpty()) { while (leftQ.isEmpty()) { // VALUE IS COMING - LEFT IS ADDING TO Q if(leftComplete.get() && leftQ.isEmpty()){ handleComplete(completing,onComplete); return; if( (leftComplete.get() && leftQ.isEmpty()) || (rightComplete.get() && rightQ.isEmpty())){ rightSub[0].cancel();