|
18 | 18 |
|
19 | 19 | package org.apache.hudi.client.transaction.lock; |
20 | 20 |
|
21 | | -import org.apache.curator.framework.CuratorFramework; |
22 | | -import org.apache.curator.framework.CuratorFrameworkFactory; |
23 | | -import org.apache.curator.framework.imps.CuratorFrameworkState; |
24 | | -import org.apache.curator.framework.recipes.locks.InterProcessMutex; |
25 | | -import org.apache.curator.retry.BoundedExponentialBackoffRetry; |
26 | | -import org.apache.hadoop.conf.Configuration; |
27 | 21 | import org.apache.hudi.common.config.LockConfiguration; |
28 | 22 | import org.apache.hudi.common.lock.LockProvider; |
29 | 23 | import org.apache.hudi.common.lock.LockState; |
30 | 24 | import org.apache.hudi.common.util.StringUtils; |
31 | 25 | import org.apache.hudi.common.util.ValidationUtils; |
32 | 26 | import org.apache.hudi.exception.HoodieLockException; |
| 27 | + |
| 28 | +import org.apache.curator.framework.CuratorFramework; |
| 29 | +import org.apache.curator.framework.CuratorFrameworkFactory; |
| 30 | +import org.apache.curator.framework.imps.CuratorFrameworkState; |
| 31 | +import org.apache.curator.framework.recipes.locks.InterProcessMutex; |
| 32 | +import org.apache.curator.retry.BoundedExponentialBackoffRetry; |
| 33 | +import org.apache.hadoop.conf.Configuration; |
33 | 34 | import org.apache.log4j.LogManager; |
34 | 35 | import org.apache.log4j.Logger; |
35 | 36 |
|
36 | 37 | import javax.annotation.concurrent.NotThreadSafe; |
| 38 | + |
| 39 | +import java.io.Serializable; |
37 | 40 | import java.util.concurrent.TimeUnit; |
38 | 41 |
|
39 | 42 | import static org.apache.hudi.common.config.LockConfiguration.DEFAULT_ZK_CONNECTION_TIMEOUT_MS; |
|
52 | 55 | * using zookeeper. Users need to have a Zookeeper cluster deployed to be able to use this lock. |
53 | 56 | */ |
54 | 57 | @NotThreadSafe |
55 | | -public class ZookeeperBasedLockProvider implements LockProvider<InterProcessMutex> { |
| 58 | +public class ZookeeperBasedLockProvider implements LockProvider<InterProcessMutex>, Serializable { |
56 | 59 |
|
57 | 60 | private static final Logger LOG = LogManager.getLogger(ZookeeperBasedLockProvider.class); |
58 | 61 |
|
59 | | - private final CuratorFramework curatorFrameworkClient; |
| 62 | + private final transient CuratorFramework curatorFrameworkClient; |
60 | 63 | private volatile InterProcessMutex lock = null; |
61 | 64 | protected LockConfiguration lockConfiguration; |
62 | 65 |
|
|
0 commit comments