final FeatureReader<SimpleFeatureType, SimpleFeature> reader;
if (Filter.EXCLUDE.equals(filter)) {
reader = new EmptyFeatureReader<SimpleFeatureType, SimpleFeature>(featureType);
} else {
final Query query = new Query(typeName, filter);
final ISession nonDisposableSession = new SessionWrapper(session) {
@Override
public void dispose() throws IllegalStateException {
// do nothing, we don't want the reader to close the session
}
};