- start() is now synchronous, a new start(boolean wait) is there
* Start the server (listen on the network for new connections).
* <p>
* Can only be called once.
* Start the server (listen on the network for new connections).
* <p>
* Can only be called once.
+ * <p>
+ * This call is synchronous.
+ start(true);
+ }
+
+ /**
+ * Start the server (listen on the network for new connections).
+ * <p>
+ * Can only be called once.
+ *
+ * @param wait
+ * TRUE for synchronous, FALSE for asynchronous
+ */
+ public void start(boolean wait) {
boolean ok = false;
synchronized (lock) {
if (!started && ss != null) {
boolean ok = false;
synchronized (lock) {
if (!started && ss != null) {
- started = true;
- new Thread(this).start();
+ started = true;
+ if (!wait) {
+ new Thread(this).start();
+ }
}
}
if (ok) {
tracer.trace(name + ": server started on port " + port);
}
}
if (ok) {
tracer.trace(name + ": server started on port " + port);
+ if (wait) {
+ run();
+ }
} else if (ss == null) {
tracer.error(name + ": cannot start server on port " + port
+ ", it has already been used");
} else if (ss == null) {
tracer.error(name + ": cannot start server on port " + port
+ ", it has already been used");
// TODO: remove
server.setTraceHandler(new TraceHandler(true, true, true));
// TODO: remove
server.setTraceHandler(new TraceHandler(true, true, true));
try {
new ConnectActionClient(null, server.getPort(), ssl) {
try {
new ConnectActionClient(null, server.getPort(), ssl) {
try {
new ConnectActionClient(null, server.getPort(), ssl) {
try {
new ConnectActionClient(null, server.getPort(), ssl) {
try {
new ConnectActionClient(null, server.getPort(), ssl) {
try {
new ConnectActionClient(null, server.getPort(), ssl) {
try {
new ConnectActionClient(null, server.getPort(), ssl) {
try {
new ConnectActionClient(null, server.getPort(), ssl) {