public int drainTo(Collection<? super E> objects) {
return drainTo(objects, -1);
}
public int drainTo(Collection<? super E> c, int maxElements) {
DrainRequest request = new DrainRequest(name, maxElements);
PortableCollection result = invoke(request);
Collection<Data> coll = result.getCollection();
for (Data data : coll) {
E e = (E) getContext().getSerializationService().toObject(data);
c.add(e);