void get() {
ref++;
- //dout(0) << "inode.get on " << this << " " << hex << ino << dec << " now " << ref << dendl;
+ dout(0) << "inode.get on " << this << " " << hex << ino << dec << " now " << ref << dendl;
}
void put(int n=1) {
ref -= n;
- //dout(0) << "inode.put on " << this << " " << hex << ino << dec << " now " << ref << dendl;
+ dout(0) << "inode.put on " << this << " " << hex << ino << dec << " now " << ref << dendl;
assert(ref >= 0);
}
argv[argc++] = "CephFSInterface";
argv[argc++] = "-m";
argv[argc++] = "10.0.1.247:6789";
+ argv[argc++] = "--debug_client";
+ argv[argc++] = "20";
ceph_initialize(argc, argv);
ceph_mount();
@Override
public void close() throws IOException {
debug("close:enter");
+ System.gc(); //to run the finalizers on CephInput/OutputStreams
ceph_kill_client();
//for some reason this just hangs, so not doing it for now
debug("close:exit");
private long fileLength;
+ private static boolean debug = true;
+
//private long pos = 0;
//private DataInputStream blockStream;
// Anything? Bueller?
}
+ //Ceph requires that things be closed before it can shutdown,
+ //so closing the IOStream stuff voluntarily is good
+ public void finalize () throws Throwable {
+ try {
+ if (!closed) close();
+ }
+ finally { super.finalize(); }
+ }
public synchronized long getPos() throws IOException {
return ceph_getpos(fileHandle);
@Override
public void close() throws IOException {
+ debug("CephOutputStream.close:enter");
if (closed) {
throw new IOException("Stream closed");
}
if (result != 0) {
throw new IOException("Close failed!");
}
-
closed = true;
+ debug("CephOutputStream.close:exit");
}
/**
throw new IOException("Mark not supported");
}
+ private void debug(String out) {
+ if (debug) System.out.println(out);
+ }
}
private byte[] outBuf;
+ private static boolean debug = true;
+
//private List<Block> blocks = new ArrayList<Block>();
//private Block nextBlock;
closed = false;
}
+ //Ceph requires that things be closed before it can shutdown,
+ //so closing the IOStream stuff voluntarily is good
+ public void finalize () throws Throwable {
+ try {
+ if (!closed) close();
+ }
+ finally { super.finalize();}
+ }
+
// possibly useful for the local copy, write later thing?
// keep it around for now
private File newBackupFile() throws IOException {
@Override
public synchronized void close() throws IOException {
+ debug("CephOutputStream.close:enter");
if (closed) {
throw new IOException("Stream closed");
}
}
closed = true;
-
+ debug("CephOutputStream.close:exit");
}
+
+ private void debug(String out) {
+ if (debug) System.out.println(out);
+ }
}