From 7bbb5d49416b1ba24ae082f507e6f86e950bb1c9 Mon Sep 17 00:00:00 2001 From: Chris Norman Date: Tue, 8 Feb 2022 18:57:36 -0500 Subject: [PATCH] Make LocatableCache and strategy classes serializable. --- .../engine/cache/DrivingFeatureInputCacheStrategy.java | 5 ++++- .../hellbender/engine/cache/LocatableCache.java | 4 +++- .../hellbender/engine/cache/LocatableCacheStrategy.java | 3 +-- .../hellbender/engine/cache/SideReadInputCacheStrategy.java | 5 ++++- 4 files changed, 12 insertions(+), 5 deletions(-) diff --git a/src/main/java/org/broadinstitute/hellbender/engine/cache/DrivingFeatureInputCacheStrategy.java b/src/main/java/org/broadinstitute/hellbender/engine/cache/DrivingFeatureInputCacheStrategy.java index a11000b41de..cd356007c61 100644 --- a/src/main/java/org/broadinstitute/hellbender/engine/cache/DrivingFeatureInputCacheStrategy.java +++ b/src/main/java/org/broadinstitute/hellbender/engine/cache/DrivingFeatureInputCacheStrategy.java @@ -5,6 +5,7 @@ import org.broadinstitute.hellbender.exceptions.GATKException; import org.broadinstitute.hellbender.utils.SimpleInterval; +import java.io.Serializable; import java.util.ArrayList; import java.util.Deque; import java.util.Iterator; @@ -22,7 +23,9 @@ * * @param type Feature being cached */ -public class DrivingFeatureInputCacheStrategy implements LocatableCacheStrategy { +public class DrivingFeatureInputCacheStrategy + implements LocatableCacheStrategy, Serializable { + private static final long serialVersionUID = 1L; /** * When we trimCache our cache to a new start position, this is the maximum number of diff --git a/src/main/java/org/broadinstitute/hellbender/engine/cache/LocatableCache.java b/src/main/java/org/broadinstitute/hellbender/engine/cache/LocatableCache.java index d6f85bfc3c8..f454ff2a819 100644 --- a/src/main/java/org/broadinstitute/hellbender/engine/cache/LocatableCache.java +++ b/src/main/java/org/broadinstitute/hellbender/engine/cache/LocatableCache.java @@ -6,6 +6,7 @@ import org.apache.logging.log4j.Logger; import org.broadinstitute.hellbender.utils.Utils; +import java.io.Serializable; import java.util.*; /** @@ -23,7 +24,8 @@ * * @param Type of Locatable record we are caching */ -public class LocatableCache { +public class LocatableCache implements Serializable { + private static final long serialVersionUID = 1L; private static final Logger logger = LogManager.getLogger(LocatableCache.class); /** diff --git a/src/main/java/org/broadinstitute/hellbender/engine/cache/LocatableCacheStrategy.java b/src/main/java/org/broadinstitute/hellbender/engine/cache/LocatableCacheStrategy.java index 97bb978f372..ce098f5157e 100644 --- a/src/main/java/org/broadinstitute/hellbender/engine/cache/LocatableCacheStrategy.java +++ b/src/main/java/org/broadinstitute/hellbender/engine/cache/LocatableCacheStrategy.java @@ -1,14 +1,13 @@ package org.broadinstitute.hellbender.engine.cache; import htsjdk.samtools.util.Locatable; -import org.broadinstitute.hellbender.utils.SimpleInterval; import java.util.Deque; import java.util.Iterator; import java.util.List; /** - * Interface for implemented by cache strategy objects for {@code LocatableCache}. + * Interface implemented by cache strategy objects for {@code LocatableCache}. * * {@code LocatableCacheStrategy} implementations determine the following policies for the cache: * diff --git a/src/main/java/org/broadinstitute/hellbender/engine/cache/SideReadInputCacheStrategy.java b/src/main/java/org/broadinstitute/hellbender/engine/cache/SideReadInputCacheStrategy.java index 8bf72cd29e0..b67e072c512 100644 --- a/src/main/java/org/broadinstitute/hellbender/engine/cache/SideReadInputCacheStrategy.java +++ b/src/main/java/org/broadinstitute/hellbender/engine/cache/SideReadInputCacheStrategy.java @@ -7,6 +7,7 @@ import org.broadinstitute.hellbender.utils.SimpleInterval; import org.broadinstitute.hellbender.utils.read.GATKRead; +import java.io.Serializable; import java.util.*; import java.util.function.Function; @@ -23,7 +24,9 @@ * * @param Type of Locatable being cached. */ -public class SideReadInputCacheStrategy implements LocatableCacheStrategy { +public class SideReadInputCacheStrategy + implements LocatableCacheStrategy, Serializable { + private static final long serialVersionUID = 1L; private static final Logger logger = LogManager.getLogger(LocatableCache.class); private static final int EXPECTED_MAX_OVERLAPPING_READS_DURING_CACHE_TRIM = 128;