3 import java.net.InetAddress;
5 public class LocalHost {
8 private static LocalHost Instance;
9 private static String name;
12 private int socketPort = 1097;
13 private static JaceInterface ref = null;
14 private static JaceSuperNodeInterface refSuperNode = null;
15 @SuppressWarnings("unused")
16 private static String superNodeIP = null;
17 private boolean startedThreads = false;
21 InetAddress ia = InetAddress.getLocalHost();
22 name = ia.getCanonicalHostName();
23 IP = ia.getHostAddress();
24 } catch (Exception e) {
25 System.err.println("Jace Error: Unknown Host: " + e);
29 public int getSocketPort() {
33 public synchronized static LocalHost Instance() {
34 if (Instance == null) {
35 Instance = new LocalHost();
45 * public void setSender(Thread t){ sender=t; } public Thread getSender(){
49 public String resolve(String name) {
52 ip = InetAddress.getByName(name).getHostAddress();
53 // System.out.println("resolve : "+ip);
54 } catch (java.net.UnknownHostException e) {
55 System.err.println("Cannot find IP address of " + name + " :" + e);
60 public synchronized void setPort(int portOfComm) {
64 public int getPort() {
68 public synchronized String getName() {
72 public synchronized String getIP() {
76 public synchronized void setStub(JaceInterface stub) {
80 public synchronized void setSuperNodeStub(JaceSuperNodeInterface stub) {
84 public JaceSuperNodeInterface getSuperNodeStub() {
88 public synchronized void setSuperNodeIP(String IP) {
92 public synchronized JaceInterface getStub() {
96 public synchronized void setStartedThreads(boolean b) {
100 public synchronized boolean getStartedThreads() {
101 return startedThreads;