beam-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Thomas Groh (JIRA)" <>
Subject [jira] [Created] (BEAM-609) Add Interface around Evaluator Caching
Date Wed, 31 Aug 2016 18:17:21 GMT
Thomas Groh created BEAM-609:

             Summary: Add Interface around Evaluator Caching
                 Key: BEAM-609
             Project: Beam
          Issue Type: Improvement
          Components: runner-direct
            Reporter: Thomas Groh
            Assignee: Davor Bonaci
            Priority: Minor

The "acquire-use-release" pattern is relatively common throughout the TransformEvaluators
((Un)BoundedRead, TestStream), and as a result there's some code duplication.

Refactoring to use a common interface (among the lines of:

public static class ConcurrentSingleUseInstanceCache<K, V> {
  public ConcurrentSingleUseInstanceCache(Function<K, V> createInstance) { ... }
  public @Nullable V tryAcquire(K key) { ... };
  public void release(K key, V value) { ... }

would improve this abstraction boundary and get rid of some duplicate logic. We can also test
the cache-and-hold implementations more easily.

This message was sent by Atlassian JIRA

View raw message