Package org.jvnet.glassfish.comms.clb.core

Examples of org.jvnet.glassfish.comms.clb.core.ServerInstance


        if(clbMonitoringManager.isCLBMonitoringEnabled()){
            clbMonitoringManager.getCLBStatsUpdater().
                    incrementTotalIncomingSipRequestsFE();
        }
       
        ServerInstance serverInstance = router.selectInstance(req);
        if (serverInstance == null) {
            throw new SipRoutingException("Could not find a server");
        }

        String hashkey = req.getHashKey();

        request.setBeKey(hashkey);

        if (logger.isLoggable(Level.FINER)) {
            logger.log(Level.FINER,
                "Hash key: " + hashkey + "; server: " +
                serverInstance.getName()+"; isLocal: "+serverInstance.isLocalInstance());
        }

        if (serverInstance.isLocalInstance()) {
            if(clbMonitoringManager.isCLBMonitoringEnabled()){
                clbMonitoringManager.getCLBStatsUpdater().
                        incrementTotalLocalSipRequestsFE();
            }
            // Continue on this instance
            return null;
        } else {
            if(clbMonitoringManager.isCLBMonitoringEnabled()){
                clbMonitoringManager.getCLBStatsUpdater().
                        incrementTotalProxiedSipRequestsFE();
            }
            // Proxy to the other instance
            Socket serverAddress = getServerAddress(
                    serverInstance.getEndPoint(CLBConstants.SIP_PROTOCOL));
            Socket outgoingSocket =  null;
            //update via with proper param
            if(controller.getLocalInstance() != null){
                EndPoint endPoint = controller.getLocalInstance().getEndPoint(
                        CLBConstants.SIP_PROTOCOL);                             
View Full Code Here


                        clbMonitoringManager.getCLBStatsUpdater().
                                incrementTotalIncomingSipResponsesFE();
                    }
                    // This response was received from an external party and
                    // shall possibly be forwarded to a back-end
                    ServerInstance serverInstance =
                            getServerInstanceForResponse(response);

                    return handleResponseFromExternalParty(response,
                        serverInstance);
                }
View Full Code Here

                //remove the quotes around the beroute value
                instanceID = instanceID.substring(
                        1, (instanceID.length() - 1));
               
                ServerInstance serverInstance =
                    controller.getGlobalInstanceMap().
                        getServerInstance(instanceID);

                if (serverInstance == null) {
                    // Should never happen, drop response
View Full Code Here

     * @param req the request
     * @return an instance to server the specified request, or null if none was
     *         found.
     */
    public ServerInstance selectInstance(ConsistentHashRequest req) {
        ServerInstance server = stickyRouter.selectInstance(req);

        if (server != null) {
            return server;
        }

View Full Code Here

    protected ServerInstance getServerInstance(ConsistentHashRequest req) {
        if (req.getHashKey() == null) {
            return null;
        }

        ServerInstance server = null;

        if (requireIdealHash) {
            // First try "ideal" router
            server  = idealConsistentHash.get(req.getHashKey());
            if (server != null) {

                /* Need to select another instance from cluster in below cases
                 * 1. Instance is unhealthy
                 * 2. Instance is disabled. In consistent hash router,
                 *    we do not worry about instance being quiesced or not
                 */
                if (recoveringInstances.contains(server) ||
                        !server.isHealthy() ||
                        server.isDisabled()) {
                    if(req.isSticky() &&
                            clbMonitoringManager.isCLBMonitoringEnabled()){
                        if(req.isHttp()){
                            clbMonitoringManager.getCLBStatsUpdater().
                                    incrementTotalFailedOverHttpRequestsFE();
                        }else{
                            clbMonitoringManager.getCLBStatsUpdater().
                                    incrementTotalFailedOverSipRequestsFE();
                        }
                    }
                    //select another instance from cluster
                    server = ((ConsistentHashRouter) server.getServerCluster().
                            getClusterRouter(RouterFactory.LBPolicy_CONSISTENT_HASH)).selectInstance(req);
                }
            }
        }

View Full Code Here

    protected ServerInstance getActiveInstance(ConsistentHashRequest req) {
        if (req.getHashKey() == null) {
            return null;
        }

        ServerInstance server;
        server = actualConsistentHash.get(req.getHashKey());

        return server;
    }
View Full Code Here

    protected void removeFromRecoveringInstance(ServerInstance serverInstance) {
    }

    public void updateLoadFactor(String instanceName,
            double currFactor){
        ServerInstance instance = instancesMap.get(instanceName);
        if(instance != null){
            actualConsistentHash.addNode(instance, currFactor, true);
        }
        if(currFactor >= 1.0){
            removeFromRecoveringInstance(instance);
View Full Code Here

TOP

Related Classes of org.jvnet.glassfish.comms.clb.core.ServerInstance

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.