| Method from org.apache.jk.server.JkCoyoteHandler Detail: |
public void destroy() {
if( !started ) return;
started = false;
getJkMain().stop();
}
|
public Adapter getAdapter() {
return adapter;
}
|
public Object getAttribute(String name) {
return getJkMain().getProperty(name);
}
Retrieve config info.
Primarily for use with the admin webapp. |
public Iterator getAttributeNames() {
return properties.keySet().iterator();
}
|
public JkMain getJkMain() {
if( jkMain == null ) {
jkMain=new JkMain();
jkMain.setWorkerEnv(wEnv);
}
return jkMain;
}
|
public String getProperty(String name) {
return properties.getProperty(name) ;
}
|
public void init() {
if( started ) return;
started=true;
if( wEnv==null ) {
// we are probably not registered - not very good.
wEnv=getJkMain().getWorkerEnv();
wEnv.addHandler("container", this );
}
try {
// jkMain.setJkHome() XXX;
getJkMain().init();
} catch( Exception ex ) {
log.error("Error during init",ex);
}
}
|
public int invoke(Msg msg,
MsgContext ep) throws IOException {
if( ep.isLogTimeEnabled() )
ep.setLong( MsgContext.TIMER_PRE_REQUEST, System.currentTimeMillis());
Request req=ep.getRequest();
Response res=req.getResponse();
if( log.isDebugEnabled() )
log.debug( "Invoke " + req + " " + res + " " + req.requestURI().toString());
res.setNote( epNote, ep );
ep.setStatus( MsgContext.JK_STATUS_HEAD );
RequestInfo rp = req.getRequestProcessor();
rp.setStage(Constants.STAGE_SERVICE);
try {
adapter.service( req, res );
} catch( Exception ex ) {
log.info("Error servicing request " + req,ex);
}
if(ep.getStatus() != MsgContext.JK_STATUS_CLOSED) {
res.finish();
}
req.recycle();
req.updateCounters();
res.recycle();
ep.recycle();
if( ep.getStatus() == MsgContext.JK_STATUS_ERROR ) {
return ERROR;
}
ep.setStatus( MsgContext.JK_STATUS_NEW );
rp.setStage(Constants.STAGE_KEEPALIVE);
return OK;
}
|
public void pause() throws Exception {
if(!paused) {
paused = true;
getJkMain().pause();
}
}
|
public ObjectName preRegister(MBeanServer server,
ObjectName oname) throws Exception {
// override - we must be registered as "container"
this.name="container";
return super.preRegister(server, oname);
}
|
public void resume() throws Exception {
if(paused) {
paused = false;
getJkMain().resume();
}
}
|
public void setAdapter(Adapter adapter) {
this.adapter=adapter;
}
The adapter, used to call the connector |
public void setAttribute(String name,
Object value) {
if( log.isDebugEnabled())
log.debug("setAttribute " + name + " " + value );
if( value instanceof String )
this.setProperty( name, (String)value );
}
|
public void setProperty(String name,
String value) {
if( log.isTraceEnabled())
log.trace("setProperty " + name + " " + value );
getJkMain().setProperty( name, value );
properties.put( name, value );
}
Set a property. Name is a "component.property". JMX should
be used instead. |
public void start() {
try {
if( oname != null && getJkMain().getDomain() == null) {
try {
ObjectName jkmainOname =
new ObjectName(oname.getDomain() + ":type=JkMain");
Registry.getRegistry(null, null)
.registerComponent(getJkMain(), jkmainOname, "JkMain");
} catch (Exception e) {
log.error( "Error registering jkmain " + e );
}
}
getJkMain().start();
} catch( Exception ex ) {
log.error("Error during startup",ex);
}
}
|