A man is in custody after a shooting at a supermarket in a predominantly black neighbourhood in New York state that has left at least 10 people dead.