Package com.hazelcast.monitor

Examples of com.hazelcast.monitor.TimedMemberState


    public TimedMemberState createTimedMemberState() {
        MemberStateImpl memberState = new MemberStateImpl();
        createMemberState(memberState);
        GroupConfig groupConfig = instance.getConfig().getGroupConfig();
        TimedMemberState timedMemberState = new TimedMemberState();
        timedMemberState.setMaster(instance.node.isMaster());
        if (timedMemberState.getMaster()) {
            timedMemberState.setMemberList(new ArrayList<String>());
            Set<Member> memberSet = instance.getCluster().getMembers();
            for (Member member : memberSet) {
                MemberImpl memberImpl = (MemberImpl) member;
                Address address = memberImpl.getAddress();
                timedMemberState.getMemberList().add(address.getHost() + ":" + address.getPort());
            }
        }
        timedMemberState.setMemberState(memberState);
        timedMemberState.setClusterName(groupConfig.getName());
        timedMemberState.setInstanceNames(getLongInstanceNames());
        return timedMemberState;
    }
View Full Code Here


                HttpURLConnection connection = openConnection(url);
                OutputStream outputStream = connection.getOutputStream();
                try {
                    identifier.write(outputStream);
                    ObjectDataOutputStream out = serializationService.createObjectDataOutputStream(outputStream);
                    TimedMemberState timedMemberState = timedMemberStateFactory.createTimedMemberState();
                    timedMemberState.writeData(out);
                    outputStream.flush();
                    post(connection);
                } finally {
                    closeResource(outputStream);
                }
View Full Code Here

                OutputStream outputStream = connection.getOutputStream();
                final OutputStreamWriter writer = new OutputStreamWriter(outputStream, "UTF-8");
                try {
                    JsonObject root = new JsonObject();
                    root.add("identifier", identifier.toJson());
                    TimedMemberState timedMemberState = timedMemberStateFactory.createTimedMemberState();
                    root.add("timedMemberState", timedMemberState.toJson());
                    root.writeTo(writer);
                    writer.flush();
                    outputStream.flush();
                    post(connection);
                } finally {
View Full Code Here

    public TimedMemberState createTimedMemberState() {
        MemberStateImpl memberState = new MemberStateImpl();
        createMemberState(memberState);
        GroupConfig groupConfig = instance.getConfig().getGroupConfig();
        TimedMemberState timedMemberState = new TimedMemberState();
        timedMemberState.setMaster(instance.node.isMaster());
        timedMemberState.setMemberList(new ArrayList<String>());
        if (timedMemberState.getMaster()) {
            Set<Member> memberSet = instance.getCluster().getMembers();
            for (Member member : memberSet) {
                MemberImpl memberImpl = (MemberImpl) member;
                Address address = memberImpl.getAddress();
                timedMemberState.getMemberList().add(address.getHost() + ":" + address.getPort());
            }
        }
        timedMemberState.setMemberState(memberState);
        timedMemberState.setClusterName(groupConfig.getName());
        timedMemberState.setInstanceNames(getLongInstanceNames());
        return timedMemberState;
    }
View Full Code Here

    @Override
    public TimedMemberState createTimedMemberState() {
        MemberStateImpl memberState = new MemberStateImpl();
        createMemberState(memberState);
        GroupConfig groupConfig = instance.getConfig().getGroupConfig();
        TimedMemberState timedMemberState = new TimedMemberState();
        timedMemberState.setMaster(instance.node.isMaster());
        timedMemberState.setMemberList(new ArrayList<String>());
        if (timedMemberState.getMaster()) {
            Set<Member> memberSet = instance.getCluster().getMembers();
            for (Member member : memberSet) {
                MemberImpl memberImpl = (MemberImpl) member;
                Address address = memberImpl.getAddress();
                timedMemberState.getMemberList().add(address.getHost() + ":" + address.getPort());
            }
        }
        timedMemberState.setMemberState(memberState);
        timedMemberState.setClusterName(groupConfig.getName());
        timedMemberState.setInstanceNames(getLongInstanceNames());
        return timedMemberState;
    }
View Full Code Here

                OutputStream outputStream = connection.getOutputStream();
                final OutputStreamWriter writer = new OutputStreamWriter(outputStream, "UTF-8");
                try {
                    JsonObject root = new JsonObject();
                    root.add("identifier", identifier.toJson());
                    TimedMemberState timedMemberState = timedMemberStateFactory.createTimedMemberState();
                    root.add("timedMemberState", timedMemberState.toJson());
                    root.writeTo(writer);
                    writer.flush();
                    outputStream.flush();
                    post(connection);
                    if (manCenterConnectionLost) {
View Full Code Here

    @Test
    public void testSerialization() throws InterruptedException {
        HazelcastInstance hz = createHazelcastInstance();
        TimedMemberStateFactory timedMemberStateFactory = new DefaultTimedMemberStateFactory(getHazelcastInstanceImpl(hz));

        TimedMemberState state = timedMemberStateFactory.createTimedMemberState();
        JsonObject json = state.toJson();

        TimedMemberState deserialized = new TimedMemberState();
        deserialized.fromJson(json);

        assertNotNull(deserialized);
        assertEquals(state, deserialized);
    }
View Full Code Here

TOP

Related Classes of com.hazelcast.monitor.TimedMemberState

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.