Package io.s4.dispatcher.partitioner

Examples of io.s4.dispatcher.partitioner.KeyInfo


   @Test
   public void testCloneAndInitialize() {
       MockPE prototype = new MockPE();
       prototype.setInitMethod("testInitialize");
      
       PrototypeWrapper prototypeWrapper = new PrototypeWrapper(prototype, new WallClock());

       assertEquals(0, prototype.getInitializeCount());
       MockPE instance = (MockPE)prototypeWrapper.getPE("asd");
       assertNotNull(instance);
      
View Full Code Here


                compoundKeyInfo.setCompoundKey(plainCompoundKeyInfo.get("compoundKey",
                                                                        (String) null));
                compoundKeys.add(compoundKeyInfo);
                for (EventRecord plainKeyInfo : plainCompoundKeyInfo.get("keyInfoList",
                                                                         EMPTY_LIST)) {
                    KeyInfo keyInfo = new KeyInfo();
                    for (EventRecord plainKeyPathElement : plainKeyInfo.get("keyPathElementList",
                                                                            EMPTY_LIST)) {
                        String keyName = plainKeyPathElement.get("keyName",
                                                                 (String) null);
                        Integer index = plainKeyPathElement.get("index",
                                                                (Integer) null);

                        if (keyName != null) {
                            keyInfo.addElementToPath(keyName);
                        } else if (index != null) {
                            keyInfo.addElementToPath(index);
                        }
                    }
                    compoundKeyInfo.addKeyInfo(keyInfo);
                }
            }
        }
        if (debug) {
            for (CompoundKeyInfo compoundKeyInfo : compoundKeys) {
                System.out.println("CompoundKey: "
                        + compoundKeyInfo.getCompoundValue());
                for (KeyInfo keyInfo : compoundKeyInfo.getKeyInfoList()) {
                    String keyPath = "";
                    for (KeyPathElement keyPathElement : keyInfo.getKeyPath()) {
                        if (keyPathElement instanceof KeyPathElementIndex) {
                            keyPath += "["
                                    + ((KeyPathElementIndex) keyPathElement).getIndex()
                                    + "]";
                        } else {
View Full Code Here

        List<String> valueList = this.getTarget();
        if (valueList == null)
            return null;

        // First, build the key
        KeyInfo keyInfo = new KeyInfo();
        // special kay name to denote request
        keyInfo.addElementToPath("#req");

        // for value, concatenate list of values from Request's target field.
        String stringValue = StringUtils.collectionToDelimitedString(valueList,
                                                                     delim);
        keyInfo.setValue(stringValue);

        // partition id is derived form string value, as usual
        int partitionId = (int) (h.hash(stringValue) % partCount);

        CompoundKeyInfo partitionInfo = new CompoundKeyInfo();
View Full Code Here

TOP

Related Classes of io.s4.dispatcher.partitioner.KeyInfo

Copyright © 2018 www.massapicom. 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.