Search in sources :

Example 6 with MetaServer

use of com.ctrip.xpipe.redis.meta.server.MetaServer in project x-pipe by ctripcorp.

the class AbstractDispatcherMetaServerController method populateModel.

@ModelAttribute
public void populateModel(@PathVariable final String clusterId, @RequestHeader(name = MetaServerService.HTTP_HEADER_FOWRARD, required = false) ForwardInfo forwardInfo, Model model, HttpServletRequest request) {
    if (forwardInfo != null) {
        logger.info("[populateModel]{},{}", clusterId, forwardInfo);
    }
    MetaServer metaServer = getMetaServer(clusterId, forwardInfo, request.getRequestURI());
    if (metaServer == null) {
        throw new UnfoundAliveSererException(clusterId, slotManager.getServerIdByKey(clusterId), currentMetaServer.getServerId());
    }
    model.addAttribute(MODEL_META_SERVER, metaServer);
    if (forwardInfo != null) {
        model.addAttribute(forwardInfo);
    }
}
Also used : UnfoundAliveSererException(com.ctrip.xpipe.redis.meta.server.rest.exception.UnfoundAliveSererException) MultiMetaServer(com.ctrip.xpipe.redis.meta.server.impl.MultiMetaServer) MetaServer(com.ctrip.xpipe.redis.meta.server.MetaServer) ModelAttribute(org.springframework.web.bind.annotation.ModelAttribute)

Aggregations

MetaServer (com.ctrip.xpipe.redis.meta.server.MetaServer)6 MultiMetaServer (com.ctrip.xpipe.redis.meta.server.impl.MultiMetaServer)2 ForwardInfo (com.ctrip.xpipe.redis.meta.server.rest.ForwardInfo)2 AbstractExceptionLogTask (com.ctrip.xpipe.concurrent.AbstractExceptionLogTask)1 META_SERVER_SERVICE (com.ctrip.xpipe.redis.core.metaserver.META_SERVER_SERVICE)1 AbstractMetaServerTest (com.ctrip.xpipe.redis.meta.server.AbstractMetaServerTest)1 SlotInfo (com.ctrip.xpipe.redis.meta.server.cluster.SlotInfo)1 MovingTargetException (com.ctrip.xpipe.redis.meta.server.rest.exception.MovingTargetException)1 UnfoundAliveSererException (com.ctrip.xpipe.redis.meta.server.rest.exception.UnfoundAliveSererException)1 Method (java.lang.reflect.Method)1 LinkedList (java.util.LinkedList)1 Around (org.aspectj.lang.annotation.Around)1 BaseMatcher (org.hamcrest.BaseMatcher)1 Description (org.hamcrest.Description)1 Test (org.junit.Test)1 ModelAttribute (org.springframework.web.bind.annotation.ModelAttribute)1