}
}
}
private void migrate(ObjectContainer container) {
CheckpointLock lock = null;
boolean success;
FCPPersistentRoot oldRoot;
try {
lock = clientLayerPersister.lock();
oldRoot = FCPPersistentRoot.load(node.nodeDBHandle, container);
success = migrateGlobalQueueFromOldDatabase(container, oldRoot);
System.out.println(success ? "Successfully migrated global queue" : "Tried to migrate global queue, may have lost some requests");
} catch (PersistenceDisabledException e) {
Logger.error(this, "Cannot migrate as persistence disabled...");
// Try again next time...
return; // Don't GC persistent-temp.
} catch (Throwable t) {
// Paranoia. Have seen something like this... make it more obvious and make plugins still work...
System.err.println("Unable to migrate from old database: "+t);
t.printStackTrace();
Logger.error(this, "Failed migrating from old database: "+t, t);
return; // Something went seriously wrong, likely a bug. Don't delete.
} finally {
if(lock != null)
lock.unlock(false, NativeThread.currentThread().getPriority());
}
// The global queue is the important bit. Write the progress so far.
System.out.println("Writing migrated global queue");
try {
clientLayerPersister.waitAndCheckpoint();
} catch (PersistenceDisabledException e1) {
// Shutting down?
return;
}
try {
lock = clientLayerPersister.lock();
success = migrateApplicationQueuesFromOldDatabase(container, oldRoot);
if(success)
System.out.println("Successfully loaded any old per-application queues");
else
System.out.println("Failed to load some per-application queues");
} catch (PersistenceDisabledException e) {
Logger.error(this, "Cannot migrate as persistence disabled...");
// Try again next time...
return; // Don't GC persistent-temp.
} catch (Throwable t) {
// Paranoia. Have seen something like this... make it more obvious and make plugins still work...
System.err.println("Unable to migrate from old database: "+t);
t.printStackTrace();
Logger.error(this, "Failed migrating from old database: "+t, t);
return; // Something went seriously wrong, likely a bug. Don't delete.
} finally {
if(lock != null)
lock.unlock(false, NativeThread.currentThread().getPriority());
}
System.out.println("Writing migrated application queues");
// Write now as well.
try {