Examples of RoutingStrategy


Examples of com.nokia.dempsy.router.RoutingStrategy

                        receiver.setStatsCollector(statsCollector);
                  }
                 
                  router.setDefaultSenderFactory(transport.createOutbound(executor, statsCollector));

                  RoutingStrategy strategy = (RoutingStrategy)clusterDefinition.getRoutingStrategy();
                 
                  KeySource<?> keySource = clusterDefinition.getKeySource();
                  if (keySource != null)
                     container.setKeySource(keySource);

                  // there is only an inbound strategy if we have an Mp (that is, we aren't an adaptor) and
                  // we actually accept messages
                  if (messageProcessorPrototype != null && acceptedMessageClasses != null && acceptedMessageClasses.size() > 0)
                     strategyInbound = strategy.createInbound(clusterSession,currentClusterId,acceptedMessageClasses, thisDestination,container);
                 
                  // this can fail because of down cluster manager server ... but it should eventually recover.
                  try { router.initialize(); }
                  catch (ClusterInfoException e)
                  {

Examples of jmt.gui.common.routingStrategies.RoutingStrategy

   * @param warnings vector Vector to store warnings found during computation
   * @return an array with probability to reach each other station starting from given station
   */
  private static double[] getRoutingProbability(Object stationKey, Object classKey, CommonModel model, List<Object> stations, List<String> warnings) {
    double[] p = new double[stations.size()];
    RoutingStrategy strategy = (RoutingStrategy) model.getRoutingStrategy(stationKey, classKey);
    if (strategy instanceof ProbabilityRouting && !model.getStationType(stationKey).equals(CommonConstants.STATION_TYPE_FORK)) {
      Map routingMap = strategy.getValues();
      Iterator it = routingMap.keySet().iterator();
      while (it.hasNext()) {
        Object dest = it.next();
        if (stations.lastIndexOf(dest) >= 0) {
          p[stations.lastIndexOf(dest)] = ((Double) routingMap.get(dest)).doubleValue();
        }
      }
    } else {
      if (model.getStationType(stationKey).equals(CommonConstants.STATION_TYPE_FORK)) {
        warnings.add("Fork-Join are not supported in JMVA. They are considered as routers.");
      } else if (!(strategy instanceof RandomRouting)) {
        warnings.add("\"" + strategy.getName() + "\" routing strategy in " + model.getClassName(classKey) + " for "
            + model.getStationName(stationKey) + " is not allowed. This was considered as RandomRouting");
      }

      Vector<Object> links = model.getForwardConnections(stationKey);
      int linksNum = links.size();

Examples of jmt.gui.common.routingStrategies.RoutingStrategy

    private void checkForLoadDependentRoutingError() {
        //Step 1 : Find all stations.
        for(Object stationKey : station_def.getStationKeys()) {
            //Step 2: check Routing for each class of the station
            for(Object classKey : class_def.getClassKeys()) {
                RoutingStrategy rs = (RoutingStrategy) station_def.getRoutingStrategy(stationKey, classKey);
                if(rs instanceof LoadDependentRouting){
                    List<String> errorMsgs = ((LoadDependentRouting) rs).validate();
                    if(errorMsgs != null && errorMsgs.size() > 0){
                        errors[LOAD_DEPENDENT_ROUTING_INVALID] = true;
                        HashMap innerVal = new HashMap<Object, Object>();

Examples of jmt.gui.common.routingStrategies.RoutingStrategy

    Vector<Object> classes = class_def.getClassKeys();
    for (int i = 0; i < stations.size(); i++) {
      Object thisStation = stations.get(i);
      for (int j = 0; j < classes.size(); j++) {
        Object thisClass = classes.get(j);
        RoutingStrategy thisRoutingStrategy = (RoutingStrategy) station_def.getRoutingStrategy(thisStation, thisClass);
        if (thisRoutingStrategy != null) {
          if (thisRoutingStrategy.isModelStateDependent()) {
            BCMPnonStateIndependentRoutingStations.add(thisStation);
            warnings[BCMP_NON_STATE_INDEPENDENT_ROUTING_WARNING] = true;
            break;
          }
        }

Examples of jmt.gui.common.routingStrategies.RoutingStrategy

      //... if it has not been explored yet ...
      if (!alreadyVisited.contains(thisForwardStation)) {
        //... add the element to the alreadyVisited vector ...
        alreadyVisited.add(thisForwardStation);
        // ... get the routing strategy for the class in the starting station ...
        RoutingStrategy strategy = (RoutingStrategy) station_def.getRoutingStrategy(startingStationKey, classKey);
        // ... if thisForwardStation is a Sink ...
        if (station_def.getStationType(thisForwardStation).equals(STATION_TYPE_SINK)) {
          // ... if the routing strategy is the Probability Routing ...
          if (strategy instanceof ProbabilityRouting) {
            Map probabilities = strategy.getValues();
            // ... get the routing probability toward thisForwardStation ...
            double p = ((Double) probabilities.get(thisForwardStation)).doubleValue();
            // ... if p = 1 there is an error, put startingStationKey into the
            // toBeReturned vector ...
            if (p == 1) {
              toBeReturned.add(startingStationKey);
            }
          }
        }
        // ... else thisForwardStation isn't a Sink ...
        else {
          Vector<Object> temp;
          // ... if the routing policy is ProbabilityRouting ...
          if (strategy instanceof ProbabilityRouting) {
            Map probabilities = strategy.getValues();
            // ... get the routing probability toward thisForwardStation ...
            double p = ((Double) probabilities.get(thisForwardStation)).doubleValue();
            // ... if p != 0 start exploring from thisForwardStation and collect
            // the returned vector into temp ...
            if (p != 0) {

Examples of jmt.gui.common.routingStrategies.RoutingStrategy

          //... add the element to the alreadyVisited vector ...
          alreadyVisited.add(thisForwardStation);
          // ... if thisForwardStation is not a Sink ...
          if (!station_def.getStationType(thisForwardStation).equals(STATION_TYPE_SINK)) {
            // ... get the routing strategy for the class in the starting station ...
            RoutingStrategy strategy = (RoutingStrategy) station_def.getRoutingStrategy(startingStationKey, classKey);
            if (strategy instanceof ProbabilityRouting) {
              Map probabilities = strategy.getValues();
              // ... get the routing probability toward thisForwardStation ...
              double p = ((Double) probabilities.get(thisForwardStation)).doubleValue();
              // ... if p != 0 start exploring from thisForwardStation and collect
              // the returned vector into temp ...
              if (p != 0) {

Examples of jmt.gui.common.routingStrategies.RoutingStrategy

    Vector<Object> classes = class_def.getClassKeys();
    for (int i = 0; i < BCMPnonStateIndependentRoutingStations.size(); i++) {
      Object thisStation = BCMPnonStateIndependentRoutingStations.get(i);
      for (int j = 0; j < classes.size(); j++) {
        Object thisClass = classes.get(j);
        RoutingStrategy rs = (RoutingStrategy) station_def.getRoutingStrategy(thisStation, thisClass);
        if (rs.isModelStateDependent()) {
          station_def.setRoutingStrategy(thisStation, thisClass, new RandomRouting());
        }
      }
    }
  }

Examples of jmt.gui.common.routingStrategies.RoutingStrategy

    /*        if(stationKey==null||classKey==null||sd==null){
                emptyPane();
                return;
            }
    */
        RoutingStrategy rs = (RoutingStrategy) sd.getRoutingStrategy(stationKey, classKey);
    if (rs == null) {
      emptyPane();
    } else {
      descrTextPane.setText(rs.getDescription());
      /*if (rs.getValues() == null) {
        emptyPane();
      } else {
        createDetails(rs, sd, stationKey, classKey);
      }*/
 

Examples of jmt.gui.common.routingStrategies.RoutingStrategy

      Vector<Object> bacwardStationKeys = this.getBackwardConnections(key);
            for(Iterator<Object> it = bacwardStationKeys.iterator(); it.hasNext();){
                Object stationKey = it.next();
                Vector<Object> classKeys = this.getClassKeys();
                for(Object classKey : classKeys){
                    RoutingStrategy rs = (RoutingStrategy)this.getRoutingStrategy(stationKey, classKey);
                    if(rs instanceof LoadDependentRouting){
                        LoadDependentRouting ld = (LoadDependentRouting) rs;
                        ld.refreshRoutingOnStationDeletion(this.getStationName(key));
                    }
                }

Examples of jmt.gui.common.routingStrategies.RoutingStrategy

    // Sets correct station key into every empiricalRouting element
    // Now each key is an Object[] where (0) is station key and (1) class key
    keys = empiricalRouting.keySet().toArray();
    for (Object key : keys) {
      Object[] dualkey = (Object[]) key;
      RoutingStrategy rs = (RoutingStrategy) model.getRoutingStrategy(dualkey[0], dualkey[1]);
      Map<Object, Double> routing = rs.getValues();
      Map<String, Double> values = empiricalRouting.get(key);
      Object[] names = values.keySet().toArray();
      // Creates correct hashmap with station key --> probability mapping
      for (Object name : names) {
        routing.put(stations.get(name), values.get(name));
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.