Search in sources :

Example 1 with UpdateManagementCenterUrlOperation

use of com.hazelcast.internal.management.operation.UpdateManagementCenterUrlOperation in project hazelcast by hazelcast.

the class ManagementCenterService method clusterWideUpdateManagementCenterUrl.

public byte[] clusterWideUpdateManagementCenterUrl(String groupName, String groupPass, String newUrl) {
    try {
        GroupConfig groupConfig = instance.getConfig().getGroupConfig();
        if (!(groupConfig.getName().equals(groupName) && groupConfig.getPassword().equals(groupPass))) {
            return HttpCommand.RES_403;
        }
        final Collection<Member> memberList = instance.node.clusterService.getMembers();
        for (Member member : memberList) {
            send(member.getAddress(), new UpdateManagementCenterUrlOperation(newUrl));
        }
        return HttpCommand.RES_204;
    } catch (Throwable throwable) {
        logger.warning("New Management Center url cannot be assigned.", throwable);
        return HttpCommand.RES_500;
    }
}
Also used : GroupConfig(com.hazelcast.config.GroupConfig) UpdateManagementCenterUrlOperation(com.hazelcast.internal.management.operation.UpdateManagementCenterUrlOperation) Member(com.hazelcast.core.Member)

Aggregations

GroupConfig (com.hazelcast.config.GroupConfig)1 Member (com.hazelcast.core.Member)1 UpdateManagementCenterUrlOperation (com.hazelcast.internal.management.operation.UpdateManagementCenterUrlOperation)1