source: java/main/src/main/java/com/framsticks/portals/PortalEndpoint.java @ 85

Last change on this file since 85 was 85, checked in by psniegowski, 11 years ago

HIGHLIGHTS:

  • upgrade to Java 7
    • use try-multi-catch clauses
    • use try-with-resources were appropriate
  • configure FindBugs? (use mvn site and then navigate in browser to the report)
    • remove most bugs found
  • parametrize Dispatching environment (Dispatcher, RunAt?) to enforce more control on the place of closures actual call

CHANGELOG:
Rework FavouritesXMLFactory.

FindBugs?. Thread start.

FindBugs?. Minor change.

FindBugs?. Iterate over entrySet.

FindBugs?. Various.

FindBug?.

FindBug?. Encoding.

FindBug?. Final fields.

FindBug?.

Remove synchronization bug in ClientConnection?.

Experiments with findbugs.

Finish parametrization.

Make RunAt? an abstract class.

More changes in parametrization.

More changes in parametrizing dispatching.

Several changes to parametrize tasks.

Rename Runnable to RunAt?.

Add specific framsticks Runnable.

Add JSR305 (annotations).

Add findbugs reporting.

More improvements to ParamBuilder? wording.

Make FramsClass? accept also ParamBuilder?.

Change wording of ParamBuilder?.

Change wording of Request creation.

Use Java 7 exception catch syntax.

Add ScopeEnd? class.

Upgrade to Java 7.

File size: 1.4 KB
Line 
1package com.framsticks.portals;
2
3import com.framsticks.core.Instance;
4import com.framsticks.core.Path;
5import com.framsticks.observers.Endpoint;
6import com.framsticks.util.dispatching.Dispatching;
7import com.framsticks.util.dispatching.Future;
8import com.framsticks.util.Logging;
9import org.apache.log4j.Logger;
10import com.framsticks.util.dispatching.RunAt;
11
12/**
13 * @author Piotr Sniegowski
14 */
15public class PortalEndpoint extends Endpoint {
16
17        private final static Logger log = Logger.getLogger(PortalEndpoint.class.getName());
18
19        public PortalEndpoint() {
20        }
21
22        @Override
23        public Portal getObserver() {
24                return (Portal) observer;
25        }
26
27        @Override
28        public void onRun(Exception e) {
29                assert Dispatching.isThreadSafe();
30
31                super.onRun(e);
32
33                if (e != null) {
34                        return;
35                }
36                final String path = "/simulator/genepools/groups/0/genotypes";
37                instance.invokeLater(new RunAt<Instance>() {
38                        @Override
39                        public void run() {
40                                PortalEndpoint.this.instance.resolve(path, new Future<Path>() {
41                                        @Override
42                                        public void result(Path result, Exception e) {
43                                                Logging.log(log, "resolve", path, e);
44                                        }
45                                });
46                        }
47                });
48        }
49
50        @Override
51        public void onStop(Exception e) {
52        }
53
54
55        /*@Override
56        public void onChange(final Path path) {
57                //if path.getTop().getParam().
58                observer.invokeLater(new Runnable() {
59                        @Override
60                        public void run() {
61                                log.debug("change at " + path);
62                        }
63                });
64        }
65        */
66
67
68
69
70}
Note: See TracBrowser for help on using the repository browser.