public void initService() throws ConfigurationException { initSpaceAndQueues(); NameRegistrar.register (getName(), this); } public void startService () {
protected void initSpaceAndQueues () throws ConfigurationException { Element persist = getPersist (); sp = grabSpace (persist.getChild ("space")); in = persist.getChildTextTrim ("in"); out = persist.getChildTextTrim ("out"); writeOnly = "yes".equalsIgnoreCase (getPersist().getChildTextTrim ("write-only")); if (in == null || (out == null && !writeOnly)) { throw new ConfigurationException ("Misconfigured channel. Please verify in/out queues"); } String s = persist.getChildTextTrim ("reconnect-delay"); delay = s != null ? Long.parseLong (s) : 10000; // reasonable default keepAlive = "yes".equalsIgnoreCase (persist.getChildTextTrim ("keep-alive")); ignoreISOExceptions = "yes".equalsIgnoreCase (persist.getChildTextTrim ("ignore-iso-exceptions")); String t = persist.getChildTextTrim("timeout"); timeout = t != null && t.length() > 0 ? Long.parseLong(t) : 0l; ready = getName() + ".ready"; reconnect = getName() + ".reconnect"; waitForWorkersOnStop = "yes".equalsIgnoreCase(persist.getChildTextTrim ("wait-for-workers-on-stop")); }
public ISOChannel newChannel (Element e, QFactory f) throws ConfigurationException { String channelName = e.getAttributeValue ("class"); String packagerName = e.getAttributeValue ("packager"); ISOChannel channel = (ISOChannel) f.newInstance (channelName); ISOPackager packager; if (packagerName != null) { packager = (ISOPackager) f.newInstance (packagerName); channel.setPackager (packager); f.setConfiguration (packager, e); } QFactory.invoke (channel, "setHeader", e.getAttributeValue ("header")); f.setLogger (channel, e); f.setConfiguration (channel, e); if (channel instanceof FilteredChannel) { addFilters ((FilteredChannel) channel, e, f); } if (channel instanceof ExceptionHandlerAware) { addExceptionHandlers((ExceptionHandlerAware) channel, e, f); } if (getName () != null) channel.setName (getName ()); return channel; }
protected ISOChannel initChannel () throws ConfigurationException { Element persist = getPersist (); Element e = persist.getChild ("channel"); if (e == null) throw new ConfigurationException ("channel element missing"); ISOChannel c = newChannel (e, getFactory()); String socketFactoryString = getSocketFactory(); if (socketFactoryString != null && c instanceof FactoryChannel) { ISOClientSocketFactory sFac = (ISOClientSocketFactory) getFactory().newInstance(socketFactoryString); if (sFac != null && sFac instanceof LogSource) { ((LogSource) sFac).setLogger(log.getLogger(),getName() + ".socket-factory"); } getFactory().setConfiguration (sFac, e); ((FactoryChannel)c).setSocketFactory(sFac); } return c; } protected void initSpaceAndQueues () throws ConfigurationException {