001    /*
002      Copyright (C) 2001 Renaud Pawlak
003    
004      This program is free software; you can redistribute it and/or modify
005      it under the terms of the GNU Lesser General Public License as
006      published by the Free Software Foundation; either version 2 of the
007      License, or (at your option) any later version.
008    
009      This program is distributed in the hope that it will be useful,
010      but WITHOUT ANY WARRANTY; without even the implied warranty of
011      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
012      GNU Lesser General Public License for more details.
013    
014      You should have received a copy of the GNU Lesser General Public License
015      along with this program; if not, write to the Free Software
016      Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
017    
018    package org.objectweb.jac.aspects.distribution;
019    
020    /**
021     * This is the configuration interface of the load-balancing aspect
022     *
023     * @see LoadBalancingAC
024     * @author Renaud Pawlak
025     */
026    
027    public interface LoadBalancingConf {
028    
029       /**
030        * This configuration method allows the user to define a round-trip
031        * load-balancer on a replication group.
032        *
033        * <p>It assumes that a replication group exists on a set of host
034        * denoted by <code>replicaExpr</code>. It also assumes that an
035        * uncorrelated replica called <code>wrappeeName</code> exists on
036        * <code>hostName</code>. Note that this distributed scheme can be
037        * easilly obtained by configuring the deployment aspect for an
038        * object <code>myObject</code> like this:
039        *
040        * <pre>
041        * replicated "myObject" ".*[1-6]"
042        * </pre>
043        *
044        * <p>This means that <code>myObject</code> is replicated on all
045        * the hosts one to six and that the replicas are strongly
046        * consistent. Then, you can configure the load-balancing:
047        *
048        * <pre>
049        * addRoundTripLoadBalancer "photorepository0" ".*" "s0" ".*[1-6]"
050        * </pre>
051        *
052        * <p>Note that the round-trip balancer (located on s0) changes the
053        * replica it uses for each invocation. The followed sequence is
054        * 1,2,3,4,5,6,1,2,3,4,5,6,1,...
055        *
056        * <p>An alternative to the round-trip load-balancer is the random
057        * load-balancer that randomly picks out the next replica to
058        * use. This can be useful when a total decoralation is needed for
059        * all clients.
060        *
061        * @param wrappeeName the name of the object that is replicated and
062        * that will act as a load-balancer proxy 
063        * @param methods a pointcut expression for the method that perform
064        * the load-balancing (others perform local calls)
065        * @param hostName the host where the proxy load-balances
066        * @param replicaExpr a regular expression that matches all the
067        * hosts of the topology where the replicas are located
068        *
069        * @see #addRandomLoadBalancer(String,String,String,String) */
070        
071    
072       void addRoundTripLoadBalancer( String wrappeeName,
073                                      String methods,
074                                      String hostName, 
075                                      String replicaExpr );
076       
077       /**
078        * This configuration method allows the user to define a random
079        * load-balancer on a replication group.
080        *
081        * <p>It follows the same principles as a round-trip balancer but
082        * picks up the next replica to use randomly.
083        * 
084        * @see #addRoundTripLoadBalancer(String,String,String,String) */
085    
086       void addRandomLoadBalancer( String wrappeeName,
087                                   String methods,
088                                   String hostName, 
089                                   String replicaExpr );
090    
091    }
092    
093    
094    
095    
096    
097