(a) If it appears to the judge from the petition for the writ or otherwise, that a petitioner, confined as a result of sentence for a criminal offense or judgment in a juvenile proceeding has previously been given a hearing on a prior petition for release from confinement under the same commitment, it is discretionary with the judge whether or not to issue the writ.
(b) In exercising his discretion the judge may consider whether new grounds of a substantial nature appear to exist for granting of the writ or whether the grounds for the issuance of any former writ were fully and adequately presented.