The MQe servlet extends C servlet namejavax.servlet.http.HttpServlet and overrides methods for starting, stopping and handling new requests. The following code fragment starts a servlet:
C example
/** * Servlet initialization...... */ public void init(ServletConfig sc) throws ServletException { // Ensure supers constructor is called. super.init(sc); try { // Get the the server startup ini file String startupIni; if ((startupIni = getInitParameter("Startup")) == null) startupIni = defaultStartupInifile; // Load it MQeFields sections = MQeQueueManagerUtils.loadConfigFile(startupIni); // assign any class aliases MQeQueueManagerUtils.processAlias(sections); // Uncomment the following line to start trace before the queue // manager is started // MQeQueueManagerUtils.traceOn("MQeServlet Trace", null); // Start connection manager channelManager = MQeQueueManagerUtils.processChannelManager(sections); // check for any pre-loaded classes loadTable = MQeQueueManagerUtils.processPreLoad(sections); // setup and activate the queue manager queueManager = MQeQueueManagerUtils.processQueueManager(sections, channelManager.getGlobalHashtable( )); // Start ChannelTimer (convert time-out from secs to millisecs) int tI = sections.getFields(MQeQueueManagerUtils.Section_Listener).getInt ("TimeInterval"); long timeInterval = 1000 * tI; channelTimer = new MQeChannelTimer(channelManager, timeInterval); // Servlet initialization complete mqe.trace(1300, null); } catch (Exception e) { mqe.trace(1301, e.toString()); throw new ServletException(e.toString()); } }