Package com.taobao.metamorphosis.server.utils

Examples of com.taobao.metamorphosis.server.utils.MetaConfig


    }


    protected MetaMorphosisBroker startServer(final String name, final boolean isClearConsumerInfo,
            final boolean isCleanData) throws Exception {
        final MetaConfig metaConfig = this.metaConfig(name);
        metaConfig.setDashboardHttpPort(metaConfig.getServerPort() - 20);
        if (isCleanData) {
            Utils.clearDataDir(metaConfig);
        }
        final MetaMorphosisBroker broker = new MetaMorphosisBroker(metaConfig);
        if (isClearConsumerInfo) {
View Full Code Here


    protected MetaConfig metaConfig(final String name) throws IOException, FileNotFoundException {
        final File file = ResourcesUtils.getResourceAsFile(name + ".ini");
        if (file == null || !file.exists()) {
            throw new FileNotFoundException("�Ҳ��������ļ�" + name + ".ini");
        }
        final MetaConfig metaConfig = new MetaConfig();
        final File dataDir = new File(System.getProperty("user.home") + File.separator + "meta");
        if (!dataDir.exists()) {
            dataDir.mkdir();
        }

        metaConfig.loadFromFile(file.getAbsolutePath());
        metaConfig.setDataPath(metaConfig.getDataPath() + File.separator + name);
        for (final TopicConfig topicConfig : metaConfig.getTopicConfigMap().values()) {
            topicConfig.setDataPath(metaConfig.getDataPath());
        }
        return metaConfig;
    }
View Full Code Here


    public SubscribeHandler(final MetaMorphosisBroker broker) throws MetaClientException {
        this.broker = broker;
        this.slaveZooKeeper = new SlaveZooKeeper(this.broker, this);
        final MetaConfig metaConfig = this.broker.getMetaConfig();

        final MetaClientConfig metaClientConfig = new MetaClientConfig();
        metaClientConfig.setZkConfig(metaConfig.getZkConfig());
        this.sessionFactory = SlaveMetaMessageSessionFactory.create(metaClientConfig, metaConfig.getBrokerId());
        this.slaveOffsetStorage =
                new SlaveOffsetStorage(this.broker, this.slaveZooKeeper, this.sessionFactory.getRemotingClient());
        this.messageListener =
                new MetaSlaveListener(this.broker.getBrokerZooKeeper(), this.broker.getStoreManager(),
                    new SlaveStatsManager(this.broker.getStatsManager()));
View Full Code Here

    }


    synchronized public void tryReloadConfig(long masterChecksum) throws IOException {
        MetaConfig metaConfig = this.broker.getMetaConfig();
        if (metaConfig == null || metaConfig.getSlaveConfig() == null) {
            return;
        }
        if (!metaConfig.getSlaveConfig().isAutoSyncMasterConfig()) {
            return;
        }
        // Master Config file changed
        if (metaConfig.getConfigFileChecksum() != masterChecksum) {
            String masterUrl = this.slaveZooKeeper.getMasterServerUrl();
            for (int i = 0; i < 3; i++) {
                try {
                    BooleanCommand resp =
                            (BooleanCommand) this.sessionFactory.getRemotingClient().invokeToGroup(masterUrl,
View Full Code Here

    private void tryReloadConfig(BooleanCommand resp) throws UnsupportedEncodingException, IOException,
    FileNotFoundException {
        String str = resp.getErrorMsg();
        str = new String(str.getBytes("utf-8"));
        MetaConfig newConfig = new MetaConfig();
        newConfig.loadFromString(str);
        // If topics config changed
        if (!newConfig.getTopicConfigMap().equals(this.broker.getMetaConfig().getTopicConfigMap())) {
            File tmpFile = File.createTempFile("meta_config", "slave_sync");
            BufferedWriter writer =
                    new BufferedWriter(new OutputStreamWriter(new FileOutputStream(tmpFile), SLAVE_CONFIG_ENCODING));
            writer.write(str);
            writer.flush();
View Full Code Here

    private final String message = "testMetaOnJetty";


    @BeforeClass
    public static void setUp() throws IOException {
        final MetaConfig metaConfig = new MetaConfig();
        metaConfig.setBrokerId(100);
        metaConfig.setHostName("localhost");
        metaConfig.setServerPort(8199);

        broker = new MetamorphosisOnJettyBroker();
        final MetaMorphosisBroker metaBroker = new MetaMorphosisBroker(metaConfig);
        final Properties properites = new Properties();
        properites.load(Thread.currentThread().getContextClassLoader().getResourceAsStream("jettyBroker.properties"));
View Full Code Here

    static final Log log = LogFactory.getLog(MetamorphosisStartup.class);


    public static void main(final String[] args) {
        final String configFilePath = getConfigFilePath(args);
        final MetaConfig metaConfig = getMetaConfig(configFilePath);
        final MetaMorphosisBroker server = new MetaMorphosisBroker(metaConfig);
        server.start();

    }
View Full Code Here

    }


    static MetaConfig getMetaConfig(final String configFilePath) {
        final MetaConfig metaConfig = new MetaConfig();
        metaConfig.loadFromFile(configFilePath);
        metaConfig.verify();
        log.warn("����������Ϊ��" + metaConfig);
        System.out.println("׼������������������Ϊ��" + metaConfig);
        return metaConfig;
    }
View Full Code Here

    MetaConfig metaConfig;


    @Before
    public void setUp() {
        this.metaConfig = new MetaConfig();
        final List<String> topics = new ArrayList<String>();
        topics.add("topic1");
        topics.add("topic2");
        final TopicConfig topicConfig = new TopicConfig("topic2", this.metaConfig);
        topicConfig.setNumPartitions(5);
View Full Code Here

        this.clearHeuristicTxJournal();
    }


    private void newProcessor() throws Exception {
        final MetaConfig metaConfig = new MetaConfig();
        this.processor =
                new TransactionalCommandProcessor(metaConfig, this.messageStoreManager, new IdWorker(0), this.next,
                    this.transactionStore, new StatsManager(new MetaConfig(), this.messageStoreManager, null));
    }
View Full Code Here

TOP

Related Classes of com.taobao.metamorphosis.server.utils.MetaConfig

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.