use of com.palantir.lock.client.TimeLockClient in project atlasdb by palantir.
the class TransactionManagers method createLockAndTimestampServicesForCli.
/**
* This method should not be used directly. It remains here to support the AtlasDB-Dagger module and the CLIs, but
* may be removed at some point in the future.
*
* @deprecated Not intended for public use outside of the AtlasDB CLIs
*/
@Deprecated
public static LockAndTimestampServices createLockAndTimestampServicesForCli(MetricsManager metricsManager, AtlasDbConfig config, Refreshable<AtlasDbRuntimeConfig> runtimeConfigSupplier, Consumer<Object> env, Supplier<LockService> lock, Supplier<ManagedTimestampService> time, TimestampStoreInvalidator invalidator, String userAgent) {
LockAndTimestampServices lockAndTimestampServices = DefaultLockAndTimestampServiceFactory.createRawInstrumentedServices(metricsManager, config, runtimeConfigSupplier, env, lock, time, invalidator, UserAgents.tryParse(userAgent), Optional.empty(), newMinimalDialogueFactory(), Optional.empty(), Optional.empty(), ImmutableSet.of());
TimeLockClient timeLockClient = TimeLockClient.withSynchronousUnlocker(lockAndTimestampServices.timelock());
return ImmutableLockAndTimestampServices.builder().from(lockAndTimestampServices).timelock(timeLockClient).lock(LockRefreshingLockService.create(lockAndTimestampServices.lock())).addResources(timeLockClient::close).build();
}
use of com.palantir.lock.client.TimeLockClient in project atlasdb by palantir.
the class DefaultLockAndTimestampServiceFactory method withRefreshingLockService.
private static LockAndTimestampServices withRefreshingLockService(LockAndTimestampServices lockAndTimestampServices) {
TimeLockClient timeLockClient = TimeLockClient.createDefault(lockAndTimestampServices.timelock());
ProfilingTimelockService profilingService = ProfilingTimelockService.create(timeLockClient);
return ImmutableLockAndTimestampServices.builder().from(lockAndTimestampServices).timestamp(new TimelockTimestampServiceAdapter(profilingService)).timelock(profilingService).lock(LockRefreshingLockService.create(lockAndTimestampServices.lock())).addResources(timeLockClient::close).addResources(profilingService::close).build();
}
use of com.palantir.lock.client.TimeLockClient in project atlasdb by palantir.
the class DefaultLockAndTimestampServiceFactory method getLockAndTimestampServices.
private static LockAndTimestampServices getLockAndTimestampServices(MetricsManager metricsManager, Refreshable<ServerListConfig> timelockServerListConfig, UserAgent userAgent, String timelockNamespace, Optional<LockDiagnosticComponents> lockDiagnosticComponents, ReloadingFactory reloadingFactory, Optional<TimeLockFeedbackBackgroundTask> timeLockFeedbackBackgroundTask, Optional<TimeLockRequestBatcherProviders> timelockRequestBatcherProviders, Set<Schema> schemas, LockWatchCachingConfig cachingConfig) {
AtlasDbDialogueServiceProvider serviceProvider = AtlasDbDialogueServiceProvider.create(timelockServerListConfig, reloadingFactory, userAgent, metricsManager.getTaggedRegistry());
LockRpcClient lockRpcClient = serviceProvider.getLockRpcClient();
LockService lockService = AtlasDbMetrics.instrumentTimed(metricsManager.getRegistry(), LockService.class, RemoteLockServiceAdapter.create(lockRpcClient, timelockNamespace));
ConjureTimelockService conjureTimelockService = serviceProvider.getConjureTimelockService();
TimelockRpcClient timelockClient = serviceProvider.getTimelockRpcClient();
// TODO(fdesouza): Remove this once PDS-95791 is resolved.
ConjureTimelockService withDiagnosticsConjureTimelockService = lockDiagnosticComponents.<ConjureTimelockService>map(components -> new LockDiagnosticConjureTimelockService(conjureTimelockService, components.clientLockDiagnosticCollector(), components.localLockTracker())).orElse(conjureTimelockService);
NamespacedTimelockRpcClient namespacedTimelockRpcClient = new DefaultNamespacedTimelockRpcClient(timelockClient, timelockNamespace);
LeaderElectionReportingTimelockService leaderElectionReportingTimelockService = LeaderElectionReportingTimelockService.create(withDiagnosticsConjureTimelockService, timelockNamespace);
timeLockFeedbackBackgroundTask.ifPresent(task -> task.registerLeaderElectionStatistics(leaderElectionReportingTimelockService));
NamespacedConjureTimelockService namespacedConjureTimelockService = TimestampCorroboratingTimelockService.create(timelockNamespace, metricsManager.getTaggedRegistry(), leaderElectionReportingTimelockService);
NamespacedConjureLockWatchingService lockWatchingService = new NamespacedConjureLockWatchingService(serviceProvider.getConjureLockWatchingService(), timelockNamespace);
Supplier<InternalMultiClientConjureTimelockService> multiClientTimelockServiceSupplier = getMultiClientTimelockServiceSupplier(serviceProvider);
Supplier<Optional<RequestBatchersFactory.MultiClientRequestBatchers>> requestBatcherProvider = () -> timelockRequestBatcherProviders.map(batcherProviders -> ImmutableMultiClientRequestBatchers.of(batcherProviders.commitTimestamps().getBatcher(multiClientTimelockServiceSupplier), batcherProviders.startTransactions().getBatcher(multiClientTimelockServiceSupplier)));
TimeLockHelperServices timeLockHelperServices = TimeLockHelperServices.create(timelockNamespace, metricsManager, schemas, lockWatchingService, cachingConfig, requestBatcherProvider);
LockWatchManagerInternal lockWatchManager = timeLockHelperServices.lockWatchManager();
RemoteTimelockServiceAdapter remoteTimelockServiceAdapter = RemoteTimelockServiceAdapter.create(namespacedTimelockRpcClient, namespacedConjureTimelockService, getLeaderTimeGetter(timelockNamespace, timelockRequestBatcherProviders, namespacedConjureTimelockService, multiClientTimelockServiceSupplier), timeLockHelperServices.requestBatchersFactory());
TimestampManagementService timestampManagementService = new RemoteTimestampManagementAdapter(serviceProvider.getTimestampManagementRpcClient(), timelockNamespace);
return ImmutableLockAndTimestampServices.builder().lock(lockService).timestamp(new TimelockTimestampServiceAdapter(remoteTimelockServiceAdapter)).timestampManagement(timestampManagementService).timelock(remoteTimelockServiceAdapter).lockWatcher(lockWatchManager).addResources(remoteTimelockServiceAdapter::close).addResources(lockWatchManager::close).build();
}
Aggregations