Package com.taobao.metamorphosis.exception

Examples of com.taobao.metamorphosis.exception.MetaClientException


    public Serializable fromByteArray(byte[] bs) throws MetaClientException {
        try {
            return (Serializable) this.deserializer.decodeObject(bs);
        }
        catch (IOException e) {
            throw new MetaClientException(e);

        }
    }
View Full Code Here


            this.shutdown();
            throw e;
        }
        catch (Exception e) {
            this.shutdown();
            throw new MetaClientException("Construct message session factory failed.", e);
        }
    }
View Full Code Here

    }


    private void checkConfig(final MetaClientConfig metaClientConfig) throws MetaClientException {
        if (metaClientConfig == null) {
            throw new MetaClientException("null configuration");
        }
    }
View Full Code Here

                    new ZkClient(this.zkConfig.zkConnect, this.zkConfig.zkSessionTimeoutMs,
                        this.zkConfig.zkConnectionTimeoutMs, new ZkUtils.StringSerializer());
            this.metaZookeeper = new MetaZookeeper(this.zkClient, this.zkConfig.zkRoot);
        }
        else {
            throw new MetaClientException("No zk config offered");
        }
    }
View Full Code Here

            throws MetaClientException {
        try {
            return partitions.get(this.sets.incrementAndGet() % partitions.size());
        }
        catch (final Throwable t) {
            throw new MetaClientException(t);
        }
    }
View Full Code Here

        SubscriberInfo info = topicSubsriberRegistry.get(topic);
        if (info == null) {
            info = new SubscriberInfo(messageListener, consumerMessageFilter, maxSize);
            final SubscriberInfo oldInfo = topicSubsriberRegistry.putIfAbsent(topic, info);
            if (oldInfo != null) {
                throw new MetaClientException("Topic=" + topic + " has been subscribered by group " + group);
            }
        }
        else {
            throw new MetaClientException("Topic=" + topic + " has been subscribered by group " + group);
        }
    }
View Full Code Here

public abstract class AbstractPartitionSelector implements PartitionSelector {

    @Override
    public Partition getPartition(String topic, List<Partition> partitions, Message message) throws MetaClientException {
        if (partitions == null) {
            throw new MetaClientException("There is no aviable partition for topic " + topic
                + ",maybe you don't publish it at first?");
        }
        return this.getPartition0(topic, partitions, message);
    }
View Full Code Here

                this.consumerLoadBalanceListeners.putIfAbsent(fetchManager, task);
        if (existsTask == null) {
            task.run();
        }
        else {
            throw new MetaClientException("Consumer has been already registed");
        }

    }
View Full Code Here


    private TransactionContext getTx() throws MetaClientException {
        final TransactionContext ctx = this.transactionContext.get();
        if (ctx == null) {
            throw new MetaClientException("There is no transaction begun");
        }
        return ctx;
    }
View Full Code Here

                    // ѡ���broker�ڵ�ij������
                    partition =
                            this.producerZooKeeper.selectPartition(topic, message, this.partitionSelector, serverUrl);
                    if (partition == null) {
                        // û�п��÷������׳��쳣
                        throw new MetaClientException("There is no partitions in `" + serverUrl
                            + "` to send message with topic `" + topic + "` in a transaction");
                    }
                }
            }
            if (partition == null) {
                partition = this.selectPartition(message);
            }
            if (partition == null) {
                throw new MetaClientException("There is no aviable partition for topic " + topic
                    + ",maybe you don't publish it at first?");
            }
            if (serverUrl == null) {
                serverUrl = this.producerZooKeeper.selectBroker(topic, partition);
            }
            if (serverUrl == null) {
                throw new MetaClientException("There is no aviable server right now for topic " + topic
                    + " and partition " + partition + ",maybe you don't publish it at first?");
            }

            if (this.isInTransaction() && this.lastSentInfo.get() == null) {
                // ��һ�η��ͣ���Ҫ��������
                this.beforeSendMessageFirstTime(serverUrl);
            }

            final int flag = MessageFlagUtils.getFlag(message);
            final PutCommand putCommand =
                    new PutCommand(topic, partition.getPartition(), encodedData, flag, CheckSum.crc32(encodedData),
                        this.getTransactionId(), OpaqueGenerator.getNextOpaque());
            final BooleanCommand resp = this.invokeToGroup(serverUrl, partition, putCommand, message, timeout, unit);
            return this.genSendResult(message, partition, serverUrl, resp);
        }
        catch (final TimeoutException e) {
            throw new MetaOpeartionTimeoutException("Send message timeout in "
                    + TimeUnit.MILLISECONDS.convert(timeout, unit) + " mills");
        }
        catch (final InterruptedException e) {
            throw e;
        }
        catch (final MetaClientException e) {
            throw e;
        }
        catch (final Exception e) {
            throw new MetaClientException("send message failed", e);
        }
    }
View Full Code Here

TOP

Related Classes of com.taobao.metamorphosis.exception.MetaClientException

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.