/** * @param status - the status of an afterCompletion notification * @param txId - the transaction identifier * @param type - BEFORE_COMPLETION or AFTER_COMPLETION * @return the server's commit message */ public static TXCommitMessage execute(InternalPool pool, int status, int txId, CompletionType type) { Impl impl = new Impl(status, txId, type); pool.execute(impl); return impl.tXCommitMessageResponse; }
@Override public void endpointNowInUse(Endpoint endpoint) { try { Future future = pool.getBackgroundProcessor().scheduleWithFixedDelay(new PingTask(endpoint), pingIntervalNanos, pingIntervalNanos, TimeUnit.NANOSECONDS); taskFutures.put(endpoint, future); } catch (RejectedExecutionException e) { if (!pool.getCancelCriterion().isCancelInProgress()) { throw e; } } }
/** * Support for server-side interest registration */ public void removeSingleInterest(Object key, int interestType, boolean isDurable, boolean receiveUpdatesAsInvalidates) { this.pool.getRITracker().removeSingleInterest(this.region, key, interestType, isDurable, receiveUpdatesAsInvalidates); }
@Override public void start(InternalPool pool) { this.pool = pool; pool.getStats().setInitialContacts(((LocatorList) locators.get()).size()); this.locatorUpdateInterval = Long.getLong( DistributionConfig.GEMFIRE_PREFIX + "LOCATOR_UPDATE_INTERVAL", pool.getPingInterval()); if (locatorUpdateInterval > 0) { pool.getBackgroundProcessor().scheduleWithFixedDelay(new UpdateLocatorListTask(), 0, locatorUpdateInterval, TimeUnit.MILLISECONDS); logger.info("AutoConnectionSource UpdateLocatorListTask started with interval={} ms.", new Object[] {this.locatorUpdateInterval}); } }
@Override public void suspend() { this.serverAffinityLocation = this.firstProxy.getPool().getServerAffinityLocation(); this.firstProxy.getPool().releaseServerAffinity(); if (logger.isDebugEnabled()) { logger.debug("TX: suspending transaction: {} server delegate: {}", getTransactionId(), this.serverAffinityLocation); } }
snapshot = queueConnections; while (snapshot.getPrimary() == null && !snapshot.primaryDiscoveryFailed() && !shuttingDown && pool.getPoolOrCacheCancelInProgress() == null) { try { lock.wait(); pool.getCancelCriterion().checkCancelInProgress(null); GemFireException exception = snapshot.getPrimaryDiscoveryException(); if (exception == null || exception instanceof NoSubscriptionServersAvailableException) {
@Override public void rollback() { if (this.internalAfterSendRollback != null) { this.internalAfterSendRollback.run(); } try { txRolledback = true; this.firstProxy.rollback(proxy.getTxId().getUniqId()); } finally { this.firstProxy.getPool().releaseServerAffinity(); } }
private void recoverCqs(Connection recoveredConnection, boolean isDurable) { Map cqs = this.getPool().getRITracker().getCqsMap(); Iterator i = cqs.entrySet().iterator(); while (i.hasNext()) { Map.Entry e = (Map.Entry) i.next(); ClientCQ cqi = (ClientCQ) e.getKey(); String name = cqi.getName(); if (this.pool.getMultiuserAuthentication()) { UserAttributes.userAttributes .set(((DefaultQueryService) this.pool.getQueryService()).getUserAttributes(name)); } try { if (((CqStateImpl) cqi.getState()).getState() != CqStateImpl.INIT) { cqi.createOn(recoveredConnection, isDurable); } } finally { UserAttributes.userAttributes.set(null); } } }
@Override public void run2() { if (pool.getCancelCriterion().isCancelInProgress()) { return; } catch (RejectedExecutionException e) { pool.getCancelCriterion().checkCancelInProgress(e); throw e; // weird } catch (Exception e) { pool.getCancelCriterion().checkCancelInProgress(e); pool.releaseThreadLocalConnection();
@Override public void run2() { if (pool.getCancelCriterion().isCancelInProgress()) { return; } LocatorListResponse response = (LocatorListResponse) queryLocators(LOCATOR_LIST_REQUEST); updateLocatorList(response); } }
"Interest registration requires a Pool"); if (isDurable && !proxy.getPool().isDurableClient()) { throw new IllegalStateException( "Durable flag only applicable for durable clients."); if (!proxy.getPool().getSubscriptionEnabled()) { String msg = "Interest registration requires a pool whose queue is enabled."; throw new SubscriptionNotEnabledException(msg);
|| pool.getPoolOrCacheCancelInProgress() != null) { isBadConnection = true; } else { connection.internalClose(pool.getKeepAlive()); } catch (Exception e) { if (logger.isDebugEnabled()) {
/** * Initializes the connection using the pool from the client region. Also sets the cqBaseRegion * value of this CQ. */ private void initConnectionProxy() throws CqException, RegionNotFoundException { cqBaseRegion = (LocalRegion) cqService.getCache().getRegion(regionName); // Check if the region exists on the local cache. // In the current implementation of 5.1 the Server Connection is (ConnectionProxyImpl) // is obtained by the Bridge Client/writer/loader on the local region. if (cqBaseRegion == null) { throw new RegionNotFoundException( String.format("Region on which query is specified not found locally, regionName: %s", regionName)); } ServerRegionProxy srp = cqBaseRegion.getServerProxy(); if (srp != null) { if (logger.isTraceEnabled()) { logger.trace("Found server region proxy on region. RegionName: {}", regionName); } this.cqProxy = new ServerCQProxyImpl(srp); if (!srp.getPool().getSubscriptionEnabled()) { throw new CqException("The 'queueEnabled' flag on Pool installed on Region " + regionName + " is set to false."); } } else { throw new CqException( "Unable to get the connection pool. The Region does not have a pool configured."); } }
/** * Release use of this pool */ public void detach() { this.pool.detach(); }
hasQueue = (Boolean) pool.executeOn(server, HasQueueOp.SINGLETON); } catch (GemFireSecurityException e) { throw e;
@Override public void run2() { if (endpoint.timeToPing(pingIntervalNanos)) { try { PingOp.execute(pool, endpoint.getLocation()); } catch (Exception e) { if (logger.isDebugEnabled()) { logger.debug("Error occurred while pinging server: {} - {}", endpoint.getLocation(), e.getMessage()); } InternalCache cache = GemFireCacheImpl.getInstance(); if (cache != null) { ClientMetadataService cms = cache.getClientMetadataService(); cms.removeBucketServerLocation(endpoint.getLocation()); } // any failure to ping the server should be considered a crash (eg. // socket timeout exception, security exception, failure to connect). pool.getEndpointManager().serverCrashed(endpoint); } } } }
queueConnections = queueConnections.removeConnection(deadConnection); try { deadConnection.internalClose(pool.getKeepAlive()); } catch (Exception e) { logger.warn("Error destroying client to server connection to {}",
redundancySatisfierTask = null; if (pool.getPoolOrCacheCancelInProgress() != null) { pool.getCancelCriterion().checkCancelInProgress(t); logError("Error in redundancy satisfier", t);
@Override public void afterCompletion(int status) { try { if (txRolledback) { return; } TXCommitMessage txcm = this.firstProxy.afterCompletion(status, proxy.getTxId().getUniqId()); if (status == Status.STATUS_COMMITTED) { if (txcm == null) { throw new TransactionInDoubtException( "Commit failed on cache server"); } else { afterServerCommit(txcm); } } else if (status == Status.STATUS_ROLLEDBACK) { if (this.internalAfterSendRollback != null) { this.internalAfterSendRollback.run(); } this.firstProxy.getPool().releaseServerAffinity(); } } finally { if (status == Status.STATUS_COMMITTED) { // rollback does not grab locks this.lockReq.releaseLocal(); } this.firstProxy.getPool().releaseServerAffinity(); } }
@Override public void run2() { if (pool.getCancelCriterion().isCancelInProgress()) { return; recoveryScheduled = true; } catch (RejectedExecutionException e) { if (!pool.getCancelCriterion().isCancelInProgress()) { throw e; } catch (RejectedExecutionException e) { if (!pool.getCancelCriterion().isCancelInProgress()) { throw e; // weird if (pool.getCancelCriterion().isCancelInProgress()) { return; } catch (RejectedExecutionException ex) { // GEODE-1613 - suspect string while shutting if (!background.isTerminated() && !pool.getCancelCriterion().isCancelInProgress()) { throw ex; pool.releaseThreadLocalConnection();