Backport HORNETQ-431

UpStream JIRA: https://issues.jboss.org/browse/HORNETQ-431
UpStream PR: https://github.com/hornetq/hornetq/pull/1317