Beispiel #1
0
  private void copyObjects(
      final FastBlobStateEngine otherStateEngine,
      final String serializerName,
      final int numThreads,
      final int threadNumber) {
    FastBlobTypeDeserializationState<?> typeDeserializationState =
        getTypeDeserializationState(serializerName);
    int maxOrdinal = typeDeserializationState.maxOrdinal() + 1;
    if (maxOrdinal < threadNumber) {
      return;
    }

    FastBlobTypeSerializationState<?> typeSerializationState =
        getTypeSerializationState(serializerName);
    boolean imageMembershipsFlags[] = new boolean[numberOfConfigurations];

    for (int i = threadNumber; i < maxOrdinal; i += numThreads) {
      Object obj = typeDeserializationState.get(i);
      if (obj != null) {
        for (int imageIndex = 0; imageIndex < numberOfConfigurations; imageIndex++) {
          imageMembershipsFlags[imageIndex] =
              typeSerializationState.getImageMembershipBitSet(imageIndex).get(i);
        }
        otherStateEngine.add(
            typeSerializationState.getSchema().getName(),
            obj,
            FastBlobImageUtils.toLong(imageMembershipsFlags));
      }
    }
  }
Beispiel #2
0
 /**
  * Copy only the specified serialization states, in the specified order, into the provided State
  * Engine.
  *
  * <p>For those types which are referenced by the specified serializers, but not combined in this
  * operation, use the provided OrdinalMapping.
  *
  * <p>The provided ordinal mapping will be updated with the new mappings created by this operation
  *
  * <p>This is used during FastBlobStateEngine combination, for those types which reference states
  * that must be combined using business logic (instead of a pass-through copy).
  *
  * <p>
  *
  * @param otherStateEngine
  * @param whichSerializers
  * @param ordinalMapping
  */
 public void copySpecificSerializationStatesTo(
     FastBlobStateEngine otherStateEngine,
     List<String> whichSerializers,
     OrdinalMapping ordinalMapping) {
   for (String serializerName : whichSerializers) {
     FastBlobTypeSerializationState<?> serializationState =
         getTypeSerializationState(serializerName);
     serializationState.copyTo(
         otherStateEngine.getTypeSerializationState(serializerName), ordinalMapping);
   }
 }
Beispiel #3
0
 /**
  * Copy all serialization states (except those specified) into the provided State Engine.
  *
  * <p>This is used during FastBlobStateEngine combination.
  *
  * <p>The "ignoreSerializers" parameter is used for types which must be combined using business
  * logic, instead of a pass-through copy
  *
  * <p>Thread safety: This cannot be safely called concurrently with add() operations to *this*
  * state engine.
  *
  * <p>
  *
  * @param otherStateEngine
  * @param ignoreSerializers
  * @return the OrdinalMapping between this FastBlobStateEngine and the state engine to which this
  *     was copied.
  */
 public OrdinalMapping copySerializationStatesTo(
     FastBlobStateEngine otherStateEngine, Collection<String> ignoreSerializers) {
   OrdinalMapping ordinalMapping = new OrdinalMapping();
   for (FastBlobTypeSerializationState<?> serializationState : getOrderedSerializationStates()) {
     String serializerName = serializationState.serializer.getName();
     if (!ignoreSerializers.contains(serializerName)) {
       serializationState.copyTo(
           otherStateEngine.getTypeSerializationState(serializerName), ordinalMapping);
     }
   }
   return ordinalMapping;
 }