We have a program TimerCaller (class) that calls other program
(classes).
TimerCaller just extends the thread object to repeatedly call a bunch
of program (classes) in the thread (well if I got it right... see
code bellow)
We have this other program (SendItUrl.class) that uses truststore and
keystore to open an HTTPS connection.
SendItUrl works perfectly on its own. The point is that when it's
called from TimerCaller, it seems that the truststore used is
different than the one use when launch byitself (command line).
Can anybody confirm this : the truststore used is the one of the
parent/calling thread ?
What is the solution, given we need to use the TimerCaller program...
BTW if you know any site related to HTTPS (server & client
autentication) and JAVA , even better : if it has some good
codes/tutorials, I'd appreciate that!! :-)
<code -- TimerCaller.class-- >
import java.lang.Long;
public class InvoiceTimer extends Thread {
private long delai;
private long delmin;
public InvoiceTimer(long delai) {
this.delai=delai;
this.delmin=delai/60000;
}
public void run() {
try {
while(true) {
MyProg1 sendIt1 = new MyProg1();
sendIt1.sendIt();
MyProg2 sendIt2 = new MyProg2();
sendIt2.sendIt();
MyProg1 sendIt1 = new MyProg1();
sendIt1.sendIt();
System.out.println("start waiting for " + delmin + " minuts");
System.out.println("");
Thread.sleep(delai);
}
}
catch (InterruptedException e) {
System.out.println(e);
}
}
public static void main(String args[]) {
Long del = new Long(args[0]);
InvoiceTimer invTimer = new InvoiceTimer(del.longValue());
invTimer.start();
}
}