/** * Sets speculative execution policy. * * @param plc Speculative execution policy. */ @SuppressWarnings("UnusedDeclaration") public void setSpeculativeExecutionPolicy(SpeculativeExecutionPolicy plc) { speculativeExecutionPlc = 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); }
@Test public void buildsPolicyWithConfiguredValues() throws Exception { final ConstantSpeculativeExecutionPolicyFactory factory = new ConstantSpeculativeExecutionPolicyFactory(); factory.setDelay(Duration.seconds(5)); factory.setMaxSpeculativeExecutions(2); final SpeculativeExecutionPolicy policy = factory.build(); assertThat(policy).isExactlyInstanceOf(ConstantSpeculativeExecutionPolicy.class); }
@Test public void returnsSingletonInstance() throws Exception { final NoSpeculativeExecutionPolicyFactory factory = new NoSpeculativeExecutionPolicyFactory(); final SpeculativeExecutionPolicy policy = factory.build(); assertThat(policy).isSameAs(NoSpeculativeExecutionPolicy.INSTANCE); }
/** * Sets speculative execution policy. * * @param plc Speculative execution policy. */ @SuppressWarnings("UnusedDeclaration") public void setSpeculativeExecutionPolicy(SpeculativeExecutionPolicy plc) { this.speculativeExecutionPlc = plc; invalidate(); }
@Override public SpeculativeExecutionPolicy build() { return NoSpeculativeExecutionPolicy.INSTANCE; }
@Override public SpeculativeExecutionPolicy build() { return new ConstantSpeculativeExecutionPolicy(delay.toMilliseconds(), maxSpeculativeExecutions); }
/** * @return the speculativeExecutionPolicy */ public SpeculativeExecutionPolicy getSpeculativeExecutionPolicy() { return speculativeExecutionPolicy; }
/** * @param speculativeExecutionPolicy * the speculativeExecutionPolicy to set */ public void setSpeculativeExecutionPolicy( SpeculativeExecutionPolicy speculativeExecutionPolicy) { this.speculativeExecutionPolicy = speculativeExecutionPolicy; }
SpeculativeExecutionPolicy build();