Package io.s4.dispatcher.partitioner

Examples of io.s4.dispatcher.partitioner.KeyInfo


        return this.listenerConfig;
    }

    public void init() {
        System.err.println("appName=" + appName);
        process = new ListenerProcess(clusterManagerAddress, appName);
        process.setDeserializer(new PassThroughDeserializer());
        CommEventCallback callbackHandler = new CommEventCallback() {
            @Override
            public void handleCallback(Map<String, Object> event) {
                if (event != null) {
View Full Code Here


    public void run() {
        if (listener == null) {
            if (listenerAppName == null) {
                listenerAppName = appName;
            }
            sender = new SenderProcess(clusterManagerAddress,
                                       appName,
                                       listenerAppName);
            Map<String, String> map = new HashMap<String, String>();
            map.put("SenderId", "" + senderId);
            sender.setSerializer(new PassThroughSerializer());
            sender.acquireTaskAndCreateSender(map);
        } else {
            Object listenerConfig = null;
            try {
                listenerConfig = listener.getListenerConfig();
                if (listenerConfig == null) {
                    logger.info("CommLayerEmitter going to wait for listener to acquire task");
                    synchronized (listener) {
                        listenerConfig = listener.getListenerConfig();
                        if (listenerConfig == null) {
                            listener.wait();
                            listenerConfig = listener.getListenerConfig();
                        }
                    }
                }
            } catch (Exception e) {
                logger.info("Exception in CommLayerEmitter.run()", e);
            }
            logger.info("Creating sender process with " + listenerConfig);

            String destinationAppName = (listenerAppName != null
                    ? listenerAppName : listener.getAppName());

            sender = new SenderProcess(listener.getClusterManagerAddress(),
                                       listener.getAppName(),
                                       destinationAppName);

            sender.setSerializer(new PassThroughSerializer());
            sender.createSenderFromConfig(listenerConfig);
View Full Code Here

    }

    private static void testStaticTaskManager(String[] args) {
        String address = null;
        address = "localhost:2181";
        TaskManager taskManager = new StaticTaskManager(address,
                                                        "taskmanagerTest",
                                                        ClusterType.S4,
                                                        null);
        Map<String, String> customTaskData = new HashMap<String, String>();
        Object acquireTask = taskManager.acquireTask(customTaskData);
        System.out.println("Acuired Task:" + acquireTask);

    }
View Full Code Here

    }

    private static void testStaticProcessMonitor(String[] args) {
        String address = null;
        address = "localhost:2181";
        StaticProcessMonitor monitor = new StaticProcessMonitor(address,
                                                                "taskmanagerTest",
                                                                ClusterType.S4);
        monitor.monitor();
        System.out.println(monitor.getDestinationList());
        System.out.println(monitor.getDestinationMap());
    }
View Full Code Here

            String clusterName, CommEventCallback callbackHandler) {
        ProcessMonitor processMonitor = null;
        String mode = System.getProperty("commlayer.mode");
        if (mode != null && mode.equalsIgnoreCase("static")) {
            logger.info("Comm layer mode is set to static");
            processMonitor = new StaticProcessMonitor(zkaddress,
                                                      clusterName,
                                                      ClusterType.S4);
        } else {
            processMonitor = new ZkProcessMonitor(zkaddress,
                                                  clusterName,
View Full Code Here

    }

    private static void testStaticTaskManager(String[] args) {
        String address = null;
        address = "localhost:2181";
        TaskManager taskManager = new StaticTaskManager(address,
                                                        "taskmanagerTest",
                                                        ClusterType.S4,
                                                        null);
        Map<String, String> customTaskData = new HashMap<String, String>();
        Object acquireTask = taskManager.acquireTask(customTaskData);
        System.out.println("Acuired Task:" + acquireTask);

    }
View Full Code Here

            CommEventCallback callbackHandler) {
        String mode = System.getProperty("commlayer.mode");
        TaskManager taskManager = null;
        if (mode != null && mode.equalsIgnoreCase("static")) {
            logger.info("Comm layer mode is set to static");
            taskManager = new StaticTaskManager(zkaddress,
                                                clusterName,
                                                clusterType,
                                                callbackHandler);
        } else {
            taskManager = new ZkTaskManager(zkaddress,
View Full Code Here

        System.err.println("java TaskSetupApp <zk_address> [clean|setup] setup_config_xml");
        System.exit(1);
    }

    private static void doMain(String zkAddress, boolean clean, boolean setup, String setupXml) {
        ConfigParser parser = new ConfigParser();
        Config config = parser.parse(setupXml);
        for (Cluster cluster : config.getClusters()) {
            processCluster(clean, zkAddress, cluster, config.getVersion());
        }
    }
View Full Code Here

            String clusterName, ClusterType clusterType, boolean isStatic) {
        ConfigParser parser = new ConfigParser();
        ConfigParser.Config config = parser.parse(configFilename);

        // find the requested cluster
        Cluster cluster = null;
        for (Cluster checkCluster : config.getClusters()) {
            if (checkCluster.getName().equals(clusterName)
                    && checkCluster.getType().equals(clusterType)) {
                cluster = checkCluster;
                break;
View Full Code Here

        System.exit(1);
    }

    private static void doMain(String zkAddress, boolean clean, boolean setup, String setupXml) {
        ConfigParser parser = new ConfigParser();
        Config config = parser.parse(setupXml);
        for (Cluster cluster : config.getClusters()) {
            processCluster(clean, zkAddress, cluster, config.getVersion());
        }
    }
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.