Search in sources :

Example 6 with GroupInstance

use of info.xiancloud.core.distribution.service_discovery.GroupInstance in project xian by happyyangyuan.

the class GroupRegistrationBridge method groupInstance.

static GroupInstance groupInstance(GroupProxy groupProxy, NodeStatus nodeStatus) {
    GroupInstance groupInstance = new GroupInstance();
    groupInstance.setRegistrationTimestamp(nodeStatus.getInitTime());
    groupInstance.setPort(nodeStatus.getPort());
    groupInstance.setName(groupProxy.getName());
    groupInstance.setEnabled(true);
    groupInstance.setAddress(nodeStatus.getHost());
    groupInstance.setGroupInstanceIdBean(new GroupInstanceIdBean(groupProxy.getName(), LocalNodeManager.LOCAL_NODE_ID));
    groupInstance.setPayload(groupProxy);
    return groupInstance;
}
Also used : GroupInstanceIdBean(info.xiancloud.core.distribution.service_discovery.GroupInstanceIdBean) GroupInstance(info.xiancloud.core.distribution.service_discovery.GroupInstance)

Example 7 with GroupInstance

use of info.xiancloud.core.distribution.service_discovery.GroupInstance in project xian by happyyangyuan.

the class GroupUnregistrationBridge method execute.

@Override
public UnitResponse execute(UnitRequest request) {
    GroupProxy groupProxy = request.get("group", GroupProxy.class);
    NodeStatus nodeStatus = request.get("nodeStatus", NodeStatus.class);
    GroupInstance groupInstance = GroupRegistrationBridge.groupInstance(groupProxy, nodeStatus);
    try {
        GroupDiscovery.singleton.unregister(groupInstance);
        return UnitResponse.success();
    } catch (Exception e) {
        return UnitResponse.failure(e, "group注销失败.");
    }
}
Also used : GroupProxy(info.xiancloud.core.distribution.GroupProxy) GroupInstance(info.xiancloud.core.distribution.service_discovery.GroupInstance) NodeStatus(info.xiancloud.core.distribution.NodeStatus)

Aggregations

GroupInstance (info.xiancloud.core.distribution.service_discovery.GroupInstance)7 GroupOfflineException (info.xiancloud.core.distribution.exception.GroupOfflineException)4 GroupInstanceIdBean (info.xiancloud.core.distribution.service_discovery.GroupInstanceIdBean)2 JSONObject (com.alibaba.fastjson.JSONObject)1 GroupProxy (info.xiancloud.core.distribution.GroupProxy)1 NodeStatus (info.xiancloud.core.distribution.NodeStatus)1 GroupUndefinedException (info.xiancloud.core.distribution.exception.GroupUndefinedException)1 UnitResponse (info.xiancloud.core.message.UnitResponse)1 DiyMonitorGroup (info.xiancloud.core.support.falcon.DiyMonitorGroup)1 HashMap (java.util.HashMap)1 HashSet (java.util.HashSet)1