public ClientQueryCacheEventService(ClientContext clientContext) { AbstractClientListenerService listenerService = (AbstractClientListenerService) clientContext.getListenerService(); this.listenerService = listenerService; this.serializationService = clientContext.getSerializationService(); this.executor = listenerService.getEventExecutor(); this.registrations = new ConcurrentHashMap<String, QueryCacheToListenerMapper>(); }
/** * Initialize this strategy with client context and config * @param clientContext hazelcast client context to access internal services */ public final void init(ClientContext clientContext) { this.clientContext = clientContext; this.clientConnectionStrategyConfig = clientContext.getClientConfig().getConnectionStrategyConfig(); this.logger = clientContext.getLoggingService().getLogger(ClientConnectionStrategy.class); }
public ClientMapInvalidationMetaDataFetcher(ClientContext clientContext) { super(clientContext.getLoggingService().getLogger(ClientMapInvalidationMetaDataFetcher.class)); this.clusterService = clientContext.getClusterService(); this.clientImpl = (HazelcastClientInstanceImpl) clientContext.getHazelcastInstance(); }
IExecutorDelegatingFuture(ClientInvocationFuture future, ClientContext context, String uuid, V defaultValue, ClientMessageDecoder resultDecoder, String objectName, int partitionId) { super(future, context.getSerializationService(), resultDecoder, defaultValue); this.context = context; this.uuid = uuid; this.partitionId = partitionId; this.objectName = objectName; this.target = null; }
private void unregisterClientChannel(@Nonnull String uuid) { ClientContext context = getContext(); context.getListenerService().deregisterListener(uuid); }
@Override protected void onInitialize() { super.onInitialize(); logger = getContext().getLoggingService().getLogger(getClass()); NearCacheConfig nearCacheConfig = getContext().getClientConfig().getNearCacheConfig(name); serializeKeys = nearCacheConfig.isSerializeKeys(); NearCacheManager nearCacheManager = getContext().getNearCacheManager(); IMapDataStructureAdapter<K, V> adapter = new IMapDataStructureAdapter<K, V>(this); nearCache = nearCacheManager.getOrCreateNearCache(name, nearCacheConfig, adapter); if (nearCacheConfig.isInvalidateOnChange()) { registerInvalidationListener(); } }
private void initNearCache() { NearCacheConfig nearCacheConfig = getContext().getClientConfig().getNearCacheConfig(name); if (nearCacheConfig != null) { nearCache = getContext().getNearCacheManager().getOrCreateNearCache(name, nearCacheConfig); if (nearCacheConfig.isInvalidateOnChange()) { registerInvalidationListener(); } } }
private void removeInvalidationListener() { if (!invalidateOnChange) { return; } String registrationId = nearCacheMembershipRegistrationId; if (registrationId != null) { getContext().getRepairingTask(getServiceName()).deregisterHandler(nameWithPrefix); getContext().getListenerService().deregisterListener(registrationId); } }
protected final HazelcastClientInstanceImpl getClient() { return (HazelcastClientInstanceImpl) clientContext.getHazelcastInstance(); } }
private Executor getUserExecutor() { return getContext().getExecutionService().getUserExecutor(); }
@Override public Collection<Member> getMemberList() { return clientContext.getClusterService().getMemberList(); }
private TransactionContext createTransactionContext(Xid xid) { if (getContext().getConnectionManager().getOwnerConnection() == null) { throw new TransactionException("Owner connection needs to be present to begin a transaction"); } ClientTransactionManagerService transactionManager = getContext().getTransactionManager(); TransactionContext context = transactionManager.newXATransactionContext(xid, timeoutInSeconds.get()); getTransaction(context).begin(); return context; }
protected ClientCompletableFuture(String jobId) { super(getContext().getExecutionService().getUserExecutor(), getContext().getLoggingService().getLogger(ClientCompletableFuture.class)); this.jobId = jobId; }
private RepairingTask newRepairingTask(String serviceName) { InvalidationMetaDataFetcher invalidationMetaDataFetcher = newMetaDataFetcher(serviceName); ILogger logger = loggingService.getLogger(RepairingTask.class); return new RepairingTask(properties, invalidationMetaDataFetcher, executionService, serializationService, minimalPartitionService, getLocalUuid(), logger); }
public ClientQueryCacheContext(ClientContext clientContext) { this.clientContext = clientContext; this.queryCacheEventService = new ClientQueryCacheEventService(clientContext); this.queryCacheConfigurator = new ClientQueryCacheConfigurator(clientContext.getClientConfig(), queryCacheEventService); this.queryCacheScheduler = new ClientQueryCacheScheduler(clientContext.getExecutionService()); this.invokerWrapper = new ClientInvokerWrapper(this, clientContext); this.subscriberContext = new ClientSubscriberContext(this); }
@Override public void onDisconnectFromCluster() { disconnectedFromCluster = true; if (reconnectMode == OFF) { shutdownWithExternalThread(); return; } if (clientContext.getLifecycleService().isRunning()) { try { clientContext.getConnectionManager().connectToClusterAsync(); } catch (RejectedExecutionException r) { shutdownWithExternalThread(); } } }
private boolean isClusterAvailable() { return clientContext.getConnectionManager().getOwnerConnectionAddress() != null; } }
@Override public void run() { try { clientContext.getLifecycleService().shutdown(); } catch (Exception exception) { logger.severe("Exception during client shutdown ", exception); } } }, clientContext.getName() + ".clientShutdown-").start();
public ClientFlakeIdGeneratorProxy(String serviceName, String objectName, ClientContext context) { super(serviceName, objectName, context); ClientFlakeIdGeneratorConfig config = getContext().getClientConfig().findFlakeIdGeneratorConfig(getName()); batcher = new AutoBatcher(config.getPrefetchCount(), config.getPrefetchValidityMillis(), new AutoBatcher.IdBatchSupplier() { @Override public IdBatch newIdBatch(int batchSize) { return ClientFlakeIdGeneratorProxy.this.newIdBatch(batchSize); } }); }
invocationService.start(); clusterService.start(); ClientContext clientContext = new ClientContext(this); try { userCodeDeploymentService.start();