[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Gzz-commits] gzz/lava/gzz/storm BlockListener.java StormPool...
From: |
Benja Fallenstein |
Subject: |
[Gzz-commits] gzz/lava/gzz/storm BlockListener.java StormPool... |
Date: |
Wed, 08 Jan 2003 22:45:06 -0500 |
CVSROOT: /cvsroot/gzz
Module name: gzz
Changes by: Benja Fallenstein <address@hidden> 03/01/08 22:45:06
Modified files:
lava/gzz/storm : BlockListener.java StormPool.java
lava/gzz/storm/impl: AbstractLocalPool.java
Log message:
More Storm speccing. I think the interfaces are ready now (do have a
look ;) ).
CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/lava/gzz/storm/BlockListener.java.diff?tr1=1.1&tr2=1.2&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/lava/gzz/storm/StormPool.java.diff?tr1=1.11&tr2=1.12&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/lava/gzz/storm/impl/AbstractLocalPool.java.diff?tr1=1.3&tr2=1.4&r1=text&r2=text
Patches:
Index: gzz/lava/gzz/storm/BlockListener.java
diff -u gzz/lava/gzz/storm/BlockListener.java:1.1
gzz/lava/gzz/storm/BlockListener.java:1.2
--- gzz/lava/gzz/storm/BlockListener.java:1.1 Sun Dec 22 22:20:58 2002
+++ gzz/lava/gzz/storm/BlockListener.java Wed Jan 8 22:45:06 2003
@@ -1,5 +1,5 @@
/*
-JobListener.java
+BlockListener.java
*
* Copyright (c) 2002, Benja Fallenstein
*
Index: gzz/lava/gzz/storm/StormPool.java
diff -u gzz/lava/gzz/storm/StormPool.java:1.11
gzz/lava/gzz/storm/StormPool.java:1.12
--- gzz/lava/gzz/storm/StormPool.java:1.11 Sun Dec 22 22:20:58 2002
+++ gzz/lava/gzz/storm/StormPool.java Wed Jan 8 22:45:06 2003
@@ -57,15 +57,40 @@
* If <code>listener</code> is given, it is informed when
* the block has either been loaded, or the pool
* has given up on loading it.
- * XXX
+ * <p>
+ * If the block is already available locally, it will be returned.
+ * The <code>BlockListener</code> will not be called at all.
+ * If the block must be loaded, <code>null</code> is returned
+ * (no exception is thrown). If the block is known not to be
+ * available, a <code>FileNotFoundException</code> is thrown.
+ * <p>
+ * After the block has been loaded, it will be kept locally
+ * for some time, but no guarantees are made as to how long.
+ * It is reasonable to <code>request()</code> a block,
+ * doing nothing if <code>null</code> is returned,
+ * and when notification comes in that the block
+ * has been loaded, repeat the whole procedure.
+ * If the block has already been uncached at the time
+ * of the second <code>request()</code> and we get
+ * another chance.
+ * <p>
+ * We could make it so that the <code>BlockListener</code>
+ * is always called, even when we can return the block
+ * immediately. However it is easier to simulate that
+ * behavior on top of the current one than it would be
+ * to simulate the current behavior on top of that one,
+ * and both are expected to be needed.
+ * @throws FileNotFoundException if the block is not found
+ * in the pool.
*/
- void request(BlockId id, BlockListener listener);
+ Block request(BlockId id, BlockListener listener) throws IOException;
/** Load a block from the network, if it is not available locally.
- * XXX
* Equivalent to <code>request(id, null)</code>.
+ * @throws FileNotFoundException if the block is not found
+ * in the pool.
*/
- void request(BlockId id);
+ Block request(BlockId id) throws IOException;
/** Add a block to this pool.
* The data in the block is checked by this class to assure
Index: gzz/lava/gzz/storm/impl/AbstractLocalPool.java
diff -u gzz/lava/gzz/storm/impl/AbstractLocalPool.java:1.3
gzz/lava/gzz/storm/impl/AbstractLocalPool.java:1.4
--- gzz/lava/gzz/storm/impl/AbstractLocalPool.java:1.3 Mon Dec 30 08:49:48 2002
+++ gzz/lava/gzz/storm/impl/AbstractLocalPool.java Wed Jan 8 22:45:06 2003
@@ -35,15 +35,13 @@
super(indexTypes);
}
- public void request(BlockId id) {}
+ public Block request(BlockId id) throws IOException {
+ return get(id);
+ }
- public void request(BlockId id, BlockListener listener) {
- try {
- Block b = get(id);
- listener.success(b);
- } catch(IOException e) {
- listener.failure(id, e);
- }
+ public Block request(BlockId id, BlockListener listener)
+ throws IOException {
+ return get(id);
}
// XXX temporary, until subclasses have implementations
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Gzz-commits] gzz/lava/gzz/storm BlockListener.java StormPool...,
Benja Fallenstein <=