Continue to start sync after we have journaled the operation.

@param uri the sync point that we are trying to start
487331
public void startSyncPostJournal(AlluxioURI uri) throws InvalidPathException {
    MountTable.Resolution resolution = mMountTable.resolve(uri);
    startInitSync(uri, resolution);
    launchPollingThread(resolution.getMountId(), SyncInfo.INVALID_TXID);
  }
683042
public void start() throws IOException {
    // Initialize UFS states
    for (AlluxioURI syncPoint : mSyncPathList) {

      MountTable.Resolution resolution = null;
      long mountId = 0;
      try {
        resolution = mMountTable.resolve(syncPoint);
        mountId = resolution.getMountId();
      } catch (InvalidPathException e) {
        LOG.info("Invalid Path encountered during start up of ActiveSyncManager, "
            + "path {}, exception {}", syncPoint, e);
        continue;
      }

      try (CloseableResource<UnderFileSystem> ufsResource = resolution.acquireUfsResource()) {
        if (!ufsResource.get().supportsActiveSync()) {
          throw new UnsupportedOperationException("Active Sync is not supported on this UFS type: "
              + ufsResource.get().getUnderFSType());
        }
        ufsResource.get().startSync(resolution.getUri());
      }
    }
    // attempt to restart from a past txid, if this fails, it will result in MissingEventException
    // therefore forces a sync
    for (long mountId: mFilterMap.keySet()) {
      long txId = mStartingTxIdMap.getOrDefault(mountId, SyncInfo.INVALID_TXID);
      launchPollingThread(mountId, txId);

      try {
        if ((txId == SyncInfo.INVALID_TXID)
            && ServerConfiguration.getBoolean(PropertyKey.MASTER_ACTIVE_UFS_SYNC_INITIAL_SYNC)) {
          mExecutorService.submit(
              () -> mFilterMap.get(mountId).parallelStream().forEach(
                  syncPoint -> {
                    try {
                      RetryUtils.retry("active sync during start",
                          () -> mFileSystemMaster.activeSyncMetadata(syncPoint,
                              null, getExecutor()),
                          RetryUtils.defaultActiveSyncClientRetry(ServerConfiguration
                              .getMs(PropertyKey.MASTER_ACTIVE_UFS_POLL_TIMEOUT)));
                    } catch (IOException e) {
                      LOG.warn("IOException encountered during active sync while starting {}", e);
                    }
                  }
          ));
        }
      } catch (Exception e) {
        LOG.warn("exception encountered during initial sync {}", e);
      }
    }
  }
18416
public void sync() {

        if (isClosed) {
            return;
        }

        synchronized (fileStreamOut) {
            if (needsSync) {
                if (busyWriting) {
                    forceSync = true;

                    return;
                }

                try {
                    fileStreamOut.flush();
                    outDescriptor.sync();

                    syncCount++;
                } catch (IOException e) {
                    Error.printSystemOut("flush() or sync() error: "
                                         + e.toString());
                }

                needsSync = false;
                forceSync = false;
            }
        }
    }
1370675
void start( ScheduledExecutorService service ) {
        if (rollupFuture.get() != null) {
            // already started ...
            return;
        }

        // Pre-populate the metrics (overwriting any existing history object) ...
        durations.put(DurationMetric.QUERY_EXECUTION_TIME, new DurationHistory(TimeUnit.MILLISECONDS,
                                                                               MAXIMUM_LONG_RUNNING_QUERY_COUNT));
        durations.put(DurationMetric.SEQUENCER_EXECUTION_TIME, new DurationHistory(TimeUnit.MILLISECONDS,
                                                                                   MAXIMUM_LONG_RUNNING_SEQUENCING_COUNT));
        durations.put(DurationMetric.SESSION_LIFETIME, new DurationHistory(TimeUnit.MILLISECONDS,
                                                                           MAXIMUM_LONG_RUNNING_SESSION_COUNT));

        for (ValueMetric metric : EnumSet.allOf(ValueMetric.class)) {
            boolean resetUponRollup = !metric.isContinuous();
            values.put(metric, new ValueHistory(resetUponRollup));
        }

        // Initialize the start times in a threadsafe manner ...
        DateTime now = timeFactory.create();
        this.weeksStartTime.compareAndSet(null, now);
        this.daysStartTime.compareAndSet(null, now);
        this.hoursStartTime.compareAndSet(null, now);
        this.minutesStartTime.compareAndSet(null, now);
        this.secondsStartTime.compareAndSet(null, now);
        rollup();

        // Then schedule the rollup to be done at a fixed rate ...
        this.rollupFuture.set(service.scheduleAtFixedRate(new Runnable() {
            @SuppressWarnings( "synthetic-access" )
            @Override
            public void run() {
                rollup();
            }
        }, CAPTURE_DELAY_IN_SECONDS, CAPTURE_INTERVAL_IN_SECONDS, TimeUnit.SECONDS));
    }
321512
public void run() {
        AbstractKVStorable[] linkData = bucket.getBackend(); // get all LinkData

        long startTime = System.nanoTime(); // remember the, time when synchronizing is started (for logging)

        log.debug("Start to synchronize {} objects.", linkData.length);
        try {
            String filename = buffer.bucketContainer.getHashFunction().getFilename(bucket.getBucketId());
            String directoryName = buffer.getPathToDbFiles();
            Synchronizer<Data> synchronizer = synchronizerFactory
                    .createSynchronizer(directoryName + "/" + filename, gp);
            synchronizer.upsert(linkData); // start synchronizing

            actualProcessingBuckets.remove(bucket);
            freeMemory(bucket);
            synchronizer.close();
            log.debug("Synchronized {} objects in {} ms.", linkData.length, ((System.nanoTime() - startTime) / 1e6));
            /* update messages */
            buffer.sumUpInserted(synchronizer.getNumberOfInsertedEntries());
            buffer.sumUpUpdated(synchronizer.getNumberOfUpdatedEntries());
        } catch (Exception ex) {
            log.error("An error occurred during synchronizing. Synchronizing thread stopped! Some data was lost", ex);
            freeMemory(bucket);
            actualProcessingBuckets.remove(bucket);

        }
    }
126322
public void undeploy(URI uri) {
        synchronized (deployments) {
            DeploymentManager deploymentManager = deployments.remove(uri);
            if (deploymentManager != null) {
                try {
                    undeploy(deploymentManager);
                } catch (IllegalStateException e) {
                    CamelLogger.LOGGER.warn("Could not undeploy endpoint "
                            + deploymentManager.getDeployment().getDeploymentInfo().getDeploymentName(), e);
                }
            }
        }
    }
423213
public AudioWife init(Context ctx, Uri uri) {

		if (uri == null) {
			throw new IllegalArgumentException("Uri cannot be null");
		}

		if (mAudioWife == null) {
			mAudioWife = new AudioWife();
		}

		mUri = uri;

		mProgressUpdateHandler = new Handler();

		initPlayer(ctx);

		return this;
	}
810876
public void startSynchronization() throws IOException, ServiceException,
            AuthenticationException, NotFoundException, RedmineException, ParseException {

        // retrieve new issues
        final List<EditableAcraReport> listReports = retrieveUnsyncedElements();

        // update Chiliproject
        for (final EditableAcraReport report : listReports) {

            final Issue issue = getIssueForStack(report.getStacktraceMD5());

            try {
                if (null == issue) {
                    LOGGER.debug("Got a new bugreport: reportId={}", report.getId());
                    for (final AcraReportHandler handler : reportHandlers) {
                        handler.onNewReport(report);
                    }
                } else if (ChiliprojectUtils.isSynchronized(report, issue)) {
                    LOGGER.debug("Got a bugreport already synchronized: reportId={}",
                            report.getId());
                    for (final AcraReportHandler handler : reportHandlers) {
                        handler.onKnownIssueAlreadySynchronized(report, issue);
                    }
                } else {
                    LOGGER.debug(
                            "Got a new bugreport with a stacktrace similar to an existing ticket: reportId={}",
                            report.getId());
                    for (final AcraReportHandler handler : reportHandlers) {
                        handler.onKnownIssueNotSynchronized(report, issue);
                    }
                }
            } catch (final SynchronizationException e) {
                report.mergeSyncStatus(SyncStatus.FAILURE);
                LOGGER.error("Unable to synchronize ACRA report " + report.getId(), e);
            }
        }

        try {
            for (final AcraReportHandler handler : reportHandlers) {
                handler.onFinishReceivingNewReports();
            }
        } catch (final SynchronizationException e) {
            for (final EditableAcraReport report : listReports) {
                report.mergeSyncStatus(SyncStatus.FAILURE);
            }
            LOGGER.error("Unable to finalize ACRA report synchronization");
        }

        // update/set stack_trace_md5 cells
        for (final EditableAcraReport report : listReports) {
            if (SyncStatus.SUCCESS.equals(report.getStatus())) {
                report.commitStacktraceMD5();
            }
        }
    }
811472
public ConnectionOptions withUri(URI uri)
    throws URISyntaxException, NoSuchAlgorithmException, KeyManagementException
  {
     factory.setUri(Assert.notNull(uri, "URI"));
     return this;
  }
124536
private boolean waitForFileCompleted(AlluxioURI uri) {
    try {
      CommonUtils.waitFor("file completed", () -> {
        try {
          return mFileSystem.getStatus(uri).isCompleted();
        } catch (Exception e) {
          throw new RuntimeException(e);
        }
      }, WaitForOptions.defaults().setTimeoutMs(MAX_OPEN_WAITTIME_MS));
      return true;
    } catch (InterruptedException ie) {
      Thread.currentThread().interrupt();
      return false;
    } catch (TimeoutException te) {
      return false;
    }
  }
705579
public void proxyTo(final URI uri) {
		if(uri == null) {
			throw new NullPointerException("URI can't be null");
		}
		if(!JainSipUtils.checkScheme(uri.toString())) {
			// Fix for Issue http://code.google.com/p/mobicents/issues/detail?id=2327, checking the route header
			RouteHeader routeHeader = (RouteHeader) originalRequest.getMessage().getHeader(RouteHeader.NAME);
			if(routeHeader == null || (routeHeader != null && !JainSipUtils.checkScheme(routeHeader.getAddress().getURI().toString()))) {
				throw new IllegalArgumentException("Scheme " + uri.getScheme() + " is not supported");
			}			
		}
		final ProxyBranchImpl branch = new ProxyBranchImpl(uri, this);
		branch.setRecordRoute(recordRoutingEnabled);
		branch.setRecurse(recurse);
		this.proxyBranches.put(uri, branch);
		startProxy();

	}
1273751
public void commit( SynchronizationBarrier barrier ) throws JournalException
    {
    	// Refuse any further operation in case of previous failure
    	if (failing)
    		throw new JournalException("Store journal is failing");
    	
    	// Register as a barrier participant
    	if (barrier != null)
    		barrier.addParty();
        
        boolean newFlushRequired;
        synchronized (journalWriteQueue)
        {
        	writeCommit(barrier);
        	
        	newFlushRequired = !flushingJournal;
        	if (newFlushRequired)
        		flushingJournal = true;
        	unflushedJournalSize = 0;
        }
        
        if (newFlushRequired)
        {
	        // Flush journal to store (asynchronous)
	        try
	        {
	        	asyncTaskManager.execute(flushJournalAsyncTask);
	        }
	    	catch (JMSException e)
	    	{
	    		throw new JournalException("Cannot flush journal asynchronously : "+e);
	    	}
        }
    }
309885
public void sync() throws ClosedJournalException, IOException {
        try {
            appender.sync().get();
            if (appender.getAsyncException() != null) {
                throw new IOException(appender.getAsyncException());
            }
        } catch (Exception ex) {
            throw new IllegalStateException(ex.getMessage(), ex);
        }
    }
449246
void beginSynchronizing() throws IOException {
    // Synchronization is performed in other threads.
    Zxid lastZxid = persistence.getLatestZxid();
    ClusterConfiguration clusterConfig = persistence.getLastSeenConfig();
    long proposedEpoch = persistence.getProposedEpoch();
    for (PeerHandler ph : this.quorumMap.values()) {
      ph.setSyncTask(new SyncPeerTask(ph.getServerId(), ph.getLastZxid(),
                                      lastZxid, clusterConfig),
                     proposedEpoch);
      ph.startSynchronizingTask();
    }
  }
146220
public void stopSyncInternal(AlluxioURI syncPoint, MountTable.Resolution resolution) {
    try (LockResource r = new LockResource(mSyncManagerLock)) {
      LOG.debug("stop syncPoint {}", syncPoint.getPath());
      RemoveSyncPointEntry removeSyncPoint = File.RemoveSyncPointEntry.newBuilder()
          .setSyncpointPath(syncPoint.toString())
          .setMountId(resolution.getMountId())
          .build();
      apply(removeSyncPoint);
      try {
        stopSyncPostJournal(syncPoint);
      } catch (Throwable e) {
        // revert state;
        AddSyncPointEntry addSyncPoint =
            File.AddSyncPointEntry.newBuilder()
                .setSyncpointPath(syncPoint.toString()).build();
        apply(addSyncPoint);
        recoverFromStopSync(syncPoint, resolution.getMountId());
      }
    }
  }
756002
public void asyncOperationStarted() {
    if (syncThread == Thread.currentThread()) {
      synchronized (entry) {
        while (entry.isProcessing()) {
          try {
            entry.wait();
          } catch (InterruptedException ex) {
            Thread.currentThread().interrupt();
          }
        }
      }
    } else {
      entryLocked = false;
    }
  }
365964
public void sync() {
		if (!validState) {
			throw new InvalidStateException();
		}
		if (useMmap) {
			syncAllMmaps();
		}
		if (fileChannel != null) {
			try {
				fileChannel.force(false);
			} catch (Exception ign) {
			}
		}
		if (callback != null) {
			callback.synched();
		}
	}