Queue size limit

Is it possible to limit the size of the queue or at least check the size of the queue before queue-ing new jobs?