コード例 #1
0
ファイル: FastBlobStateEngine.java プロジェクト: kinzer1/zeno
  public void fillSerializationStatesFromDeserializedData() {
    for (NFTypeSerializer<?> serializer : getTopLevelSerializers()) {
      FastBlobTypeDeserializationState<?> state = getTypeDeserializationState(serializer.getName());

      state.fillSerializationState(this);
    }
  }
コード例 #2
0
ファイル: SortedMapSerializer.java プロジェクト: haolei/zeno
 @Override
 @SuppressWarnings("unchecked")
 public void doSerialize(SortedMap<K, V> map, NFSerializationRecord rec) {
   serializationFramework
       .getFrameworkSerializer()
       .serializeSortedMap(rec, "map", keySerializer.getName(), valueSerializer.getName(), map);
 }
コード例 #3
0
ファイル: FastBlobStateEngine.java プロジェクト: kinzer1/zeno
  /*
   * Copy serialization states whose serializer's name doesn't match the ones provided in the ignore collection
   */
  public void copyTo(
      FastBlobStateEngine otherStateEngine, Collection<String> topLevelSerializersToIgnore) {
    fillDeserializationStatesFromSerializedData();

    SimultaneousExecutor executor = new SimultaneousExecutor(4.0d);

    List<String> topLevelSerializersToCopy = new ArrayList<String>();
    for (NFTypeSerializer<?> serializer : getTopLevelSerializers()) {
      String serializerName = serializer.getName();
      if (!topLevelSerializersToIgnore.contains(serializerName)) {
        topLevelSerializersToCopy.add(serializer.getName());
      }
    }

    CountDownLatch latch =
        new CountDownLatch(executor.getMaximumPoolSize() * topLevelSerializersToCopy.size());

    for (String serializerizerName : topLevelSerializersToCopy) {
      executor.submit(
          getFillSerializationStateRunnable(otherStateEngine, serializerizerName, executor, latch));
    }

    try {
      latch.await();
    } catch (InterruptedException ie) {
      ie.printStackTrace();
    }
    executor.shutdown();
  }
コード例 #4
0
ファイル: FastBlobStateEngine.java プロジェクト: kinzer1/zeno
 private <T> void createSerializationState(NFTypeSerializer<T> serializer) {
   FastBlobTypeSerializationState<T> serializationState =
       new FastBlobTypeSerializationState<T>(
           serializer, numberOfConfigurations, shouldUseObjectIdentityOrdinalCaching);
   serializationTypeStates.put(serializer.getName(), serializationState);
   orderedSerializationStates.add(serializationState);
   deserializationTypeStates.put(
       serializer.getName(), new FastBlobTypeDeserializationState<T>(serializer));
 }
コード例 #5
0
  /**
   * Not intended for external consumption.
   *
   * <p>This method is only intended to be used during heap-friendly double snapshot refresh.
   */
  public void populateByteArrayOrdinalMap(ByteArrayOrdinalMap ordinalMap) {
    FastBlobSerializationRecord rec =
        new FastBlobSerializationRecord(serializer.getFastBlobSchema());
    ByteDataBuffer scratch = new ByteDataBuffer();

    for (int i = 0; i < objects.size(); i++) {
      T obj = objects.get(i);
      if (obj != null) {
        serializer.serialize(obj, rec);
        rec.writeDataTo(scratch);
        ordinalMap.put(scratch, i);
        scratch.reset();
        rec.reset();
      }
    }

    previousObjects = objects;
    objects = new ArrayList<T>(previousObjects.size());
  }
コード例 #6
0
ファイル: SortedMapSerializer.java プロジェクト: haolei/zeno
 @Override
 public void setSerializationFramework(final SerializationFramework framework) {
   this.serializationFramework = framework;
   keySerializer.setSerializationFramework(framework);
   valueSerializer.setSerializationFramework(framework);
 }
コード例 #7
0
 public void add(int ordinal, FastBlobDeserializationRecord rec) {
   T obj = serializer.deserialize(rec);
   ensureCapacity(ordinal + 1);
   objects.set(ordinal, obj);
 }
コード例 #8
0
 public FastBlobSchema getSchema() {
   return serializer.getFastBlobSchema();
 }