/** * Writes to a stream the number of entries (long) then the entries themselves. */ @Override public void toStream(ObjectOutput out) throws CacheLoaderException { try { Set<InternalCacheEntry> loadAll = loadAll(); log.debug("toStream() entries"); int count = 0; for (InternalCacheEntry entry : loadAll) { getMarshaller().objectToObjectStream(entry, out); count++; } getMarshaller().objectToObjectStream(null, out); log.debugf("wrote %d entries", count); } catch (IOException e) { throw new CacheLoaderException(e); } }