Skip to content

Commit

Permalink
[HUDI-7782] Task not serializable due to DynamoDBBasedLockProvider an…
Browse files Browse the repository at this point in the history
…d HiveMetastoreBasedLockProvider in clean action (#11389)

Co-authored-by: Vova Kolmakov <[email protected]>
  • Loading branch information
wombatu-kun and Vova Kolmakov authored Jun 4, 2024
1 parent 9246fd7 commit eb63e1f
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@

import javax.annotation.concurrent.NotThreadSafe;

import java.io.Serializable;
import java.net.URI;
import java.util.ArrayList;
import java.util.Collection;
Expand All @@ -58,13 +59,13 @@
* using DynamoDB. Users need to have access to AWS DynamoDB to be able to use this lock.
*/
@NotThreadSafe
public class DynamoDBBasedLockProvider implements LockProvider<LockItem> {
public class DynamoDBBasedLockProvider implements LockProvider<LockItem>, Serializable {

private static final Logger LOG = LoggerFactory.getLogger(DynamoDBBasedLockProvider.class);

private static final String DYNAMODB_ATTRIBUTE_NAME = "key";

private final AmazonDynamoDBLockClient client;
private final transient AmazonDynamoDBLockClient client;
private final String tableName;
private final String dynamoDBPartitionKey;
protected final DynamoDbBasedLockConfig dynamoDBLockConfiguration;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.io.Serializable;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.Executors;
import java.util.concurrent.ScheduledExecutorService;
Expand Down Expand Up @@ -75,18 +76,18 @@
* using hive metastore APIs. Users need to have a HiveMetastore & Zookeeper cluster deployed to be able to use this lock.
*
*/
public class HiveMetastoreBasedLockProvider implements LockProvider<LockResponse> {
public class HiveMetastoreBasedLockProvider implements LockProvider<LockResponse>, Serializable {

private static final Logger LOG = LoggerFactory.getLogger(HiveMetastoreBasedLockProvider.class);

private final String databaseName;
private final String tableName;
private final String hiveMetastoreUris;
private IMetaStoreClient hiveClient;
private transient IMetaStoreClient hiveClient;
private volatile LockResponse lock = null;
protected LockConfiguration lockConfiguration;
private ScheduledFuture<?> future = null;
private final ScheduledExecutorService executor = Executors.newScheduledThreadPool(2);
private transient ScheduledFuture<?> future = null;
private final transient ScheduledExecutorService executor = Executors.newScheduledThreadPool(2);

public HiveMetastoreBasedLockProvider(final LockConfiguration lockConfiguration, final StorageConfiguration<?> conf) {
this(lockConfiguration);
Expand Down

0 comments on commit eb63e1f

Please sign in to comment.