private void dropRoutineCommon(Session session, TableName routineName, boolean inSystem) {
final AkibanInformationSchema oldAIS = getAISForChange(session, !inSystem);
checkSystemSchema(routineName, inSystem);
Routine routine = oldAIS.getRoutine(routineName);
if (routine == null)
throw new NoSuchRoutineException(routineName);
final AkibanInformationSchema newAIS = aisCloner.clone(oldAIS);
routine = newAIS.getRoutine(routineName);
newAIS.removeRoutine(routineName);
if (routine.getSQLJJar() != null)
routine.getSQLJJar().removeRoutine(routine); // Keep accurate in memory.