}
@Produces
@JmsSessionSelector
public Session getSelectedSession(InjectionPoint ip, Connection c) throws JMSException {
JmsSessionSelector s = null;
Iterator<Annotation> qualifiers = ip.getQualifiers().iterator();
while (qualifiers.hasNext()) {
Annotation qualifier = qualifiers.next();
if (JmsSessionSelector.class.isAssignableFrom(qualifier.getClass())) {
s = (JmsSessionSelector) qualifier;
break;
}
}
if (s == null) {
throw new IllegalArgumentException("Injection point " + ip + " does not have @" + JmsSessionSelector.class.getSimpleName() + " qualifier");
}
return c.createSession(s.transacted(), s.acknowledgementMode());
}