public function compare($priority1, $priority2)
    {
        if (!$priority1 instanceof EventQueuePriority || !$priority2 instanceof EventQueuePriority) {
            return parent::compare($priority1, $priority2);
        }

        $priority = $priority1->value - $priority2->value;
        if (!$priority) {
            $priority = $priority2->timestamp - $priority1->timestamp;
        }
        return $priority;
    }