home *** CD-ROM | disk | FTP | other *** search
- package com.everyware.tango.jas;
-
- import java.io.FileInputStream;
- import java.util.Properties;
-
- public class JAS implements Runnable {
- public boolean isTracing = false;
- private int port = 4000;
- private String hostName;
- private int maxNumBacklog = 50;
- private int serverSocketTimeout = 30;
- private int maxNumThreads = 5;
- private int clientSocketTimeout = 30;
- private int actionTimeout = 30;
- private transient Timer timer;
- public transient TraceManager traceM;
- private transient ThreadManager threadM;
- private transient ConnectionManager connectionM;
-
- public JAS() {
- Properties var1 = new Properties();
-
- try {
- var1.load(new FileInputStream("JAS.properties"));
- String var2;
- if ((var2 = var1.getProperty("isTracing")) != null) {
- switch (Integer.parseInt(var2)) {
- case 0:
- this.setTracing(false);
- break;
- case 1:
- this.setTracing(true);
- break;
- default:
- System.err.println("Invalid properties setting for isTracing: " + var2);
- }
- }
-
- if ((var2 = var1.getProperty("port")) != null) {
- this.setPort(Integer.parseInt(var2));
- }
-
- if ((var2 = var1.getProperty("hostName")) != null) {
- this.setHostName(var2);
- }
-
- if ((var2 = var1.getProperty("maxNumBacklog")) != null) {
- this.setMaxNumBacklog(Integer.parseInt(var2));
- }
-
- if ((var2 = var1.getProperty("serverSocketTimeout")) != null) {
- this.setServerSocketTimeout(Integer.parseInt(var2));
- }
-
- if ((var2 = var1.getProperty("maxNumThreads")) != null) {
- this.setMaxNumThreads(Integer.parseInt(var2));
- }
-
- if ((var2 = var1.getProperty("clientSocketTimeout")) != null) {
- this.setClientSocketTimeout(Integer.parseInt(var2));
- }
-
- if ((var2 = var1.getProperty("actionTimeout")) != null) {
- this.setActionTimeout(Integer.parseInt(var2));
- return;
- }
- } catch (Exception var3) {
- System.err.println("Could not load properties file due to exception: " + var3);
- }
-
- }
-
- public void run() {
- try {
- this.timer = new Timer(this);
- this.timer.start();
- this.traceM = new TraceManager(this);
- if (this.isTracing) {
- this.traceM.trace("JS: TraceManager up");
- }
-
- this.dumpSettings();
- this.threadM = new ThreadManager(this);
- this.threadM.start();
- if (this.isTracing) {
- this.traceM.trace("JS: ThreadManager up");
- }
-
- this.connectionM = new ConnectionManager(this, this.threadM);
- this.connectionM.start();
- if (this.isTracing) {
- this.traceM.trace("JS: ConnectionManager up");
- }
- } catch (Exception var2) {
- if (this.isTracing) {
- this.traceM.trace("JS: caught " + var2);
- }
-
- System.exit(1);
- }
-
- if (this.isTracing) {
- this.traceM.trace("JS: now up and running");
- }
-
- }
-
- public void finalize() {
- if (this.isTracing) {
- this.traceM.trace("JS: Now shutting down");
- }
-
- System.exit(0);
- }
-
- public void setTracing(boolean var1) {
- this.isTracing = var1;
- }
-
- public boolean isTracing() {
- return this.isTracing;
- }
-
- public Timer getTimer() {
- return this.timer;
- }
-
- public void setPort(int var1) {
- this.port = var1;
- }
-
- public int getPort() {
- return this.port;
- }
-
- public void setHostName(String var1) {
- this.hostName = new String(var1);
- }
-
- public String getHostName() {
- return this.hostName;
- }
-
- public void setMaxNumBacklog(int var1) {
- this.maxNumBacklog = var1;
- }
-
- public int getMaxNumBacklog() {
- return this.maxNumBacklog;
- }
-
- public void setServerSocketTimeout(int var1) {
- this.serverSocketTimeout = var1;
- }
-
- public int getServerSocketTimeout() {
- return this.serverSocketTimeout;
- }
-
- public void setMaxNumThreads(int var1) {
- this.maxNumThreads = var1;
- }
-
- public int getMaxNumThreads() {
- return this.maxNumThreads;
- }
-
- public void setClientSocketTimeout(int var1) {
- this.clientSocketTimeout = var1;
- }
-
- public int getClientSocketTimeout() {
- return this.clientSocketTimeout;
- }
-
- public void setActionTimeout(int var1) {
- this.actionTimeout = var1;
- }
-
- public int getActionTimeout() {
- return this.actionTimeout;
- }
-
- public void dumpSettings() {
- this.traceM.trace("JA:\t JAS settings: \n\t isTracing=" + this.isTracing + "\n" + "\t port=" + this.port + "\n" + "\t hostName=" + this.hostName + "\n" + "\t maxNumBacklog=" + this.maxNumBacklog + "\n" + "\t serverSocketTimeout=" + this.serverSocketTimeout + "\n" + "\t maxNumThreads=" + this.maxNumThreads + "\n" + "\t clientSocketTimeout=" + this.clientSocketTimeout + "\n" + "\t actionTimeout=" + this.actionTimeout);
- }
- }
-