Ignore:
Timestamp:
06/30/13 12:48:20 (11 years ago)
Author:
psniegowski
Message:

HIGHLIGHTS:

  • loading f0 schema with XmlLoader?
  • use XmlLoader? to load configuration
  • introduce unified fork-join model of various entities

(Instances, Connections, GUI Frames, etc.),
all those entities clean up gracefully on
shutdown, which may be initialized by user
or by some entity

  • basing on above, simplify several organizing classes

(Observer, main class)

(to host native frams server process from Java level)

CHANGELOG:
Remove redundant Observer class.

Clean up in AbstractJoinable?.

Update ExternalProcess? class to changes in joining model.

Another sweep through code with FindBugs?.

Find bug with not joining RemoteInstance?.

Joining almost works.

Much improved joining model.

More improvement to joining model.

Add logging messages around joinable operations.

Rename methods in AbstractJoinable?.

Improve Joinable.

Rewrite of entity structure.

More simplifications with entities.

Further improve joinables.

Let Frame compose from JFrame instead of inheriting.

Add join classes.

Improvements of closing.

Add Builder interface.

Add FramsServerTest?.xml

FramsServer? may be configured through xml.

Make Framsticks main class an Observer of Entities.

Make Observer a generic type.

Remove variables regarding to removed endpoint.

Simplify observer (remove endpoints).

More changes to Observer and Endpoint.

Minor improvements.

Add OutputListener? to ExternalProcess?.

Improve testing of ExternalProcess?.

Add ExternalProcess? runner.

Rename the Program class to Framsticks.

Migrate Program to use XmlLoader? configuration.

First steps with configuration using XmlLoader?.

Fix several bugs.

Move all f0 classes to apriopriate package.

XmlLoader? is able to load Schema.

XmlLoader? is loading classes and props.

Add GroupBuilder?.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • java/main/src/main/java/com/framsticks/util/dispatching/Thread.java

    r85 r88  
    55import java.util.LinkedList;
    66import java.util.ListIterator;
     7
     8import javax.annotation.OverridingMethodsMustInvokeSuper;
     9
     10import com.framsticks.params.annotations.ParamAnnotation;
    711import com.framsticks.util.dispatching.RunAt;
    812
     
    1014 * @author Piotr Sniegowski
    1115 */
    12 public class Thread<C> implements Dispatcher<C> {
     16public class Thread<C> extends AbstractJoinable implements Dispatcher<C> {
    1317
    1418        private static final Logger log = Logger.getLogger(Thread.class.getName());
     
    2731        }
    2832
    29         public Thread(String s) {
    30                 this();
    31                 thread.setName(s);
    32                 // thread.start();
     33        @OverridingMethodsMustInvokeSuper
     34        protected void firstTask() {
    3335        }
    3436
    35         public Thread(String s, java.lang.Thread thread) {
     37        public Thread(java.lang.Thread thread) {
    3638                this.thread = thread;
    37                 thread.setName(s);
    3839        }
    3940
    40         public Thread<C> start() {
     41        @Override
     42        protected void joinableStart() {
    4143                thread.start();
    42                 return this;
    4344        }
    4445
     
    4950
    5051        protected void routine() {
     52                log.debug("starting thread " + this);
     53                firstTask();
    5154                while (!java.lang.Thread.interrupted()) {
    5255                        Task<? extends C> task;
     
    7679                        } catch (Exception e) {
    7780                                log.error("error in thread: " + e);
    78                                 e.printStackTrace();
    7981                        }
    8082                }
     83                log.debug("finishing thread " + this);
     84                finish();
    8185        }
    8286
     
    124128        }
    125129
    126         public void interrupt() {
     130        @Override
     131        protected void joinableInterrupt() {
    127132                thread.interrupt();
    128133        }
    129134
    130         public void join() throws InterruptedException {
    131                 thread.join();
     135        @Override
     136        protected void joinableJoin() throws InterruptedException {
     137                thread.join(500);
     138                log.debug("joined " + this);
    132139        }
    133140
     141        @ParamAnnotation
    134142        public void setName(String name) {
    135143                thread.setName(name);
     144        }
    136145
     146        @ParamAnnotation
     147        public String getName() {
     148                return thread.getName();
    137149        }
    138150
     
    140152                return java.lang.Thread.interrupted();
    141153        }
     154
     155        @Override
     156        public String toString() {
     157                return getName();
     158        }
     159
     160        @Override
     161        protected void joinableFinish() {
     162        }
     163
    142164}
Note: See TracChangeset for help on using the changeset viewer.