McDonnell, from Lough Conn Road, Ballyfermot, has 74 previous convictions including a four-year sentence for hijacking a car.
He had also been associating with a mob who terrorised suburbs in west Dublin throughout last year.
The gang are suspected of being involved in dealing crack cocaine and crystal meth and are linked to a string of extremely violent incidents.
One of McDonnell's closest associates is the chief suspect for the stab murder of Kevin Kenny (32) who was knifed to death outside a Ballyfermot pub in August, 2011.
It is understood, however, that McDonnell was locked up when Mr Kenny was murdered.
McDonnell has been in custody since late January and sources say that the violent offender has been causing "major headaches" for prison authorities.
"The problem with him is that he is very disruptive -- he has had to be moved from cell to cell because of the general bad influence he exerts on other inmates," said a jail source.
Sources revealed that there has been a big fall in crimes in the Ballyfermot area since McDonnell was locked up.
"Thankfully a number of his closest associates are also locked up at the moment so things are much calmer. This was a crew that almost came out of nowhere last year -- they went from zero to a 100 very fast in terms of criminality," explained a local source.
On Monday, McDonnell pleaded guilty to possession of an imitation firearm with intent to commit robbery at Sarsfield Service Station, Ballyfermot, on January 21, 2012.
He also pleaded guilty to robbery of cigarettes and a sunglasses case and to robbery of Tadas Urbanavicius, the shop assistant, on the same occasion.
Judge Martin Nolan imposed a six year sentence but suspended the last three years for three years.
Detective Garda Ronan Coffey told the court that McDonnell and two other men were filmed on garda CCTV cameras pulling into the service station and going into the shop.
He said that one man pulled out a knife and jumped over the counter. McDonnell pulled out what staff thought was a real handgun and demanded to know where the safe was.
At one stage McDonnell struck the shop assistant, Mr Urbanavicius, to the back of the head with the butt of the gun.
The raiders were told the safe was on a time lock and tried to dislodge it but failed.
They then took Mr Urbanavicius's phone and his wallet containing €300 in cash.
McDonnell struck him again to his left eye. As they left the man with the knife grabbed two bottles of wine.
Detective Coffey told the court that a witness who was standing in the forecourt tried to film the robbers as they left.
McDonnell pointed the replica gun at the man.
Paul Greene, defending, said his client had a "difficult and chaotic upbringing" and started drinking "with the wrong crowd" at the age of 14.
Judge Nolan said that this was a thoroughly violent crime but said he also had to consider McDonnell's plea of guilty and his difficult background.
On imposing his sentence he said that the court always held out hope for rehabilitation for someone so young. He backdated the sentence to January 23 last when McDonnell when into custody for these offences.