-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathRunnableLookup.java
More file actions
47 lines (43 loc) · 1.32 KB
/
RunnableLookup.java
File metadata and controls
47 lines (43 loc) · 1.32 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
package com.company;
import java.io.FileOutputStream;
import java.io.PipedInputStream;
/**
* Created by Luke Taylor on 4/15/17.
*/
public class RunnableLookup implements Runnable {
private Thread t;
private String tname;
private int time = 0;
RunnableLookup(String name) {
tname = name;
System.out.println("Creating thread " + tname);
}
public void run() {
//try {
System.out.println(tname + " searching for pw....");
time = 0;
Main m = new Main(tname);
String s = m.toString();
FileOutputStream fos = null;
try {
fos = new FileOutputStream("/tmp/myfifo2");
System.out.println("Writing to myfifo2");
//String s="{\"time\": " + time + ", \"cost\": " + tname.length() + " }";
fos.write(s.getBytes());
fos.close();
} catch(Exception e) {
e.printStackTrace();
}
//} /catch(Exception e) {
// System.out.println(tname + " interrupted...");
//}
System.out.println(tname + " found pw val");
}
public void start() {
System.out.println("Starting " + tname);
if(t == null) {
t = new Thread(this, tname);
t.start();
}
}
}