Barney served in the Continental Navy beginning in February 1776, as master’s mate of Hornet where he took part in Commodore Esek Hopkins’s raid on New Providence. Later he served on the Wasp and was promoted to the rank of lieutenant for gallantry in the action between the Wasp and a British brig, the tender Betsey. While serving on Andrew Doria he took a prominent part in the defense of the Delaware River.
Barney was taken prisoner and exchanged several times. In 1779 he was again taken prisoner and imprisoned in Old Mill Prison, Plymouth, Devon, England until his escape in 1781. He wrote an account of this in The Memoirs of Commodore Barney, published in Boston, 1832.
===Battle of Delaware Bay===
In 1782, he was put in command of the Pennsylvania ship, Hyder Ally, in which in April he captured HMS General Monk, a warship that was much more heavily armed than the Hyder Ally. He was given command of the Monk and sailed for France with dispatches for Benjamin Franklin, returning with news that peace had been declared. After the Revolution Barney joined the French Navy, where he was made commander of a squadron.
==War of 1812==
===Chesapeake Bay Flotilla===
At the outbreak of the War of 1812, after a successful but unprofitable privateering cruise as commander of the Baltimore schooner Rossie, in which he captured the Post Office Packet Service packet ship Princess Amelia, Barney entered the US Navy as a captain, and commanded the Chesapeake Bay Flotilla, a fleet of gunboats defending Chesapeake Bay. He authored the plan to defend the Chesapeake, which was submitted to Secretary of the Navy, William Jones and accepted on August 20, 1813. The plan consisted of using a flotilla of shallow-draft barges, each equipped with a large gun which would be used in large numbers to attack and annoy the invading British, then retreating to the safety of shoal waters abundant in the Chesapeake region.
Source(s): http://en.wikipedia.org/wiki/Joshua_Barney