Methods Summary |
---|
protected void | checkParameter()check correct lb and worker pararmeter
if (worker == null) {
throw new BuildException("Must specify 'worker' attribute");
}
if (workerType == null) {
throw new BuildException("Must specify 'workerType' attribute");
}
if ("lb".equals(workerType)) {
if (lbRecovertime == null && lbRetries == null) {
throw new BuildException(
"Must specify at a lb worker either 'lbRecovertime' or"
+ "'lbRetries' attribute");
}
if (lbStickySession == null || lbForceSession == null) {
throw new BuildException("Must specify at a lb worker either"
+ "'lbStickySession' and 'lbForceSession' attribute");
}
if (null != lbRecovertime && 60 < lbRecovertime.intValue()) {
throw new BuildException(
"The 'lbRecovertime' must be greater than 59");
}
if (null != lbRetries && 1 < lbRetries.intValue()) {
throw new BuildException(
"The 'lbRetries' must be greater than 1");
}
isLBMode = true;
} else if ("worker".equals(workerType)) {
if (workerDisabled == null) {
throw new BuildException(
"Must specify at a node worker 'workerDisabled' attribute");
}
if (workerStopped == null) {
throw new BuildException(
"Must specify at a node worker 'workerStopped' attribute");
}
if (workerLoadFactor == null ) {
throw new BuildException(
"Must specify at a node worker 'workerLoadFactor' attribute");
}
if (workerClusterDomain == null) {
throw new BuildException(
"Must specify at a node worker 'workerClusterDomain' attribute");
}
if (workerRedirect == null) {
throw new BuildException(
"Must specify at a node worker 'workerRedirect' attribute");
}
if (workerLb == null) {
throw new BuildException("Must specify 'workerLb' attribute");
}
if (workerLoadFactor.intValue() < 1) {
throw new BuildException(
"The 'workerLoadFactor' must be greater or equal 1");
}
isLBMode = false;
} else {
throw new BuildException(
"Only 'lb' and 'worker' supported as workerType attribute");
}
|
private java.lang.StringBuffer | createLink()Create JkStatus link
- load balance example:
http://localhost/status?cmd=update&mime=txt&w=lb&lf=false&ls=true
- worker example:
http://localhost/status?cmd=update&mime=txt&w=node1&l=lb&wf=1&wd=false&ws=false
// Building URL
StringBuffer sb = new StringBuffer();
try {
sb.append("?cmd=update&mime=txt");
sb.append("&w=");
sb.append(URLEncoder.encode(worker, getCharset()));
if (isLBMode) {
//http://localhost/status?cmd=update&mime=txt&w=lb&lf=false&ls=true
if ((lbRetries != null)) { // > 0
sb.append("&lr=");
sb.append(lbRetries);
}
if ((lbRecovertime != null)) { // > 59
sb.append("<=");
sb.append(lbRecovertime);
}
if ((lbStickySession != null)) {
sb.append("&ls=");
sb.append(lbStickySession);
}
if ((lbForceSession != null)) {
sb.append("&lf=");
sb.append(lbForceSession);
}
} else {
//http://localhost/status?cmd=update&mime=txt&w=node1&l=lb&wf=1&wd=false&ws=false
if ((workerLb != null)) { // must be configured
sb.append("&l=");
sb.append(URLEncoder.encode(workerLb, getCharset()));
}
if ((workerLoadFactor != null)) { // >= 1
sb.append("&wf=");
sb.append(workerLoadFactor);
}
if ((workerDisabled != null)) {
sb.append("&wd=");
sb.append(workerDisabled);
}
if ((workerStopped != null)) {
sb.append("&ws=");
sb.append(workerStopped);
}
if ((workerRedirect != null)) { // other worker conrecte lb's
sb.append("&wr=");
}
if ((workerClusterDomain != null)) {
sb.append("&wc=");
sb.append(URLEncoder.encode(workerClusterDomain,
getCharset()));
}
}
} catch (UnsupportedEncodingException e) {
throw new BuildException("Invalid 'charset' attribute: "
+ getCharset());
}
return sb;
|
public void | execute()Execute the requested operation.
super.execute();
checkParameter();
StringBuffer sb = createLink();
execute(sb.toString(), null, null, -1);
|
public int | getInternalid()
return internalid;
|
public java.lang.Boolean | getLbForceSession()
return lbForceSession;
|
public java.lang.Integer | getLbRecovertime()
return lbRecovertime;
|
public java.lang.Integer | getLbRetries()
return lbRetries;
|
public java.lang.Boolean | getLbStickySession()
return lbStickySession;
|
public java.lang.String | getWorker()
return worker;
|
public java.lang.String | getWorkerClusterDomain()
return workerClusterDomain;
|
public java.lang.Boolean | getWorkerDisabled()
return workerDisabled;
|
public java.lang.String | getWorkerLb()
return workerLb;
|
public java.lang.Integer | getWorkerLoadFactor()
return workerLoadFactor;
|
public java.lang.String | getWorkerRedirect()
return workerRedirect;
|
public java.lang.Boolean | getWorkerStopped()
return workerStopped;
|
public java.lang.String | getWorkerType()
return workerType;
|
public void | setInternalid(int internalid)
this.internalid = internalid;
|
public void | setLbForceSession(java.lang.Boolean lbForceSession)
this.lbForceSession = lbForceSession;
|
public void | setLbRecovertime(java.lang.Integer lbRecovertime)
this.lbRecovertime = lbRecovertime;
|
public void | setLbRetries(java.lang.Integer lbRetries)
this.lbRetries = lbRetries;
|
public void | setLbStickySession(java.lang.Boolean lbStickySession)
this.lbStickySession = lbStickySession;
|
public void | setWorker(java.lang.String worker)
this.worker = worker;
|
public void | setWorkerClusterDomain(java.lang.String workerClusterDomain)
this.workerClusterDomain = workerClusterDomain;
|
public void | setWorkerDisabled(java.lang.Boolean workerDisabled)
this.workerDisabled = workerDisabled;
|
public void | setWorkerLb(java.lang.String workerLb)
this.workerLb = workerLb;
|
public void | setWorkerLoadFactor(java.lang.Integer workerLoadFactor)
this.workerLoadFactor = workerLoadFactor;
|
public void | setWorkerRedirect(java.lang.String workerRedirect)
this.workerRedirect = workerRedirect;
|
public void | setWorkerStopped(java.lang.Boolean workerStopped)
this.workerStopped = workerStopped;
|
public void | setWorkerType(java.lang.String workerType)
this.workerType = workerType;
|