Faced with a $118 million budget deficit, the city of San Jose, Calif., recently decided it could no longer afford its own janitors. So the city's budget called for dropping its custodial staff and hiring outside contractors to clean its city hall and airport, saving about $4 million.

To keep all its swimming pools open and staffed, the city is replacing some city workers with contractors.

"These...