- private class PolicySupplier implements Supplier<RaftPolicy>{
- @Override
- public RaftPolicy get() {
- if(Strings.isNullOrEmpty(DefaultConfigParamsImpl.this.customRaftPolicyImplementationClass)){
- LOG.debug("No custom RaftPolicy specified. Using DefaultRaftPolicy");
- return DefaultRaftPolicy.INSTANCE;
- }
- try {
- String className = DefaultConfigParamsImpl.this.customRaftPolicyImplementationClass;
- LOG.info("Trying to use custom RaftPolicy {}", className);
- Class c = Class.forName(className);
- RaftPolicy obj = (RaftPolicy)c.newInstance();
- return obj;
- } catch (Exception e) {
- if(LOG.isDebugEnabled()) {
- LOG.error("Could not create custom raft policy, will stick with default", e);
- } else {
- LOG.error("Could not create custom raft policy, will stick with default : cause = {}", e.getMessage());
- }
- }
+ @Override
+ public String getTempFileDirectory() {
+ return tempFileDirectory;
+ }
+
+ @Override
+ public int getFileBackedStreamingThreshold() {
+ return fileBackedStreamingThreshold;
+ }
+
+
+ @Override
+ public PeerAddressResolver getPeerAddressResolver() {
+ return peerAddressResolver;
+ }
+
+ public void setPeerAddressResolver(final @NonNull PeerAddressResolver peerAddressResolver) {
+ this.peerAddressResolver = requireNonNull(peerAddressResolver);
+ }
+
+ @Override
+ public long getSyncIndexThreshold() {
+ return syncIndexThreshold;
+ }
+
+ public void setSyncIndexThreshold(final long syncIndexThreshold) {
+ checkArgument(syncIndexThreshold >= 0);
+ this.syncIndexThreshold = syncIndexThreshold;
+ }
+
+ @SuppressWarnings("checkstyle:IllegalCatch")
+ private RaftPolicy getPolicy() {
+ if (Strings.isNullOrEmpty(DefaultConfigParamsImpl.this.customRaftPolicyImplementationClass)) {
+ LOG.debug("No custom RaftPolicy specified. Using DefaultRaftPolicy");