code: public static Transport getInstance (Type type, int channel)
      {
          // were there more parameters in transport objects, it would be better to have a single map
          // of instances and use Transport objects as keys (as in examples of the flyweight
          // pattern).  however, doing it this way avoids the need to create a new object on lookup
          if (_unordered == null) {
              int length = Type.values().length;
              _unordered = new Transport[length];
              @SuppressWarnings({ "unchecked" }) HashIntMap<Transport>[] ordered =
                  (HashIntMap<Transport>[])new HashIntMap<?>[length];
              _ordered = ordered;
          }
  
          // for unordered transport, we map on the type alone
          int idx = type.ordinal();
          if (!type.isOrdered()) {
              Transport instance = _unordered[idx];
              if (instance == null) {
                  _unordered[idx] = instance = new Transport(type);
              }
              return instance;
          }
  
          // for ordered transport, we map on the type and channel
          HashIntMap<Transport> instances = _ordered[idx];
          if (instances == null) {
              _ordered[idx] = instances = new HashIntMap<Transport>();
          }
          Transport instance = instances.get(channel);
          if (instance == null) {
              instances.put(channel, instance = new Transport(type, channel));
          }
          return instance;
      }
docs: Returns the shared instance with the specified parameters.