Ignore:
Timestamp:
07/04/13 20:29:50 (11 years ago)
Author:
psniegowski
Message:

HIGHLIGHTS:

  • cleanup Instance management
    • extract Instance interface
    • extract Instance common algorithms to InstanceUtils?
  • fix closing issues: Ctrl+C or window close button

properly shutdown whole program

by Java Framsticks framework

  • fix parsing and printing of all request types
  • hide exception passing in special handle method of closures
    • substantially improve readability of closures
    • basically enable use of exception in asynchronous closures

(thrown exception is transported back to the caller)

  • implement call request on both sides

CHANGELOG:
Further improve calling.

Improve instance calling.

Calling is working on both sides.

Improve exception handling in testing.

Waiters do not supercede other apllication exception being thrown.

Finished parsing and printing of all request types (with tests).

Move implementation and tests of request parsing to Request.

Add tests for Requests.

Improve waits in asynchronours tests.

Extract more algorithms to InstanceUtils?.

Extract Instance.resolve to InstanceUtils?.

Improve naming.

Improve passing exception in InstanceClient?.

Hide calling of passed functor in StateCallback?.

Hide Exception passing in asynchronous closures.

Hide exception passing in Future.

Make ResponseCallback? an abstract class.

Make Future an abstract class.

Minor change.

Move getPath to Path.to()

Move bindAccess to InstanceUtils?.

Extract common things to InstanceUtils?.

Fix synchronization bug in Connection.

Move resolve to InstanceUtils?.

Allow names of Joinable to be dynamic.

Add support for set request server side.

More fixes in communication.

Fix issues with parsing in connection.

Cut new line characters when reading.

More improvements.

Migrate closures to FramsticksException?.

Several changes.

Extract resolveAndFetch to InstanceUtils? algorithms.

Test resolving and fetching.

More fixes with function signature deduction.

Do not print default values in SimpleAbstractAccess?.

Add test of FramsClass? printing.

Improve FramsticksException? messages.

Add explicit dispatcher synchronization feature.

Rework assertions in tests.

Previous solution was not generic enough.

Allow addition of joinables to collection after start.

Extract SimulatorInstance? from RemoteInstance?.

Remove PrivateJoinableCollection?.

Improve connections.

Move shutdown hook to inside the Monitor.

It should work in TestNG tests, but it seems that
hooks are not called.

In ServerTest? client connects to testing server.

Move socket initialization to receiver thread.

Add proper closing on Ctrl+C (don't use signals).

Fix bugs with server accepting connections.

Merge Entity into Joinable.

Reworking ServerInstance?.

Extract more algorithm to InstanceUtils?.

Extract some common functionality from AbstractInstance?.

Functions were placed in InstanceUtils?.

Hide registry of Instance.

Use ValueParam? in Instance interface.

Minor change.

Extract Instance interface.

Old Instance is now AbstractInstance?.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • java/main/src/main/java/com/framsticks/gui/TreeNode.java

    r90 r96  
    55import com.framsticks.communication.util.LoggingStateCallback;
    66import com.framsticks.core.Instance;
     7import com.framsticks.core.InstanceUtils;
    78import com.framsticks.core.ListChange;
    89import com.framsticks.core.Path;
     
    1516import com.framsticks.remote.*;
    1617import com.framsticks.util.lang.Casting;
     18import com.framsticks.util.lang.Holder;
    1719import com.framsticks.util.swing.TooltipConstructor;
    1820import com.framsticks.util.dispatching.Future;
     21import com.framsticks.util.AbstractStateFunctor;
    1922import com.framsticks.util.Logging;
    20 import com.framsticks.util.StateFunctor;
    2123import org.apache.log4j.Logger;
    2224import com.framsticks.util.dispatching.RunAt;
     
    2931import static com.framsticks.util.lang.Containers.filterInstanceof;
    3032import com.framsticks.util.swing.TreeNodeUtils;
     33import static com.framsticks.core.InstanceUtils.*;
    3134
    3235/**
     
    7376                assert p.getInstance().isActive();
    7477                log.debug("fetching: " + p);
    75                 p.getInstance().fetchValues(p, new StateFunctor() {
    76                         @Override
    77                         public void call(Exception e) {
    78                                 //TODO removing should stay here
     78                p.getInstance().fetchValues(p, new AbstractStateFunctor() {
     79                        @Override
     80                        public void call() {
    7981                                // reactForFetchResult(p, e);
    8082                        }
     
    140142                assert p.getInstance().isActive();
    141143                log.debug("updating children of " + this);
    142                 AccessInterface access = p.getInstance().bindAccess(p.getTop());
     144                AccessInterface access = InstanceUtils.bindAccess(p.getInstance(), p.getTop());
    143145                if (access == null) {
    144146                        return;
     
    199201                                        return;
    200202                                }
    201                                 p.getInstance().resolve(updated, new Future<Path>() {
     203                                p.getInstance().resolve(updated, new Future<Path>(Logging.logger(log, "resolve and select", TreeNode.this)) {
    202204                                        @Override
    203                                         public void result(final Path result, Exception e) {
    204                                                 if (Logging.log(log, "resolve and select", TreeNode.this, e)) {
    205                                                         return;
    206                                                 }
    207 
     205                                        protected void result(Path result) {
    208206                                                fetch(result);
    209207                                                postUpdatePath(result);
     
    231229                        return;
    232230                }
    233                 AccessInterface access = p.getInstance().bindAccess(p);
    234                 if (access == null) {
    235                         return;
    236                 }
     231                AccessInterface access = InstanceUtils.bindAccess(p);
    237232
    238233                final String tooltip = new TooltipConstructor()
     
    309304                        @Override
    310305                        public void run() {
    311                                 AccessInterface access = p.getInstance().bindAccess(p);
     306                                AccessInterface access = InstanceUtils.bindAccess(p);
    312307                                panel.pullValuesFromLocalToUser(access);
    313308
     
    501496                        return;
    502497                }
    503                 final Map<ValueControl, Object> changes = localChanges;
     498                Map<ValueControl, Object> changes = localChanges;
    504499                localChanges = null;
    505                 instanceAtFrame.getInstance().dispatch(new RunAt<Instance>() {
    506                         @Override
    507                         public void run() {
    508                                 for (Map.Entry<ValueControl, Object> e : changes.entrySet()) {
    509                                         final ValueControl key = e.getKey();
    510                                         final Path p = path;
    511                                         instanceAtFrame.getInstance().storeValue(p, e.getKey().getParam(), e.getValue(), new StateFunctor() {
     500                final Holder<Integer> counter = new Holder<>(changes.size());
     501                final Path p = path;
     502
     503                for (Map.Entry<ValueControl, Object> e : localChanges.entrySet()) {
     504                        storeValue(p, e.getKey().getParam(), e.getValue(), new AbstractStateFunctor() {
     505                                @Override
     506                                public void call() {
     507                                        counter.set(counter.get() - 1);
     508                                        if (counter.get() != 0) {
     509                                                return;
     510                                        }
     511                                        log.debug("applied changes for: " + p);
     512                                        frame.dispatch(new RunAt<Frame>() {
    512513                                                @Override
    513                                                 public void call(Exception e) {
    514                                                         changes.remove(key);
    515                                                         if (!changes.isEmpty()) {
    516                                                                 return;
    517                                                         }
    518                                                         log.debug("applied changes for: " + p);
    519                                                         frame.dispatch(new RunAt<Frame>() {
    520                                                                 @Override
    521                                                                 public void run() {
    522                                                                         fillPanelWithValues();
    523                                                                 }
    524                                                         });
     514                                                public void run() {
     515                                                        fillPanelWithValues();
    525516                                                }
    526517                                        });
    527518                                }
    528                         }
    529                 });
     519                        });
     520                }
    530521        }
    531522}
Note: See TracChangeset for help on using the changeset viewer.