Package io.s4.util.clock

Examples of io.s4.util.clock.EventClock


        keyInfo.setValue(stringValue);

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

        CompoundKeyInfo partitionInfo = new CompoundKeyInfo();
        partitionInfo.addKeyInfo(keyInfo);
        partitionInfo.setCompoundValue(stringValue);
        partitionInfo.setPartitionId(partitionId);

        List<CompoundKeyInfo> partitionInfoList = new ArrayList<CompoundKeyInfo>();
        partitionInfoList.add(partitionInfo);

        return partitionInfoList;
View Full Code Here


    public List<CompoundKeyInfo> partition(Hasher h, String delim, int partCount) {
        // send to all partitions
        List<CompoundKeyInfo> partitionInfoList = new ArrayList<CompoundKeyInfo>();

        for (int i = 0; i < partCount; ++i) {
            CompoundKeyInfo partitionInfo = new CompoundKeyInfo();
            partitionInfo.setPartitionId(i);
            partitionInfoList.add(partitionInfo);
        }

        return partitionInfoList;
    }
View Full Code Here

        int p = this.getRInfo().getPartition();
        List<CompoundKeyInfo> partitionInfoList = null;

        if (p >= 0 && p < partCount) {
            CompoundKeyInfo partitionInfo = new CompoundKeyInfo();
            partitionInfo.setPartitionId(p);

            partitionInfoList = new ArrayList<CompoundKeyInfo>();
            partitionInfoList.add(partitionInfo);
        }
View Full Code Here

        if (event instanceof SinglePERequest) {
            // Handle Requests to individual PEs
            if (keyInfoList.isEmpty())
                return;

            CompoundKeyInfo keyInfo = keyInfoList.get(0);

            String keyVal = keyInfo.getCompoundValue();

            ProcessingElement pe = p.lookupPE(keyVal);

            Response response = ((SinglePERequest) event).evaluate(pe);
            String stream = response.getRInfo().getStream();
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

                    pInfoList = partitioner.partition(streamName,
                                                      event,
                                                      eventEmitter.getNodeCount());
                } else {
                    if (partitioner instanceof VariableKeyPartitioner) {
                        VariableKeyPartitioner vp = (VariableKeyPartitioner) partitioner;
                        pInfoList = vp.partition(streamName,
                                                 compoundKeyNames,
                                                 event,
                                                 eventEmitter.getNodeCount());
                    }
                }
View Full Code Here

        EventEmitter emitter = null;

        SerializerDeserializer serDeser = new KryoSerDeser();

        CommLayerEmitter clEmitter = new CommLayerEmitter();
        clEmitter.setAppName(senderApplicationName);
        clEmitter.setListenerAppName(listenerApplicationName);
        clEmitter.setClusterManagerAddress(clusterManagerAddress);
        clEmitter.setSenderId(String.valueOf(System.currentTimeMillis() / 1000));
        clEmitter.setSerDeser(serDeser);
        clEmitter.init();
        emitter = clEmitter;

        long endTime = 0;
        if (runForTime > 0) {
            endTime = System.currentTimeMillis() + (runForTime * 1000);
 
View Full Code Here

            System.exit(1);
        }

        String inputFilename = (String) loArgs.get(0);

        EventEmitter emitter = null;

        SerializerDeserializer serDeser = new KryoSerDeser();

        CommLayerEmitter clEmitter = new CommLayerEmitter();
        clEmitter.setAppName(senderApplicationName);
View Full Code Here

        String[] query = { "name", "count", "freq" };
        String target[] = { "ACDW", "11" };

        io.s4.message.Request.ClientRInfo rinfo = new io.s4.message.Request.ClientRInfo();
        rinfo.setRequesterUUID(UUID.randomUUID());
        Request req = new io.s4.message.SinglePERequest(Arrays.asList(target),
                                                        Arrays.asList(query),
                                                        rinfo);

        System.out.println(req.toString());

        InstanceCreator<io.s4.message.Request.RInfo> infoCreator = new InstanceCreator<io.s4.message.Request.RInfo>() {
            public io.s4.message.Request.RInfo createInstance(Type type) {
                return new io.s4.message.Request.ClientRInfo();
            }
View Full Code Here

TOP

Related Classes of io.s4.util.clock.EventClock

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.