It is better to set the system usage after the broker.setPersistent(false). In case one would change the order and the space is lower then the limit, another message will occur.
BrokerService broker = new BrokerService();
broker.addConnector(Constants.ACTIVEMQ_URL);
broker.setPersistent(false);
SystemUsage systemUsage = brokerService.getSystemUsage();
systemUsage.getStoreUsage().setLimit(1024 * 1024 * 8);
systemUsage.getTempUsage().setLimit(1024 * 1024 * 8);
broker.start();