/** * Parse the reconnection policy. */ public static ReconnectionPolicy parseReconnectionPolicy(String reconnectionPolicyString) throws InstantiationException, IllegalAccessException, ClassNotFoundException, NoSuchMethodException, SecurityException, IllegalArgumentException, InvocationTargetException { String lb_regex = "([a-zA-Z]*Policy)(\\()(.*)(\\))"; Pattern lb_pattern = Pattern.compile(lb_regex); Matcher lb_matcher = lb_pattern.matcher(reconnectionPolicyString); if (lb_matcher.matches()) { if (lb_matcher.groupCount() > 0) { // Primary LB policy has been specified String primaryReconnectionPolicy = lb_matcher.group(1); String reconnectionPolicyParams = lb_matcher.group(3); return getReconnectionPolicy(primaryReconnectionPolicy, reconnectionPolicyParams); } } return null; }
/** * Sets reconnection policy. * * @param plc Reconnection policy. */ @SuppressWarnings("UnusedDeclaration") public void setReconnectionPolicy(ReconnectionPolicy plc) { reconnectionPlc = plc; invalidate(); }
/** {@inheritDoc} */ @SuppressWarnings("unchecked") @Override public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException { fetchSize = (Integer)in.readObject(); readConsistency = (ConsistencyLevel)in.readObject(); writeConsistency = (ConsistencyLevel)in.readObject(); user = U.readString(in); pwd = U.readString(in); port = (Integer)in.readObject(); contactPoints = (List<InetAddress>)in.readObject(); contactPointsWithPorts = (List<InetSocketAddress>)in.readObject(); maxSchemaAgreementWaitSeconds = (Integer)in.readObject(); protoVer = (Integer)in.readObject(); compression = U.readString(in); useSSL = (Boolean)in.readObject(); collectMetrix = (Boolean)in.readObject(); jmxReporting = (Boolean)in.readObject(); creds = (Credentials)in.readObject(); loadBalancingPlc = (LoadBalancingPolicy)readObject(in); reconnectionPlc = (ReconnectionPolicy)readObject(in); addrTranslator = (AddressTranslator)readObject(in); speculativeExecutionPlc = (SpeculativeExecutionPolicy)readObject(in); authProvider = (AuthProvider)readObject(in); sslOptions = (SSLOptions)readObject(in); poolingOptions = (PoolingOptions)readObject(in); sockOptions = (SocketOptions)readObject(in); nettyOptions = (NettyOptions)readObject(in); }
/** * Sets reconnection policy. * * @param plc Reconnection policy. */ @SuppressWarnings("UnusedDeclaration") public void setReconnectionPolicy(ReconnectionPolicy plc) { this.reconnectionPlc = plc; invalidate(); }
public Class<? extends ReconnectionPolicy> getReconnectionPolicy() { return this.reconnectionPolicy; }
public void setReconnectionPolicy( Class<? extends ReconnectionPolicy> reconnectionPolicy) { this.reconnectionPolicy = reconnectionPolicy; }
public ReconnectionPolicy getReconnectionPolicy() { return reconnectionPolicy; }
public void setReconnectionPolicy(ReconnectionPolicy reconnectionPolicy) { this.reconnectionPolicy = reconnectionPolicy; }
@Override public ReconnectionPolicy build() { return new ExponentialReconnectionPolicy(baseDelay.toMilliseconds(), maxDelay.toMilliseconds()); }
@Override public ReconnectionPolicy build() { return new ConstantReconnectionPolicy(delay.toMilliseconds()); }
/** * @return the reconnectionPolicy */ public ReconnectionPolicy getReconnectionPolicy() { return reconnectionPolicy; }
/** * Used to decide how to establish a connection to the cluster in case the current one fails. * The default if not set is to use an ExponentialRetry Policy. * The baseDelay and maxDelay are the two time windows that are used to specify the retry attempts * in an exponential manner * @param reconnectionPolicy * @return The builder instance as initially created updated with this value */ public ConnectionBuilder withReconnectionPolicy(ReconnectionPolicy reconnectionPolicy) { this.reconnectionPolicy = reconnectionPolicy; return this; }
/** * @param reconnectionPolicy * the reconnectionPolicy to set */ public void setReconnectionPolicy(ReconnectionPolicy reconnectionPolicy) { this.reconnectionPolicy = reconnectionPolicy; }
ReconnectionPolicy build();