* @param stateOrdinalMappers
*/
void copySerializedObjectData(final FastBlobTypeSerializationState<?> destState, final ThreadSafeBitSet imageMemberships[],
final OrdinalMapping ordinalMapping) {
final StateOrdinalMapping stateOrdinalMapping = ordinalMapping.createStateOrdinalMapping(destState.getName(), maxOrdinal());
SimultaneousExecutor executor = new SimultaneousExecutor(8);
final int numThreads = executor.getMaximumPoolSize();
for(int i=0;i<numThreads;i++) {
final int threadNumber = i;
executor.submit( new Runnable() {
@Override
public void run() {
final ByteDataBuffer mappedBuffer = new ByteDataBuffer();
final FastBlobDeserializationRecord rec = new FastBlobDeserializationRecord(destState.getSchema(), byteData.getUnderlyingArray());
final boolean imageMembershipsFlags[] = new boolean[imageMemberships.length];
final OrdinalRemapper remapper = new OrdinalRemapper(ordinalMapping);
for(int j = threadNumber;j < pointersAndOrdinals.length();j += numThreads) {
long pointerAndOrdinal = pointersAndOrdinals.get(j);
if(pointerAndOrdinal != EMPTY_BUCKET_VALUE) {
long pointer = pointerAndOrdinal & 0xFFFFFFFFFL;
int ordinal = (int)(pointerAndOrdinal >> 36);
for(int imageIndex=0;imageIndex<imageMemberships.length;imageIndex++) {
imageMembershipsFlags[imageIndex] = imageMemberships[imageIndex].get(ordinal);
}
int sizeOfData = VarInt.readVInt(byteData.getUnderlyingArray(), pointer);
pointer += VarInt.sizeOfVInt(sizeOfData);
rec.position(pointer);
remapper.remapOrdinals(rec, mappedBuffer);
int newOrdinal = destState.addData(mappedBuffer, FastBlobImageUtils.toLong(imageMembershipsFlags));
stateOrdinalMapping.setMappedOrdinal(ordinal, newOrdinal);
mappedBuffer.reset();
}
}
}