Changes

Jump to: navigation, search

Template Method

884 bytes added, 19:56, 19 March 2007
Apache Tomcat
The following are portions of the code found in [https://svn.apache.org/repos/asf/tomcat/connectors/trunk/jk/java/org/apache/jk/common/Shm.java[Shm.java]] and
[https://svn.apache.org/repos/asf/tomcat/connectors/trunk/jk/java/org/apache/jk/common/Shm14.java[Shm14.java]]<br/><br/>
Looking at the '''Shm14.java''', we can conclude that '''Shm.java''' is the base class while ''''Shm14.java'''' is the subclass. As you can seeIn addition, ''''Shm .java''' 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 int invoke(Msg msg, MsgContext ep )
throws IOException
{
if( apr==null ) return 0;
log.debug("ChannelShm.invoke: " + ep );
super.nativeDispatch( msg, ep, JK_HANDLE_SHM_DISPATCH, 0 );
return 0;
}
</pre>
In the ''''Shm14.java'''' file, the method from the base class is overridden with the following new one - its implementation changed, but the same structure.
<pre>
public int invoke(Msg msg, MsgContext ep )
throws IOException
{
if (log.isDebugEnabled())
log.debug("ChannelShm14.invoke: " + ep );
 
//
return 0;
}
</pre>
Source from [https://svn.apache.org/repos/asf/tomcat/connectors/trunk/jk/java/org/apache/jk/common/ | Apache Tomcat Sample Code via Google Code Search]
== References ==
1
edit

Navigation menu