This is one of my favourite shoulder exercises. With an irritable shoulder, a common complaint is that rehabilitation exercises can cause the pain to flare up; I find that this sort of simple isometric hold is often a good way to settle the pain quickly.
(This is generally a very safe exercise, but please listen to your body. A little mild discomfort while doing it is normal, but you should ease up or stop if it becomes painful. This is not a substitute for professional advice - if you have a shoulder problem, then you should get it assessed properly!)