// Unless a template is explicitly set, we get messages matching the ontology, the served performatives.
if (template == null) {
if (servedPerformatives != null) {
template = MessageTemplate.and(
MessageTemplate.MatchOntology(onto.getName()),
new MessageTemplate(new MatchExpression() {
public boolean match(ACLMessage msg) {
int perf = msg.getPerformative();
for (int p : servedPerformatives) {
if (p == perf) {
return true;