An officer of a court of record, appointed or elected pursuant to law, is privileged from arrest, during the actual sitting, which he is required to attend, of a term of the court of which he is an officer, and no longer; but an attorney or counselor is not thus privileged, unless he is employed in a cause, to be heard at that term.