Package org.apache.hedwig.server.common

Examples of org.apache.hedwig.server.common.ServerConfiguration


        PubSubServer server = startServer(uncaughtExceptionHandler, port, new TopicManagerInstantiator() {

            @Override
            public TopicManager instantiateTopicManager() throws IOException {
                return new AbstractTopicManager(new ServerConfiguration(), Executors.newSingleThreadScheduledExecutor()) {
                    @Override
                    protected void realGetOwner(ByteString topic, boolean shouldClaim,
                    Callback<HedwigSocketAddress> cb, Object ctx) {
                        throw new RuntimeException("this exception should be uncaught");
                    }
View Full Code Here


        PubSubServer server = startServer(uncaughtExceptionHandler, port, new TopicManagerInstantiator() {

            @Override
            public TopicManager instantiateTopicManager() throws IOException {
                return new AbstractTopicManager(new ServerConfiguration(), Executors.newSingleThreadScheduledExecutor()) {

                    @Override
                    protected void realGetOwner(ByteString topic, boolean shouldClaim,
                    Callback<HedwigSocketAddress> cb, Object ctx) {
                        ZooKeeper zookeeper;
View Full Code Here

    }

    @Test
    public void testInvalidServerConfiguration() throws Exception {
        boolean success = false;
        ServerConfiguration conf = new ServerConfiguration() {
            @Override
            public boolean isInterRegionSSLEnabled() {
                return conf.getBoolean(INTER_REGION_SSL_ENABLED, true);
            }

            @Override
            public List<String> getRegions() {
                List<String> regionsList = new LinkedList<String>();
                regionsList.add("regionHost1:4080:9876");
                regionsList.add("regionHost2:4080");
                regionsList.add("regionHost3:4080:9876");
                return regionsList;
            }
        };
        try {
            conf.validate();
        }
        catch (ConfigurationException e) {
            logger.error("Invalid configuration: ", e);
            success = true;
        }
View Full Code Here

    }

    @Test
    public void testValidServerConfiguration() throws Exception {
        boolean success = true;
        ServerConfiguration conf = new ServerConfiguration() {
            @Override
            public boolean isInterRegionSSLEnabled() {
                return conf.getBoolean(INTER_REGION_SSL_ENABLED, true);
            }

            @Override
            public List<String> getRegions() {
                List<String> regionsList = new LinkedList<String>();
                regionsList.add("regionHost1:4080:9876");
                regionsList.add("regionHost2:4080:2938");
                regionsList.add("regionHost3:4080:9876");
                return regionsList;
            }
        };
        try {
            conf.validate();
        }
        catch (ConfigurationException e) {
            logger.error("Invalid configuration: ", e);
            success = false;
        }
View Full Code Here

    }

    @SuppressWarnings("deprecation")
    @Override
    protected ServerConfiguration getServerConfiguration(int serverPort, int sslServerPort) {
        ServerConfiguration serverConf = new TestServerConfiguration(serverPort, sslServerPort);

        org.apache.bookkeeper.conf.ClientConfiguration bkClientConf =
            new org.apache.bookkeeper.conf.ClientConfiguration();
        bkClientConf.setNumWorkerThreads(1).setReadTimeout(9999)
                    .setThrottleValue(3);
        try {
            serverConf.addConf(bkClientConf);
        } catch (Exception e) {
        }
        return serverConf;
    }
View Full Code Here

    @SuppressWarnings("deprecation")
    private void startCluster(long delay) throws Exception {
        bktb = new BookKeeperTestBase(numBookies, 0L);
        bktb.setUp();

        conf = new ServerConfiguration() {
            @Override
            public int getMessagesConsumedThreadRunInterval() {
                return 2000;
            }
            @Override
View Full Code Here

            inConsole = false;
        }

        org.apache.bookkeeper.conf.ClientConfiguration bkClientConf =
            new org.apache.bookkeeper.conf.ClientConfiguration();
        ServerConfiguration hubServerConf = new ServerConfiguration();
        String serverCfgFile = cl.getOption("server-cfg");
        if (serverCfgFile != null) {
            try {
                hubServerConf.loadConf(new File(serverCfgFile).toURI().toURL());
            } catch (ConfigurationException e) {
                throw new IOException(e);
            }
            try {
                bkClientConf.loadConf(new File(serverCfgFile).toURI().toURL());
            } catch (ConfigurationException e) {
                throw new IOException(e);
            }
        }

        ClientConfiguration hubClientCfg = new ClientConfiguration();
        String clientCfgFile = cl.getOption("client-cfg");
        if (clientCfgFile != null) {
            try {
                hubClientCfg.loadConf(new File(clientCfgFile).toURI().toURL());
            } catch (ConfigurationException e) {
                throw new IOException(e);
            }
        }



        printMessage("Connecting to zookeeper/bookkeeper using HedwigAdmin");
        try {
            admin = new HedwigAdmin(bkClientConf, hubServerConf);
            admin.getZkHandle().register(new MyWatcher());
        } catch (Exception e) {
            throw new IOException(e);
        }
       
        printMessage("Connecting to default hub server " + hubClientCfg.getDefaultServerHost());
        hubClient = new HedwigClient(hubClientCfg);
        publisher = hubClient.getPublisher();
        subscriber = hubClient.getSubscriber();
       
        // other parameters
        myRegion = hubServerConf.getMyRegion();
    }
View Full Code Here

        NIOServerCnxnFactory serverFactory = new NIOServerCnxnFactory();
        serverFactory.configure(new InetSocketAddress(2181), 100);
        serverFactory.startup(zks);

        boolean b = ClientBase.waitForServerUp("127.0.0.1:2181", 5000);
        ServerConfiguration serverConf = new ServerConfiguration();
        serverConf.loadConf(hedwigConfigFile.toURI().toURL());

        logger.info("Zookeeper server up and running!");

        ZooKeeper zkc = new ZooKeeper("127.0.0.1", 2181, null);
View Full Code Here

        PubSubServer server = startServer(uncaughtExceptionHandler, port, new TopicManagerInstantiator() {

            @Override
            public TopicManager instantiateTopicManager() throws IOException {
                return new AbstractTopicManager(new ServerConfiguration(), Executors.newSingleThreadScheduledExecutor()) {
                    @Override
                    protected void realGetOwner(ByteString topic, boolean shouldClaim,
                    Callback<HedwigSocketAddress> cb, Object ctx) {
                        throw new RuntimeException("this exception should be uncaught");
                    }
View Full Code Here

        PubSubServer server = startServer(uncaughtExceptionHandler, port, new TopicManagerInstantiator() {

            @Override
            public TopicManager instantiateTopicManager() throws IOException {
                return new AbstractTopicManager(new ServerConfiguration(), Executors.newSingleThreadScheduledExecutor()) {

                    @Override
                    protected void realGetOwner(ByteString topic, boolean shouldClaim,
                    Callback<HedwigSocketAddress> cb, Object ctx) {
                        ZooKeeper zookeeper;
View Full Code Here

TOP

Related Classes of org.apache.hedwig.server.common.ServerConfiguration

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.