4 import java.io.IOException;
6 public class Kticket implements Runnable {
10 boolean dostop = false;
14 Kticket(String name, String instance, String realm) {
16 this.instance = instance;
18 r = Runtime.getRuntime();
19 renewTime = new Date();
25 Date now = new Date();
26 if (now.after(renewTime)) {
28 renewTime = new Date(System.currentTimeMillis() + 6*3600*1000L); // 6 hours
31 Thread.sleep(30*1000L); // Sleep for 30 seconds
32 } catch (InterruptedException i) {
33 // Nothing to be done about it
41 m = Moira.getInstance("MOIRA.MIT.EDU"); // Host doesn't matter, we won't be making a connection!
42 // We are getting a Moira instance so that no
43 // other thread will have one and we can safely
44 // modify the ticket file
45 Process p = r.exec("/usr/athena/bin/kinit -k -t /mit/jis/javahacking/moira/KEY " + name + "/" + instance + "@" + realm);
47 } catch (IOException e) {
49 } catch (InterruptedException i) {
51 m.done(); // Release Moira object
55 public void destroy() {
58 Process p = r.exec("/usr/athena/bin/kdestroy");
60 } catch (IOException e) {
62 } catch (InterruptedException i) {