/** * Initializes the state of this factory for the given pool's state. */ public void init(Pool cp) { setSocketConnectTimeout(cp.getSocketConnectTimeout()); setFreeConnectionTimeout(cp.getFreeConnectionTimeout()); setLoadConditioningInterval(cp.getLoadConditioningInterval()); setSocketBufferSize(cp.getSocketBufferSize()); setReadTimeout(cp.getReadTimeout()); setMinConnections(cp.getMinConnections()); setMaxConnections(cp.getMaxConnections()); setRetryAttempts(cp.getRetryAttempts()); setIdleTimeout(cp.getIdleTimeout()); setPingInterval(cp.getPingInterval()); setStatisticInterval(cp.getStatisticInterval()); setThreadLocalConnections(cp.getThreadLocalConnections()); setSubscriptionEnabled(cp.getSubscriptionEnabled()); setPRSingleHopEnabled(cp.getPRSingleHopEnabled()); setSubscriptionRedundancy(cp.getSubscriptionRedundancy()); setSubscriptionMessageTrackingTimeout(cp.getSubscriptionMessageTrackingTimeout()); setSubscriptionAckInterval(cp.getSubscriptionAckInterval()); setServerGroup(cp.getServerGroup()); setMultiuserAuthentication(cp.getMultiuserAuthentication()); for (InetSocketAddress inetSocketAddress : cp.getLocators()) { addLocator(inetSocketAddress.getHostName(), inetSocketAddress.getPort()); } this.attributes.servers.addAll(cp.getServers()); }
public String getDefaultPoolName() { String result = null; Map<String, Pool> pools = getPools(); if (pools.size() == 1) { Pool pool = pools.values().iterator().next(); result = pool.getName(); } else if (pools.isEmpty()) { result = "DEFAULT"; } return result; }
private static RegionService createAuthenticatedCacheView(Pool pool, Properties properties) { if (pool.getMultiuserAuthentication()) { return ((PoolImpl) pool).createAuthenticatedCacheView(properties); } else { throw new IllegalStateException( "The pool " + pool.getName() + " did not have multiuser-authentication set to true"); } }
/** * Releases all system resources and destroys the {@link Pool} when created by this {@link PoolFactoryBean}. * * @throws Exception if the {@link Pool} destruction caused an error. * @see org.springframework.beans.factory.DisposableBean#destroy() */ @Override public void destroy() throws Exception { Optional.ofNullable(this.pool) .filter(pool -> this.springManagedPool) .filter(pool -> !pool.isDestroyed()) .ifPresent(pool -> { pool.releaseThreadLocalConnection(); pool.destroy(this.keepAlive); setPool(null); logDebug("Destroyed Pool [%s]", pool.getName()); }); }
public String getConnectionInfo() throws Exception { return clientCache.getDefaultPool().getLocators().toString(); }
@Override public Execution onServers(Pool pool, String... groups) { if (pool == null) { throw new FunctionException( String.format("%s passed is null", "Pool instance ")); } if (pool.getMultiuserAuthentication()) { throw new UnsupportedOperationException(); } return new ServerFunctionExecutor(pool, true, groups); }
@Override public long export(Region<K, V> region, ExportSink sink, SnapshotOptions<K, V> options) throws IOException { try { ClientArgs<K, V> args = new ClientArgs<K, V>(region.getFullPath(), pool.getPRSingleHopEnabled(), options); ClientExportCollector results = new ClientExportCollector(sink); // For single hop we rely on tcp queuing to throttle the export; otherwise // we allow the WindowedExporter to provide back pressure. Execution exec = pool.getPRSingleHopEnabled() ? FunctionService.onRegion(region) : FunctionService.onServer(pool); ResultCollector<?, ?> rc = exec.setArguments(args).withCollector(results).execute(new ProxyExportFunction<K, V>()); // Our custom result collector is writing the data, but this will // check for errors. return (Long) rc.getResult(); } catch (FunctionException e) { throw new IOException(e); } }
public int getLoadConditioningInterval(Integer defaultLoadConditioningInterval) { return defaultIfNull(defaultLoadConditioningInterval, () -> getDelegate().getLoadConditioningInterval()); }
public int getFreeConnectionTimeout(Integer defaultFreeConnectionTimeout) { return defaultIfNull(defaultFreeConnectionTimeout, () -> getDelegate().getFreeConnectionTimeout()); }
public long getIdleTimeout(Long defaultIdleTimeout) { return defaultIfNull(defaultIdleTimeout, () -> getDelegate().getIdleTimeout()); }
public long getPingInterval(Long defaultPingInterval) { return defaultIfNull(defaultPingInterval, () -> getDelegate().getPingInterval()); }
public int getMaxConnections(Integer defaultMaxConnections) { return defaultIfNull(defaultMaxConnections, () -> getDelegate().getMaxConnections()); }
public int getMinConnections(Integer defaultMinConnections) { return defaultIfNull(defaultMinConnections, () -> getDelegate().getMinConnections()); }
/** * Releases all system resources and destroys the {@link Pool} when created by this {@link PoolFactoryBean}. * * @throws Exception if the {@link Pool} destruction caused an error. * @see org.springframework.beans.factory.DisposableBean#destroy() */ @Override public void destroy() throws Exception { Optional.ofNullable(this.pool) .filter(pool -> this.springManagedPool) .filter(pool -> !pool.isDestroyed()) .ifPresent(pool -> { pool.releaseThreadLocalConnection(); pool.destroy(this.keepAlive); setPool(null); logDebug("Destroyed Pool [%s]", pool.getName()); }); }
public String getConnectionInfo() throws Exception { return clientCache.getDefaultPool().getLocators().toString(); }
@Override public Execution onServer(Pool pool, String... groups) { if (pool == null) { throw new FunctionException( String.format("%s passed is null", "Pool instance ")); } if (pool.getMultiuserAuthentication()) { throw new UnsupportedOperationException(); } return new ServerFunctionExecutor(pool, false, groups); }
public boolean getPRSingleHopEnabled(Boolean defaultPrSingleHopEnabled) { return defaultIfNull(defaultPrSingleHopEnabled, () -> getDelegate().getPRSingleHopEnabled()); }
public int getLoadConditioningInterval(Integer defaultLoadConditioningInterval) { return defaultIfNull(defaultLoadConditioningInterval, () -> getDelegate().getLoadConditioningInterval()); }
public int getFreeConnectionTimeout(Integer defaultFreeConnectionTimeout) { return defaultIfNull(defaultFreeConnectionTimeout, () -> getDelegate().getFreeConnectionTimeout()); }
public long getIdleTimeout(Long defaultIdleTimeout) { return defaultIfNull(defaultIdleTimeout, () -> getDelegate().getIdleTimeout()); }