// in a single response.
Integer bf = request.getBlockingFactor();
int blockingFactor = bf == null ? -1 : bf < 10 ? -1 : bf;
// The response container
GetResponse response = request.getResponse();
if (request.isRegisterForEvents()){
// The client wants events for the objects - we'll wind up adding a listener
// to the cache of the appropriate type.
CacheListener listener = null;
listener = new CacheIndexListener(cacheRegistration, this, request.getSliceInfo(), dci);
logger.trace("Registered cache index listener with ID: " + listener.getListenerID());
listeners.put(listener.getListenerID(), listener);
response.setListenerID(listener.getListenerID());
objects = listener.activateAndRetrieve();
}
else{
objects = cache.getIndex(dci);
}
if (objects.size() == 0){
response.setLastResponse(true);
response.setResponseText("No " + dci.name + " objects have been indexed.");
}
else{
if (request.isTrackingEnabled())
logger.trace(objects.size() + " objects to be sent");
for(DmwNamedObjectWrapper object: objects){
response.addObjectList(object);
if (response.getObjectListSize() == blockingFactor){
response.setLastResponse(false);
sendMessage(response);
response = request.getResponse();
}
}
}
response.setLastResponse(true);
sendMessage(response);
}
// logger.trace("Outside synch block");
}