Exemplo n.º 1
0
  /*
   * 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();
  }
Exemplo n.º 2
0
 private void fillSerializationState(
     FastBlobStateEngine otherStateEngine,
     String serializerName,
     final SimultaneousExecutor executor,
     CountDownLatch latch) {
   int threadsSize = executor.getMaximumPoolSize();
   for (int i = 0; i < threadsSize; i++) {
     executor.submit(
         getFillSerializationStatesRunnable(
             otherStateEngine, serializerName, threadsSize, latch, i));
   }
 }