Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
 
 package com.ibm.mqlight.api.impl;
 
 
 
 
 
         Action startTimerAction = new Action() {
             @Override public void doIt() {
                 actions.startTimer();
             }
         };
 
         Action cancelTimerAction = new Action() {
             @Override public void doIt() {
                 actions.cancelTimer();
             }
         };
 
         Action requestEndpointAction = new Action() {
             @Override public void doIt() {
                 actions.requestEndpoint();
             }
         };
 
         Action blessEndpointAction = new Action() {
             @Override public void doIt() {
                 actions.blessEndpoint();
             }
         };
 
         Action openConnectionAction = new Action() {
             @Override public void doIt() {
                 actions.openConnection();
             }
         };
 
         Action closeConnectionAction = new Action() {
             @Override public void doIt() {
                 actions.closeConnection();
             }
         };
 
         Action remakeInboundLinksAction = new Action() {
             @Override public void doIt() {
                 actions.remakeInboundLinks();
             }
         };
 
         Action cleanupAction = new Action() {
             @Override public void doIt() {
                 actions.cleanup();
             }
         };
 
         Action failPendingStopsAction = new Action() {
             @Override public void doIt() {
                 actions.failPendingStops();
             }
         };
 
         Action succeedPendingStopsAction = new Action() {
             @Override public void doIt() {
                 actions.succeedPendingStops();
             }
         };
 
         Action failPendingStartAction = new Action() {
             @Override public void doIt() {
                actions.failPendingStarts();
            }
        };
        Action succeedPendingStartsAction = new Action() {
            @Override public void doIt() {
                actions.succeedPendingStarts();
            }
        };
        Action eventStartingAction = new Action() {
            @Override public void doIt() {
                actions.eventStarting();
            }
        };
        Action eventUserStoppingAction = new Action() {
            @Override public void doIt() {
                actions.eventUserStopping();
            }
        };
        Action eventSystemStoppingAction = new Action() {
            @Override public void doIt() {
                actions.eventSystemStopping();
            }
        };
        Action eventStoppedAction = new Action() {
            @Override public void doIt() {
                actions.eventStopped();
            }
        };
        Action eventStartedAction = new Action() {
            @Override public void doIt() {
                actions.eventStarted();
            }
        };
        Action eventRetryingAction = new Action() {
            @Override public void doIt() {
                actions.eventRetrying();
            }
        };
        Action eventRestartedAction = new Action() {
            @Override public void doIt() {
                actions.eventRestarted();
            }
        };
        Action breakInboundLinksAction = new Action() {
            @Override public void doIt() {
                actions.breakInboundLinks();
            }
        };
        Action processQueuedActionsAction = new Action() {
            @Override public void doIt() {
                actions.processQueuedActions();
            }
        };
              .ignore(.)
              .onEntryFrom(.startTimerAction)
              .onEntryFrom(.eventRetryingAction);
              .ignore(.)
              .onEntryFrom(.requestEndpointAction)
              .onEntryFrom(.requestEndpointAction);
              .ignore(.)
              .onEntryFrom(.openConnectionAction);
              .ignore(.)
              .onEntryFrom(.requestEndpointAction)
              .onEntryFrom(.requestEndpointAction)
              .onEntryFrom(.requestEndpointAction)
              .onEntryFrom(.eventRetryingAction)
              .onEntryFrom(.breakInboundLinksAction);
              .ignore(.)
              .onEntryFrom(.openConnectionAction);
              .ignore(.)
              .onEntryFrom(.remakeInboundLinksAction)
              .onEntryFrom(.blessEndpointAction);
              .ignore(.)
              .onEntryFrom(.startTimerAction)
              .onEntryFrom(.eventRetryingAction);
              .permitReentry(.)
              .onEntryFrom(.blessEndpointAction)
              .onEntryFrom(.succeedPendingStartsAction)
              .onEntryFrom(.failPendingStopsAction)
              .onEntryFrom(.eventStartedAction)
              .onEntryFrom(.eventRestartedAction)
              .onEntryFrom(.processQueuedActionsAction)
              .onEntryFrom(.succeedPendingStartsAction)
              .onEntryFrom(.processQueuedActionsAction);
              .ignore(.)
              .onEntryFrom(.requestEndpointAction)
              .onEntryFrom(.eventStartingAction)
              .onEntryFrom(.requestEndpointAction)
              .onEntryFrom(.eventStartingAction)
              .onEntryFrom(.requestEndpointAction);
              .ignore(.)
              .onEntryFrom(.openConnectionAction);
              .permitReentry(.)
              .onEntryFrom(.failPendingStartAction)
              .onEntryFrom(.succeedPendingStopsAction)
              .onEntryFrom(.eventStoppedAction)
              .onEntryFrom(.succeedPendingStopsAction);
              .ignore(.)
              .onEntryFrom(.closeConnectionAction)
              .onEntryFrom(.closeConnectionAction)
              .onEntryFrom(.closeConnectionAction)
              .onEntryFrom(.eventUserStoppingAction);
              .ignore(.)
              .onEntryFrom(.cleanupAction)
              .onEntryFrom(.cleanupAction)
              .onEntryFrom(.cleanupAction)
              .onEntryFrom(.eventSystemStoppingAction)
              .onEntryFrom(.cleanupAction)
              .onEntryFrom(.cleanupAction)
              .onEntryFrom(.cleanupAction)
              .onEntryFrom(.eventSystemStoppingAction)
              .onEntryFrom(.cleanupAction)
              .onEntryFrom(.cleanupAction)
              .onEntryFrom(.cleanupAction)
              .onEntryFrom(.cleanupAction)
              .onEntryFrom(.eventSystemStoppingAction);
              .ignore(.)
              .onEntryFrom(.closeConnectionAction)
              .onEntryFrom(.closeConnectionAction);
              .ignore(.)
              .onEntryFrom(.cleanupAction)
              .onEntryFrom(.cleanupAction)
              .onEntryFrom(.cleanupAction)
              .onEntryFrom(.cleanupAction)
              .onEntryFrom(.cleanupAction)
              .onEntryFrom(.cleanupAction)
              .onEntryFrom(.cleanupAction)
              .onEntryFrom(.cleanupAction)
              .onEntryFrom(.cleanupAction);
              .ignore(.)
              .onEntryFrom(.cancelTimerAction)
              .onEntryFrom(.eventUserStoppingAction);
              .ignore(.)
              .ignore(.)
              .onEntryFrom(.eventUserStoppingAction);
              .ignore(.)
              .ignore(.)
              .onEntryFrom(.eventUserStoppingAction);
              .ignore(.)
              .ignore(.)
              .onEntryFrom(.cancelTimerAction)
              .onEntryFrom(.eventUserStoppingAction);
              .ignore(.)
              .ignore(.)
              .onEntryFrom(.eventUserStoppingAction);
              .ignore(.)
              .ignore(.)
              .onEntryFrom(.eventUserStoppingAction);
              .ignore(.)
              .ignore(.)
              .onEntryFrom(.eventUserStoppingAction);
              .ignore(.)
              .ignore(.)
              .onEntryFrom(.eventUserStoppingAction);
              .ignore(.)
              .ignore(.)
              .onEntryFrom(.eventUserStoppingAction);
              .ignore(.)
        return config;
    }
        return new StateMachine<>(.createConfig(actions));
    }
    private static void generateDotFile(OutputStream dotFile) {
        ..println("digraph G {");
        final HashSet<StringinvokedMethods = new HashSet<String>();
        InvocationHandler handler = new InvocationHandler() {
            @Override
            public Object invoke(Object proxyMethod methodObject[] args)
                    throws Throwable {
                invokedMethods.add(method.getName());
                return null;
            }
        };
        FSMActions actions = (FSMActions) Proxy.newProxyInstance(FSMActions.class.getClassLoader(), new Class[] {FSMActions.class}, handler);
        for (NonBlockingClientState state : EnumSet.allOf(NonBlockingClientState.class)) {
            for (NonBlockingClientTrigger trigger : rep.getPermittedTriggers()) {
                sm.fire(trigger);
                ..print("\t" + rep.getUnderlyingState() + " -> " + sm.getState() + "[ label = \"" + trigger);
                if (!invokedMethods.isEmpty()) {
                    ..print(" |");
                    for (String methodName : invokedMethods) {
                        ..print(" " + methodName);
                    }
                    invokedMethods.clear();
                }
                ..println("\" ];");
            }
        }
        ..println("}");
    }
    public static void main(String[] argsthrows IOException {
        LogbackLogging.stop();
        generateDotFile(null);
    }
New to GrepCode? Check out our FAQ X