Changes

Jump to: navigation, search

Template Method

601 bytes added, 19:46, 19 March 2007
Apache Tomcat
Looking at the '''Shm14.java''', we can conclude that '''Shm.java''' is the base class while ''''Shm14.java'''' is the subclass. As you can see, Shm also extends to '''JniHandler''', making it a subclass of that class.
<pre>
// from From Shm14.java
public class Shm14 extends Shm {
}
</pre>
<pre>
// from From Shm.java
public class Shm extends JniHandler {
}
</pre>
From the file '''Shm.java''', the following method is given.
<pre>
public void resetScoreboard() throws IOException {
if( apr==null ) return;
MsgContext mCtx=createMsgContext();
Msg msg=(Msg)mCtx.getMsg(0);
msg.reset();
 
msg.appendByte( SHM_RESET );
this.invoke( msg, mCtx );
}
</pre>
In the ''''Shm14.java'''' file, the method from the base class is overridden with the following new one. Its implementation is different.
<pre>
public void resetScoreboard() throws IOException {
// XXX Need to write the head
}
</pre>
1
edit

Navigation menu