1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46
|
/* Glazed Lists (c) 2003-2006 */
/* http://publicobject.com/glazedlists/ publicobject.com,*/
/* O'Dell Engineering Ltd.*/
package ca.odell.glazedlists.impl.pmap;
// NIO is used for CTP
import java.io.IOException;
import java.util.logging.Logger;
/**
* Removes a chunk from the persistent map.
*
* @author <a href="mailto:jesse@swank.ca">Jesse Wilson</a>
*/
class RemoveChunk implements Runnable {
/** logging */
private static Logger logger = Logger.getLogger(RemoveChunk.class.toString());
/** the host map */
private final PersistentMap persistentMap;
/** the value to erase */
private final Chunk chunk;
/**
* Create a new RemoveChunk.
*/
public RemoveChunk(PersistentMap persistentMap, Chunk chunk) {
this.persistentMap = persistentMap;
this.chunk = chunk;
}
/**
* Removes the chunk by marking it off.
*/
public void run() {
try {
chunk.delete();
logger.info("Successfully removed value for key \"" + chunk.getKey() + "\"");
} catch(IOException e) {
persistentMap.fail(e, "Failed to write to file " + persistentMap.getFile().getPath());
}
}
}
|