@Override protected Object retrieve(Context context) { Collection<Reference<?>> references = context.getReferences(getTargetInterfaceName(), filter); if (references == null || references.isEmpty()) { return null; } if (references.size() > 1) { throw new IllegalStateException( this + " mapped to " + references.size() + " instances: " + references); } reference = references.iterator().next(); return reference.getService(); }
@Override protected void wasDisposed() { reference.unget(); }