|
SmartFrog 3.10.000 | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.smartfrog.sfcore.reference.RemoteReferenceResolverHelperImpl
org.smartfrog.sfcore.prim.PrimImpl
org.smartfrog.examples.dynamicwebserver.balancer.BalancerImpl
public class BalancerImpl
Title: BalancerImpl.
Description: BalancerImpl is the main class for a software load balancer for socket connections between a set of clients and a set of servers. The clients connect to a specific port on the balancer host and the balancer selects a server to handle the client session. The balancer opens a socket connection to the selected server and relays data between the client and the server. The balancer listens for client connections on a well-known port, specified by the "port" SmartFrog parameter.
The Balancer maintains a set of servers that are included in the selection algorithm for balancing. The curent selection algorithm is round-robin. An initial set of servers can be specified via the "hosts" SmartFrog parameter; if "hosts" is specified, the parameter "hostsPort" is used to specify the port number to connect to on the servers. Subsequent changes to the set of servers can be made at run-time via the Balancer remote interface; in this case the port number for each host can be specified individually.
| Field Summary |
|---|
| Fields inherited from class org.smartfrog.sfcore.prim.PrimImpl |
|---|
refLivenessDelay, refLivenessFactor, sfCompleteName, sfContext, sfDeployHooks, sfDeployWithHooks, sfExportRef, sfIsDeployed, sfIsStarted, sfIsTerminated, sfIsTerminating, sfLivenessCount, sfLivenessDelay, sfLivenessFactor, sfLivenessSender, sfParent, sfStartHooks, sfTerminateWithHooks, termLock |
| Fields inherited from interface org.smartfrog.examples.dynamicwebserver.balancer.Balancer |
|---|
HOSTS, HOSTSPORT, LOGTO, NAME, PORT |
| Constructor Summary | |
|---|---|
BalancerImpl()
Constructor for the Balancer component |
|
| Method Summary | |
|---|---|
void |
addServer(java.lang.String hostname)
Implementation of the Balancer interface |
void |
addServer(java.lang.String hostname,
int port)
Implementation of the Balancer interface |
int |
getData()
implementation of DataSource interface resets the data after every request - so only suited to single requestor |
static void |
main(java.lang.String[] args)
Used to start the component from the command line. |
void |
removeServer(java.lang.String hostname)
Implementation of the Balancer interface |
void |
sfDeploy()
Standard sfDeploy(). |
void |
sfStart()
Standard sfStart(). |
void |
sfTerminateWith(TerminationRecord tr)
Standard sfTerminateWith() |
void |
stop()
Stop the load balancer. |
java.lang.String |
toString()
Returns textual representation. |
| Methods inherited from class org.smartfrog.sfcore.reference.RemoteReferenceResolverHelperImpl |
|---|
sfResolve, sfResolve, sfResolve, sfResolve, sfResolve, sfResolve, sfResolve, sfResolve, sfResolve, sfResolve, sfResolve, sfResolve, sfResolve, sfResolve, sfResolve, sfResolve, sfResolve, sfResolve, sfResolve, sfResolve, sfResolve, sfResolve, sfResolve, sfResolve, sfResolve, sfResolve, sfResolve, sfResolve, sfResolve, sfResolve, sfResolve, sfResolve, sfResolve, sfResolve, sfResolve, sfResolve, sfResolve, sfResolve, sfResolve, sfResolve, sfResolve, sfResolve, sfResolve, sfResolveWithParser |
| Methods inherited from class java.lang.Object |
|---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface org.smartfrog.sfcore.prim.Prim |
|---|
sfAddAttribute, sfAttributeKeyFor, sfAttributes, sfCompleteName, sfContainsAttribute, sfContainsValue, sfContext, sfDeployedHost, sfDeployedProcessName, sfDeployWith, sfDetach, sfDetachAndTerminate, sfDumpState, sfIsDeployed, sfIsStarted, sfIsTerminated, sfIsTerminating, sfParent, sfParentageChanged, sfRemoveAttribute, sfReplaceAttribute, sfTerminate, sfTerminatedWith, sfTerminateQuietlyWith, sfValues |
| Methods inherited from interface org.smartfrog.sfcore.prim.Liveness |
|---|
sfPing |
| Methods inherited from interface org.smartfrog.sfcore.reference.RemoteReferenceResolver |
|---|
sfResolve, sfResolve, sfResolveHere, sfResolveHere, sfResolveParent |
| Methods inherited from interface org.smartfrog.sfcore.reference.RemoteReferenceResolverHelper |
|---|
sfResolve, sfResolve, sfResolve, sfResolve, sfResolve, sfResolve, sfResolve, sfResolve, sfResolve, sfResolve, sfResolve, sfResolve, sfResolve, sfResolve, sfResolve, sfResolve, sfResolve, sfResolve, sfResolve, sfResolve, sfResolve, sfResolve, sfResolve, sfResolve, sfResolve, sfResolve, sfResolve, sfResolve, sfResolve, sfResolve, sfResolve, sfResolve, sfResolve, sfResolve, sfResolve, sfResolve, sfResolve, sfResolve, sfResolve, sfResolve, sfResolve, sfResolve, sfResolve, sfResolveWithParser |
| Methods inherited from interface org.smartfrog.sfcore.prim.Diagnostics |
|---|
sfDiagnosticsReport |
| Constructor Detail |
|---|
public BalancerImpl()
throws java.rmi.RemoteException
java.rmi.RemoteException - in case of Remote/network error| Method Detail |
|---|
public void addServer(java.lang.String hostname,
int port)
addServer in interface Balancerhostname - The host name of the new serverport - The port number on the new server used open the connection
from the balancerpublic void addServer(java.lang.String hostname)
addServer in interface Balancerhostname - The host name of the new serverpublic void removeServer(java.lang.String hostname)
removeServer in interface Balancerhostname - The host name of the server to remove from the set
public int getData()
throws java.rmi.RemoteException
getData in interface DataSourcejava.rmi.RemoteException - in case of Remote/network errorpublic void stop()
public static void main(java.lang.String[] args)
args - command line argumentspublic java.lang.String toString()
toString in class PrimImpl
public void sfDeploy()
throws SmartFrogException,
java.rmi.RemoteException
sfDeploy in interface PrimsfDeploy in class PrimImplSmartFrogException - error while deploying
java.rmi.RemoteException - In case of network/rmi error
public void sfStart()
throws SmartFrogException,
java.rmi.RemoteException
sfStart in interface PrimsfStart in class PrimImplSmartFrogException - error while starting
java.rmi.RemoteException - In case of network/rmi errorpublic void sfTerminateWith(TerminationRecord tr)
sfTerminateWith in class PrimImpltr - TerminationRecord object
|
SmartFrog CORE 3.10.000 | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||