Hi,
i'm currently building a standalone application which uses domino jna for replicating local DBs and i experienced that i'm not able to open a database until i open up the notes client. Is this really necessary or i'm doing the session initialization wrong? Are there multiple ways to create a notes session maybe with different consequences?
here the simplified code:
public boolean replicate(Request newReplication) {
final boolean ret = false;
final List<NotesReplicationStats> replicationStats = new ArrayList<>();
EnumSet<ReplicateOption> replOptions = EnumSet.noneOf(ReplicateOption.class);
replOptions.add(ReplicateOption.RECEIVE_NOTES);
replOptions.add(ReplicateOption.SEND_NOTES);
replOptions.add(ReplicateOption.CLOSE_SESSION);
try {
//initial Notes/Domino access for current thread (running single-threaded here)
NotesThread.sinitThread();
//launch run method within runWithAutoGC block to let it collect/dispose C handles
NotesGC.runWithAutoGC(new Callable<Object>() {
public Object call() throws Exception {
boolean dontSetEnvVar = true;
IDUtils.switchToId(notesId, notesIdPass, dontSetEnvVar);
for (Job job : newReplication.getJobs()) {
try {
if( NotesDatabase.exists("", job.getPath()) ) { //Check if DB exists in local (returns false if notes client isn't open)
NotesDatabase dbNames = new NotesDatabase("", job.getPath(), "");
NotesReplicationStats nrs = dbNames.replicateWithServer(job.getServer(), replOptions, 10);
dbNames.recycle();
} else {
logger.error("couldn't open DB");
}
} catch (Exception e) {
logger.error("couldn't open DB");
}
}
return new Object();
}
});
} catch (Exception e) {
throw new RuntimeException(e);
} finally {
//terminate Notes/Domino access for current thread
NotesThread.stermThread();
}
return true;
}
I'm pretty sure i'm doing something wrong here.
Hi,
i'm currently building a standalone application which uses domino jna for replicating local DBs and i experienced that i'm not able to open a database until i open up the notes client. Is this really necessary or i'm doing the session initialization wrong? Are there multiple ways to create a notes session maybe with different consequences?
here the simplified code:
I'm pretty sure i'm doing something wrong here.