Skip to content

Commit

Permalink
MONDRIAN: [MONDRIAN-861] Adds a method to SegmentCache in order to ob…
Browse files Browse the repository at this point in the history
…tain a list of segments present in the cache.

[git-p4: depot-paths = "//open/mondrian/": change = 14094]
  • Loading branch information
lucboudreau committed Feb 4, 2011
1 parent 4c1d815 commit 778fd8e
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/main/mondrian/rolap/agg/SegmentCache.java
Expand Up @@ -10,6 +10,7 @@
*/
package mondrian.rolap.agg;

import java.util.List;
import java.util.concurrent.Future;

import mondrian.olap.MondrianProperties;
Expand Down Expand Up @@ -52,6 +53,13 @@ public interface SegmentCache {
*/
Future<Boolean> contains(SegmentHeader header);

/**
* Returns a list of all segments present in the cache.
* @return A List of segment headers describing the
* contents of the cache.
*/
Future<List<SegmentHeader>> getSegmentHeaders();

/**
* Stores a segment data in the cache.
* @return A Future object which returns true or false
Expand Down
12 changes: 12 additions & 0 deletions testsrc/main/mondrian/rolap/agg/MockSegmentCache.java
Expand Up @@ -100,5 +100,17 @@ public Boolean call() throws Exception {
executor.submit(task);
return task;
}

public Future<List<SegmentHeader>> getSegmentHeaders() {
FutureTask<List<SegmentHeader>> task =
new FutureTask<List<SegmentHeader>>(
new Callable<List<SegmentHeader>>() {
public List<SegmentHeader> call() throws Exception {
return new ArrayList<SegmentHeader>(cache.keySet());
}
});
executor.submit(task);
return task;
}
}
// End MockSegmentCache.java

0 comments on commit 778fd8e

Please sign in to comment.