Package com.alibaba.otter.shared.communication.core.model

Examples of com.alibaba.otter.shared.communication.core.model.CommunicationParam


        executor.shutdown();
    }

    public Object call(final String addr, final Event event) {
        Assert.notNull(this.factory, "No factory specified");
        CommunicationParam params = buildParams(addr);
        CommunicationConnection connection = null;
        int count = 0;
        Throwable ex = null;
        while (count++ < retry) {
            try {
View Full Code Here


    }

    // ===================== helper method ==================

    private CommunicationParam buildParams(String addr) {
        CommunicationParam params = new CommunicationParam();
        String[] strs = StringUtils.split(addr, ":");
        if (strs == null || strs.length != 2) {
            throw new IllegalArgumentException("addr example: 127.0.0.1:1099");
        }
        InetAddress address = null;
        try {
            address = InetAddress.getByName(strs[0]);
        } catch (UnknownHostException e) {
            throw new CommunicationException("addr_error", "addr[" + addr + "] is unknow!");
        }
        params.setIp(address.getHostAddress());
        params.setPort(Integer.valueOf(strs[1]));
        return params;
    }
View Full Code Here

    }

    @Test
    public void testSingle() {
        CommunicationConnectionFactory factory = new DubboCommunicationConnectionFactory();
        CommunicationParam param = new CommunicationParam();
        param.setIp("127.0.0.1");
        param.setPort(2088);
        CommunicationConnection connection = factory.createConnection(param);
        Object result = connection.call(new HeartEvent());
        want.object(result).notNull();
    }
View Full Code Here

    }

    @Test
    public void testSingle() {
        CommunicationConnectionFactory factory = new RmiCommunicationConnectionFactory();
        CommunicationParam param = new CommunicationParam();
        param.setIp("127.0.0.1");
        param.setPort(1099);
        CommunicationConnection connection = factory.createConnection(param);
        Object result = connection.call(new HeartEvent());
        want.object(result).notNull();
    }
View Full Code Here

    @Test
    public void testPool() {
        CommunicationConnectionFactory factory = new RmiCommunicationConnectionFactory();
        CommunicationConnectionFactory poolFactory = new CommunicationConnectionPoolFactory(factory);
        ((CommunicationConnectionPoolFactory) poolFactory).initial();
        CommunicationParam param = new CommunicationParam();
        param.setIp("127.0.0.1");
        param.setPort(1099);
        CommunicationRegistry.regist(PoolEventType.pool, new TestPoolService());

        CommunicationConnection last = null;
        for (int i = 0; i < 11; i++) {
            CommunicationConnection connection = null;
View Full Code Here

    @Test
    public void testPool_exhaust() {
        CommunicationConnectionFactory factory = new RmiCommunicationConnectionFactory();
        CommunicationConnectionFactory poolFactory = new CommunicationConnectionPoolFactory(factory);
        ((CommunicationConnectionPoolFactory) poolFactory).initial();
        CommunicationParam param = new CommunicationParam();
        param.setIp("127.0.0.1");
        param.setPort(1099);
        CommunicationRegistry.regist(PoolEventType.exhaust, new TestPoolService());

        ExecutorService executor = Executors.newCachedThreadPool();
        long start = System.currentTimeMillis();
        final CountDownLatch count = new CountDownLatch(11);
View Full Code Here

TOP

Related Classes of com.alibaba.otter.shared.communication.core.model.CommunicationParam

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.