}
public Message[] browse(ActiveMQDestination destination) throws Exception {
List<Message> result = new ArrayList<Message>();
ArrayList<TimestampWrapper> copy = new ArrayList<TimestampWrapper>(buffer);
DestinationFilter filter = DestinationFilter.parseFilter(destination);
for (Iterator<TimestampWrapper> iter = copy.iterator(); iter.hasNext();) {
TimestampWrapper timestampWrapper = iter.next();
MessageReference ref = timestampWrapper.message;
Message message = ref.getMessage();
if (filter.matches(message.getDestination())) {
result.add(message);
}
}
return result.toArray(new Message[result.size()]);
}