Skip to content

Commit

Permalink
fix SE_TRANSIENT_FIELD_NOT_RESTORED
Browse files Browse the repository at this point in the history
  • Loading branch information
xumanbu committed Jul 26, 2024
1 parent 2d657b1 commit 02ca92c
Showing 1 changed file with 4 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,13 @@
package org.apache.uniffle.common.util;

import java.io.IOException;
import java.io.ObjectInputStream;
import java.io.Serializable;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.ScheduledFuture;
import java.util.concurrent.TimeUnit;
import java.util.function.Supplier;

import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

Expand All @@ -44,7 +44,10 @@ public class ExpiringCloseableSupplier<T extends StatefulCloseable>
private final long delayCloseInterval;

private transient volatile ScheduledFuture<?> future;

@SuppressFBWarnings("SE_TRANSIENT_FIELD_NOT_RESTORED")
private transient volatile long accessTime = System.currentTimeMillis();

private transient volatile T t;

private ExpiringCloseableSupplier(Supplier<T> delegate, long delayCloseInterval) {
Expand Down Expand Up @@ -104,9 +107,4 @@ public static <T extends StatefulCloseable> ExpiringCloseableSupplier<T> of(
Supplier<T> delegate, long delayCloseInterval) {
return new ExpiringCloseableSupplier<>(delegate, delayCloseInterval);
}

private void readObject(ObjectInputStream ois) throws IOException, ClassNotFoundException {
ois.defaultReadObject();
this.accessTime = System.currentTimeMillis();
}
}

0 comments on commit 02ca92c

Please sign in to comment.