This is an automated email from the ASF dual-hosted git repository.
jxue pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/helix.git
The following commit(s) were added to refs/heads/master by this push:
new a47df77e5 Add default method for TTL support (#2223)
a47df77e5 is described below
commit a47df77e590fddd3ed56bf3d32ed834afca1556b
Author: Qi (Quincy) Qu <[email protected]>
AuthorDate: Mon Sep 26 17:49:34 2022 -0700
Add default method for TTL support (#2223)
Implement default methods for two TTL related methods in BaseDataAccessor
to maintain compatibility.
---
helix-core/pom.xml | 1 -
helix-core/src/main/java/org/apache/helix/BaseDataAccessor.java | 8 ++++++--
2 files changed, 6 insertions(+), 3 deletions(-)
diff --git a/helix-core/pom.xml b/helix-core/pom.xml
index df8ddd936..baa251d95 100755
--- a/helix-core/pom.xml
+++ b/helix-core/pom.xml
@@ -150,7 +150,6 @@
<groupId>org.xerial.snappy</groupId>
<artifactId>snappy-java</artifactId>
<version>1.1.7</version>
- <scope>test</scope>
</dependency>
</dependencies>
<build>
diff --git a/helix-core/src/main/java/org/apache/helix/BaseDataAccessor.java
b/helix-core/src/main/java/org/apache/helix/BaseDataAccessor.java
index 9c639d817..110b6810e 100644
--- a/helix-core/src/main/java/org/apache/helix/BaseDataAccessor.java
+++ b/helix-core/src/main/java/org/apache/helix/BaseDataAccessor.java
@@ -53,7 +53,9 @@ public interface BaseDataAccessor<T> {
* @param ttl TTL of the node in milliseconds, if options supports it
* @return true if creation succeeded, false otherwise (e.g. if the ZNode
exists)
*/
- boolean create(String path, T record, int options, long ttl);
+ default boolean create(String path, T record, int options, long ttl) {
+ throw new UnsupportedOperationException("create with TTL support is not
implemented.");
+ }
/**
* This will always attempt to set the data on existing node. If the ZNode
does not
@@ -116,7 +118,9 @@ public interface BaseDataAccessor<T> {
* @param ttl TTL of the node in milliseconds, if options supports it
* @return For each child: true if creation succeeded, false otherwise (e.g.
if the child exists)
*/
- boolean[] createChildren(List<String> paths, List<T> records, int options,
long ttl);
+ default boolean[] createChildren(List<String> paths, List<T> records, int
options, long ttl) {
+ throw new UnsupportedOperationException("createChildren with TTL support
is not implemented.");
+ }
/**
* can set multiple children under a parent node. This will use async api
for better