"Troy wandered along towards the south. A composite feeling, made up of disgust with the, to him, humdrum tediousness of a farmer's life, gloomy images of her who lay in the churchyard, remorse, and a general averseness to his wife's society, impelled him to seek a home in any place on earth save Weatherbury."
Climbing a hill, he saw the sea. There was a small pool enclosed by the cliffs, and Troy was drawn to it for refreshment. He undressed and swam out between two projecting spires of rock, not knowing of a strong current there. He was carried out to sea and at that moment remembered hearing of danger in this area. He tried to direct his strokes toward shore but failed because of fatigue. Then a ship's boat appeared. Troy's vigor revived, and he hailed it and was rescued. The sailors were part of a brig's crew, coming ashore for sand. They lent him clothes and took him to their vessel.
Seeking solitude seems appropriate for Troy at this time. That a boat should appear at the moment when he is drowning is the author's manipulation of the plot, but the action moves so swiftly that the reader is not inclined to pause and meditate on the amount of coincidence Hardy utilizes.