Ignore:
Timestamp:
07/06/13 03:51:11 (11 years ago)
Author:
psniegowski
Message:

HIGHLIGHTS:

  • add proper exception passing between communication sides:

if exception occur during handling client request, it is
automatically passed as comment to error response.

it may be used to snoop communication between peers

  • fix algorithm choosing text controls in GUI
  • allow GUI testing in virtual frame buffer (xvfb)

FEST had some problem with xvfb but workaround was found

supports tab-completion based on requests history

CHANGELOG:
Further improve handling of exceptions in GUI.

Add StatusBar? implementing ExceptionResultHandler?.

Make completion processing asynchronous.

Minor changes.

Improve completion in console.

Improve history in InteractiveConsole?.

First working version of DirectConsole?.

Minor changes.

Make Connection.address non final.

It is more suitable to use in configuration.

Improvement of consoles.

Improve PopupMenu? and closing of FrameJoinable?.

Fix BrowserTest?.

Found bug with FEST running under xvfb.

JButtonFixture.click() is not working under xvfb.
GuiTest? has wrapper which uses JButton.doClick() directly.

Store CompositeParam? param in TreeNode?.

Simplify ClientSideManagedConnection? connecting.

There is now connectedFunctor needed, ApplicationRequests? can be
send right after creation. They are buffered until the version
and features are negotiated.

Narow down interface of ClientSideManagedConnection?.

Allow that connection specialization send only
ApplicationRequests?.

Improve policy of text control choosing.

Change name of Genotype in BrowserTest?.

Make BrowserTest? change name of Genotype.

Minor change.

First working draft of TrackConsole?.

Simplify Consoles.

More improvements with gui joinables.

Unify initialization on gui joinables.

More rework of Frame based entities.

Refactorize structure of JFrames based entities.

Extract GuiTest? from BrowserBaseTest?.

Reorganize Console classes structure.

Add Collection view to JoinableCollection?.

Configure timeout in testing.

Minor changes.

Rework connections hierarchy.

Add Mode to the get operation.

Make get and set in Tree take PrimitiveParam?.

Unify naming of operations.

Make RunAt? use the given ExceptionHandler?.

It wraps the virtual runAt() method call with
try-catch passing exception to handler.

Force RunAt? to include ExceptionHandler?.

Improve ClientAtServer?.

Minor change.

Another sweep with FindBugs?.

Rename Instance to Tree.

Minor changes.

Minor changes.

Further clarify semantics of Futures.

Add FutureHandler?.

FutureHandler? is refinement of Future, that proxifies
exception handling to ExceptionResultHandler? given
at construction time.

Remove StateFunctor? (use Future<Void> instead).

Make Connection use Future<Void>.

Unparametrize *ResponseFuture?.

Remove StateCallback? not needed anymore.

Distinguish between sides of ResponseFuture?.

Base ResponseCallback? on Future (now ResponseFuture?).

Make asynchronous store taking Future for flags.

Implement storeValue in ObjectInstance?.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • java/main/src/main/java/com/framsticks/diagnostics/Diagnostics.java

    r96 r97  
    1111import org.apache.log4j.Logger;
    1212
    13 import com.framsticks.core.AbstractInstanceListener;
    14 import com.framsticks.core.Instance;
     13import com.framsticks.core.AbstractTreeListener;
     14import com.framsticks.core.Tree;
    1515import com.framsticks.core.Path;
    1616import com.framsticks.dumping.PrintWriterSink;
     
    1919import com.framsticks.remote.RecursiveFetcher;
    2020import com.framsticks.util.FramsticksException;
    21 import com.framsticks.util.Logging;
    2221import com.framsticks.util.PeriodicTask;
    23 import com.framsticks.util.StateFunctor;
     22import com.framsticks.util.dispatching.ExceptionResultHandler;
     23import com.framsticks.util.dispatching.FutureHandler;
    2424import com.framsticks.util.dispatching.JoinableCollection;
     25import com.framsticks.util.dispatching.ThrowExceptionHandler;
    2526import com.framsticks.util.io.Encoding;
    2627
     
    2829 * @author Piotr Sniegowski
    2930 */
    30 public class Diagnostics extends JoinableCollection<Instance> {
     31public class Diagnostics extends JoinableCollection<Tree> {
    3132        private static final Logger log = Logger.getLogger(Diagnostics.class);
    3233
     
    4142
    4243
     44
    4345        @Override
    4446        @AutoAppendAnnotation
    45         public void add(final Instance instance) {
    46                 super.add(instance);
     47        public void add(final Tree tree) {
     48                super.add(tree);
    4749
    48                 instance.addListener(new AbstractInstanceListener() {
     50                tree.addListener(new AbstractTreeListener() {
    4951                        @Override
    5052                        public void onRun(Exception e) {
     
    5456
    5557                                if (dumpsInterval != null) {
    56                                         new PeriodicTask<Instance>(instance, dumpsInterval * 1000) {
     58                                        new PeriodicTask<Tree>(ThrowExceptionHandler.getInstance(), tree, dumpsInterval * 1000) {
     59                                                protected final ExceptionResultHandler repeater = new ExceptionResultHandler() {
     60
     61                                                        @Override
     62                                                        public void handle(FramsticksException exception) {
     63                                                                log.error("caught error during diagnostics fetching (repeating): " + exception);
     64                                                                again();
     65                                                        }
     66
     67                                                };
    5768                                                @Override
    58                                                 public void run() {
     69                                                protected void runAt() {
    5970
    6071                                                        log.info("starting periodic dump");
    61                                                         new RecursiveFetcher(instance, Path.to(instance, "/"), new StateFunctor() {
    62                                                                 @Override
    63                                                                 public void handle(FramsticksException e) {
    64                                                                         Logging.log(log, "recursively fetch", instance, e);
    65                                                                         again();
    66                                                                 }
     72                                                        new RecursiveFetcher(tree, Path.to(tree, "/"), new FutureHandler<Void>(repeater) {
    6773
    6874                                                                @Override
    69                                                                 public void call() {
    70                                                                         log.info("instance resolved, saving");
     75                                                                protected void result(Void result) {
     76                                                                        log.info("tree resolved, saving");
    7177                                                                        try {
    72                                                                                 final String fileName = dumpsPath + "/" + instance + "_" + new SimpleDateFormat(dumpsFormat).format(new Date()) + ".param";
     78                                                                                final String fileName = dumpsPath + "/" + tree + "_" + new SimpleDateFormat(dumpsFormat).format(new Date()) + ".param";
    7379                                                                                File file = new File(fileName);
    74                                                                                 new SaveStream(new PrintWriterSink(new PrintWriter(new OutputStreamWriter(new FileOutputStream(file), Encoding.getFramsticksCharset()))), instance, Path.to(instance, "/"), new StateFunctor() {
    75                                                                                         @Override
    76                                                                                         public void handle(FramsticksException e) {
    77                                                                                                 Logging.log(log, "periodic dump in " + fileName + " of", instance, e);
    78                                                                                                 again();
    79                                                                                         }
     80                                                                                new SaveStream(new PrintWriterSink(new PrintWriter(new OutputStreamWriter(new FileOutputStream(file), Encoding.getFramsticksCharset()))), tree, Path.to(tree, "/"), new FutureHandler<Void>(repeater) {
    8081
    8182                                                                                        @Override
    82                                                                                         public void call() {
     83                                                                                        protected void result(Void result) {
    8384                                                                                                again();
    8485                                                                                        }
    8586                                                                                });
    86                                                                         } catch (IOException ex) {
    87                                                                                 log.info("failed to initiate dump: " + ex);
    88                                                                                 again();
     87                                                                        } catch (IOException e) {
     88                                                                                throw new FramsticksException().msg("failed to initiate dump").cause(e);
    8989                                                                        }
    90 
    9190                                                                }
    9291                                                        });
Note: See TracChangeset for help on using the changeset viewer.