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/communication/ClientConnection.java

    r85 r88  
    3232        protected final Map<String, Subscription<?>> subscriptions = new HashMap<>();
    3333
    34         public String getAddress() {
    35                 return address;
    36         }
    37 
    38         public void connect(StateFunctor connectedFunctor) {
     34        /**
     35         * @param connectedFunctor the connectedFunctor to set
     36         */
     37        public void setConnectedFunctor(StateFunctor connectedFunctor) {
     38                this.connectedFunctor = connectedFunctor;
     39        }
     40
     41
     42        protected StateFunctor connectedFunctor;
     43
     44        @Override
     45        protected void joinableStart() {
    3946                try {
    4047                        log.info("connecting to " + address);
     
    4653                        log.info("connected to " + hostName + ":" + port);
    4754                        connected = true;
    48 
    4955                        runThreads();
    5056
     
    5662                        log.error("buffer creation failure");
    5763                        connectedFunctor.call(e);
    58                         close();
    59                 }
    60         }
     64                        // close();
     65                }
     66        }
     67
    6168
    6269        private static abstract class InboundMessage {
     
    149156
    150157
    151         protected final String address;
    152158        protected final String hostName;
    153159        protected final int port;
     
    156162
    157163        public ClientConnection(String address) {
    158                 assert address != null;
    159                 this.address = address;
     164                super(address);
    160165                Matcher matcher = addressPattern.matcher(address);
    161166                if (!matcher.matches()) {
     
    235240        @Override
    236241        public String toString() {
    237                 return address;
     242                return "client connection " + address;
    238243        }
    239244
     
    328333        private int nextQueryId = 0;
    329334
    330         protected void processMessage(InboundMessage inboundMessage) throws Exception {
     335        protected void processMessage(InboundMessage inboundMessage) {
    331336                if (inboundMessage == null) {
    332337                        log.error("failed to use any inbound message");
     
    342347        }
    343348
    344         protected void processEvent(String rest) throws Exception {
     349        protected void processEvent(String rest) {
    345350                Matcher matcher = eventPattern.matcher(rest);
    346351                if (!matcher.matches()) {
     
    359364
    360365
    361         protected void processMessageStartingWith(String line) throws Exception {
     366        protected void processMessageStartingWith(String line) {
    362367                Pair<String, String> command = Strings.splitIntoPair(line, ' ', "\n");
    363368                if (command.first.equals("event")) {
     
    384389
    385390        @Override
    386         protected void receiverThreadRoutine() throws Exception {
     391        protected void receiverThreadRoutine() {
    387392                while (connected) {
    388                         processMessageStartingWith(getLine());
    389                 }
    390         }
     393                        try {
     394                                processMessageStartingWith(getLine());
     395                        } catch (Exception e) {
     396                                break;
     397                        }
     398                }
     399        }
     400
    391401
    392402}
Note: See TracChangeset for help on using the changeset viewer.