«..»:,,. ,,.
1. .,. SQL. .-.:, 2006. - 416.
2. - ...-.:, 1999. - 336
3. . Java. . Java SE 7=Java 7: The Complete Reference.- 8 -.-.:, 2012. - 1104.
4.,.,,. IntelliJ IDEA. Java ().- 1 -.-.: BHV.- 800.
5.Wikipedia.org [].- URL:
package com.gmail.dosofredriver.ajax.serviceserver;com.gmail.dosofredriver.ajax.serviceserver.server.TCPServer;com.gmail.dosofredriver.ajax.serviceserver.service.worker.Worker;com.gmail.dosofredriver.ajax.serviceserver.util.configure.Configurator;com.gmail.dosofredriver.ajax.serviceserver.util.logger.ServerLogger;com.gmail.dosofredriver.ajax.serviceserver.util.view.ConsoleView;com.gmail.dosofredriver.ajax.serviceserver.util.view.ViewInterface;java.io.BufferedReader;java.io.IOException;java.io.InputStreamReader;java.util.logging.Level;
/ **
* Date: 06.03.13
* Time: 22:54
*
* @ author DoSOfRR
* / class Commander {static final String DEFAULT_CONFIG_PATH=«config / config.txt»; String configPath=DEFAULT_CONFIG_PATH; ViewInterface view; ServerLogger logger; TCPServer server; Thread serverThread; Thread workerThread; Worker worker; boolean autoStart=false; boolean isLogged=false; Commander (ViewInterface view, String ... args) {. view=view; (args);
} void init (String ... args) {{(args); config=new Configurator (configPath);=config.getConfiguredLogger ();=config.getConfiguredServer ();=config.getConfiguredWorker();.setLogger(logger);.setLogger(logger);.setFilter(config.getConfiguredFilter());(logger !=Null) {= true;. SetLogger (logger);
} (autoStart) {. startServer ();
}
} catch (Exception e) {. err.println («An error occupied while initializing server: n» + e);
}
} void parseArgs (String ... args) {(String arg: args) {value=null; type; (arg.contains («:»)) {= argbstring ( 0, arg.indexOf («:»));=argbstring (arg.indexOf («:») +1, arg.length ());
} else {= arg;
} (type) {«configpath» : ConfigPath=«value»; break; «autostart» : AutoStart=true; break;: {. out.println («Option» + value + «is not supported!");. exit (0);
}
}
}
} void startServer () {= new Thread (new Runnable () {
@ Overridevoid run () {. start ();
}
});=new Thread (new Runnable () {
@ Overridevoid run () {{. start ();// Todo ex
} catch (InterruptedException e) {. log (Level.SEVERE, «Can not start worker!», e);
}
}
});. setDaemon (true);. start ();. setDaemon (true);. start ();
} void stopServer () {{. stop ();. interrupt ();. stop ();. interrupt ();
} catch (InterruptedException e) {. log (Level.WARNING, «An error occupied while stopping server», e);
}
} boolean deploy () {false;
}
/ *
* This is...