use of org.apache.asterix.common.transactions.ILogRecord in project asterixdb by apache.
the class ReplicationManager method addAckToJob.
/**
* When an ACK for a JOB_COMMIT is received, it is added to the corresponding job.
*
* @param jobId
* @param replicaId
* The remote replica id the ACK received from.
*/
private void addAckToJob(int jobId, String replicaId) {
synchronized (jobCommitAcks) {
//add ACK to the job
if (jobCommitAcks.containsKey(jobId)) {
Set<String> replicaIds = jobCommitAcks.get(jobId);
replicaIds.add(replicaId);
} else {
if (LOGGER.isLoggable(Level.WARNING)) {
LOGGER.warning("Invalid job replication ACK received for jobId(" + jobId + ")");
}
return;
}
if (jobCommitAcks.get(jobId).size() == replicationFactor && replicationJobsPendingAcks.containsKey(jobId)) {
ILogRecord pendingLog = replicationJobsPendingAcks.get(jobId);
synchronized (pendingLog) {
pendingLog.notifyAll();
}
}
}
}
Aggregations