@Nullable @Override public <Q, R> JobStatus<Q, R> getJobStatus(JobIdentifier<Q, R> jobId) { checkNotNull(jobId, "jobId"); Map<String, Object> result = _dataStore.get(getTableName(), jobId.toString(), ReadConsistency.STRONG); if (Intrinsic.isDeleted(result)) { return null; } Object status = result.get("status"); return narrow(status, jobId.getJobType()); }
@Nullable @Override public <Q, R> JobStatus<Q, R> getJobStatus(JobIdentifier<Q, R> jobId) { checkNotNull(jobId, "jobId"); Map<String, Object> result = _dataStore.get(getTableName(), jobId.toString(), ReadConsistency.STRONG); if (Intrinsic.isDeleted(result)) { return null; } Object status = result.get("status"); return narrow(status, jobId.getJobType()); }
@Override public String purgeTableAsync(String table, Audit audit) { checkNotNull(audit, "audit"); JobIdentifier<PurgeRequest, PurgeResult> jobId = _jobService.submitJob( new JobRequest<>(PurgeJob.INSTANCE, new PurgeRequest(table, audit))); return jobId.toString(); }
@Override public String purgeTableAsync(String table, Audit audit) { checkNotNull(audit, "audit"); JobIdentifier<PurgeRequest, PurgeResult> jobId = _jobService.submitJob( new JobRequest<>(PurgeJob.INSTANCE, new PurgeRequest(table, audit))); return jobId.toString(); }
@Override public <Q, R> JobIdentifier<Q, R> submitJob(JobRequest<Q, R> jobRequest) { checkNotNull(jobRequest, "jobRequest"); JobType<Q, R> jobType = jobRequest.getType(); // Ensure there is a handler for this job type RegistryEntry<?, ?> entry = _jobHandlerRegistry.getRegistryEntry(jobType.getName()); if (entry == null) { throw new IllegalArgumentException("Cannot handle job of type " + jobType); } // Create a unique job identifier JobIdentifier<Q, R> jobId = createNew(jobType); // Store the job status as "submitted" JobStatus<Q, R> jobStatus = new JobStatus<>(JobStatus.Status.SUBMITTED, jobRequest.getRequest(), null, null); _jobStatusDAO.updateJobStatus(jobId, jobStatus); // Queue the job _queueService.send(_queueName, jobId.toString()); return jobId; }
@Override public <Q, R> JobIdentifier<Q, R> submitJob(JobRequest<Q, R> jobRequest) { checkNotNull(jobRequest, "jobRequest"); JobType<Q, R> jobType = jobRequest.getType(); // Ensure there is a handler for this job type RegistryEntry<?, ?> entry = _jobHandlerRegistry.getRegistryEntry(jobType.getName()); if (entry == null) { throw new IllegalArgumentException("Cannot handle job of type " + jobType); } // Create a unique job identifier JobIdentifier<Q, R> jobId = createNew(jobType); // Store the job status as "submitted" JobStatus<Q, R> jobStatus = new JobStatus<>(JobStatus.Status.SUBMITTED, jobRequest.getRequest(), null, null); _jobStatusDAO.updateJobStatus(jobId, jobStatus); // Queue the job _queueService.send(_queueName, jobId.toString()); return jobId; }
@Override public String moveAsync(String from, String to) { checkLegalQueueName(from); checkLegalQueueName(to); JobIdentifier<MoveQueueRequest, MoveQueueResult> jobId = _jobService.submitJob(new JobRequest<>(_moveQueueJobType, new MoveQueueRequest(from, to))); return jobId.toString(); }
@Override public String moveAsync(String from, String to) { checkLegalQueueName(from); checkLegalQueueName(to); JobIdentifier<MoveQueueRequest, MoveQueueResult> jobId = _jobService.submitJob(new JobRequest<>(_moveQueueJobType, new MoveQueueRequest(from, to))); return jobId.toString(); }
@Override public String replayAsyncSince(String ownerId, String subscription, Date since) { checkLegalSubscriptionName(subscription); checkSubscriptionOwner(ownerId, subscription); JobIdentifier<ReplaySubscriptionRequest, ReplaySubscriptionResult> jobId = _jobService.submitJob( new JobRequest<>(ReplaySubscriptionJob.INSTANCE, new ReplaySubscriptionRequest(ownerId, subscription, since))); return jobId.toString(); }
@Override public String replayAsyncSince(String ownerId, String subscription, Date since) { checkLegalSubscriptionName(subscription); checkSubscriptionOwner(ownerId, subscription); JobIdentifier<ReplaySubscriptionRequest, ReplaySubscriptionResult> jobId = _jobService.submitJob( new JobRequest<>(ReplaySubscriptionJob.INSTANCE, new ReplaySubscriptionRequest(ownerId, subscription, since))); return jobId.toString(); }
private void write(JobIdentifier<?, ?> jobId, Delta delta, String comment) { _dataStore.update( getTableName(), jobId.toString(), TimeUUIDs.newUUID(), delta, new AuditBuilder().setLocalHost().setComment(comment).build(), WriteConsistency.STRONG ); } }
private void write(JobIdentifier<?, ?> jobId, Delta delta, String comment) { _dataStore.update( getTableName(), jobId.toString(), TimeUUIDs.newUUID(), delta, new AuditBuilder().setLocalHost().setComment(comment).build(), WriteConsistency.STRONG ); } }
@Override public String moveAsync(String ownerId, String from, String to) { checkLegalSubscriptionName(from); checkLegalSubscriptionName(to); checkSubscriptionOwner(ownerId, from); checkSubscriptionOwner(ownerId, to); JobIdentifier<MoveSubscriptionRequest, MoveSubscriptionResult> jobId = _jobService.submitJob(new JobRequest<>( MoveSubscriptionJob.INSTANCE, new MoveSubscriptionRequest(ownerId, from, to))); return jobId.toString(); }
@Override public String moveAsync(String ownerId, String from, String to) { checkLegalSubscriptionName(from); checkLegalSubscriptionName(to); checkSubscriptionOwner(ownerId, from); checkSubscriptionOwner(ownerId, to); JobIdentifier<MoveSubscriptionRequest, MoveSubscriptionResult> jobId = _jobService.submitJob(new JobRequest<>( MoveSubscriptionJob.INSTANCE, new MoveSubscriptionRequest(ownerId, from, to))); return jobId.toString(); }