@Override
    public int compare(final Runnable r1, final Runnable r2) {
        int res = 0;

        final JRebirthRunnable jrr1 = (JRebirthRunnable) r1;
        final JRebirthRunnable jrr2 = (JRebirthRunnable) r2;

        if (jrr1 == null) {
            res = jrr2 == null ? 0 : 1;
        } else if (jrr2 == null) {
            res = -1;
        } else if (jrr1.priority().level() == jrr2.priority().level()) {
            // Compare creation time
            res = jrr1.creationTime().compareTo(jrr2.creationTime());
        } else {
            res = ((Integer) jrr1.priority().level()).compareTo(jrr2.priority().level()) * -1;
        }
        return res;
    }
@ Override public int compare ( final Runnable r1 , final Runnable r2 ) { int res = 0 ; final JRebirthRunnable jrr1 = ( JRebirthRunnable ) r1 ; final JRebirthRunnable jrr2 = ( JRebirthRunnable ) r2 ; if ( jrr1 == null ) { res = jrr2 == null ? 0 : 1 ; } else if ( jrr2 == null ) { res = - 1 ; } else if ( jrr1 . priority ( ) . level ( ) == jrr2 . priority ( ) . level ( ) ) { res = jrr1 . creationTime ( ) . compareTo ( jrr2 . creationTime ( ) ) ; } else { res = ( ( Integer ) jrr1 . priority ( ) . level ( ) ) . compareTo ( jrr2 . priority ( ) . level ( ) ) * - 1 ; } return res ; }
{@inheritDoc}