📄 addressbase.java
字号:
for (int i = 0; i < len; i++) { if( attrs.getQName(i).equalsIgnoreCase("type") ) { setType(attrs.getValue(i).trim()); } else if( attrs.getQName(i).equalsIgnoreCase("version") ) { setVersion(attrs.getValue(i).trim()); } else if( attrs.getQName(i).equalsIgnoreCase("bootstrapHostname") ) { setBootstrapHostname(attrs.getValue(i).trim()); } else if( attrs.getQName(i).equalsIgnoreCase("hostname") ) { // deprecated -> use bootstrapHostname setBootstrapHostname(attrs.getValue(i).trim()); } else if( attrs.getQName(i).equalsIgnoreCase("bootstrapPort") ) { String ll = attrs.getValue(i).trim(); try { setBootstrapPort(new Integer(ll).intValue()); } catch (NumberFormatException e) { log.severe("Wrong format of <" + rootTag + " bootstrapPort='" + ll + "'>, expected an integer number."); } } else if( attrs.getQName(i).equalsIgnoreCase("port") ) { // deprecated -> use bootstrapPort String ll = attrs.getValue(i).trim(); try { setBootstrapPort(new Integer(ll).intValue()); } catch (NumberFormatException e) { log.severe("Wrong format of <" + rootTag + " port='" + ll + "'>, expected an integer number."); } } else if( attrs.getQName(i).equalsIgnoreCase("sessionId") ) { setSecretSessionId(attrs.getValue(i).trim()); } else if( attrs.getQName(i).equalsIgnoreCase("pingInterval") ) { String ll = attrs.getValue(i).trim(); try { setPingInterval(new Long(ll).longValue()); } catch (NumberFormatException e) { log.severe("Wrong format of <" + rootTag + " pingInterval='" + ll + "'>, expected a long in milliseconds."); } } else if( attrs.getQName(i).equalsIgnoreCase("retries") ) { String ll = attrs.getValue(i).trim(); try { setRetries(new Integer(ll).intValue()); } catch (NumberFormatException e) { log.severe("Wrong format of <" + rootTag + " retries='" + ll + "'>, expected an integer number."); } } else if( attrs.getQName(i).equalsIgnoreCase("delay") ) { String ll = attrs.getValue(i).trim(); try { setDelay(new Long(ll).longValue()); } catch (NumberFormatException e) { log.severe("Wrong format of <" + rootTag + " delay='" + ll + "'>, expected a long in milliseconds."); } } else if( attrs.getQName(i).equalsIgnoreCase("oneway") ) { setOneway(new Boolean(attrs.getValue(i).trim()).booleanValue()); } else if( attrs.getQName(i).equalsIgnoreCase("dispatcherActive") ) { setDispatcherActive(new Boolean(attrs.getValue(i).trim()).booleanValue()); } else if( attrs.getQName(i).equalsIgnoreCase("useForSubjectQueue") ) { this.useForSubjectQueue.setValue(new Boolean(attrs.getValue(i).trim()).booleanValue()); } else if( attrs.getQName(i).equalsIgnoreCase("dispatchPlugin") ) { this.dispatchPlugin.setValue(attrs.getValue(i).trim()); } else if( attrs.getQName(i).equalsIgnoreCase("stallOnPingTimeout") ) { this.stallOnPingTimeout.setValue(new Boolean(attrs.getValue(i).trim()).booleanValue()); } else { log.severe("Ignoring unknown attribute " + attrs.getQName(i) + " in " + rootTag + " section."); } } } if (getType() == null) { log.severe("Missing '" + rootTag + "' attribute 'type' in QoS"); setType("IOR"); } if (getSecretSessionId() == null) { log.warning("Missing '" + rootTag + "' attribute 'sessionId' QoS"); } return; } if (name.equalsIgnoreCase("burstMode")) { if (attrs != null) { int len = attrs.getLength(); int ii=0; for (ii = 0; ii < len; ii++) { if (attrs.getQName(ii).equalsIgnoreCase("collectTime")) { String ll = attrs.getValue(ii).trim(); try { setCollectTime(new Long(ll).longValue()); } catch (NumberFormatException e) { log.severe("Wrong format of <burstMode collectTime='" + ll + "'>, expected a long in milliseconds, burst mode is switched off sync messages."); } } else if( attrs.getQName(ii).equalsIgnoreCase("maxEntries") ) { String ll = attrs.getValue(ii).trim(); try { setBurstModeMaxEntries(new Integer(ll).intValue()); } catch (NumberFormatException e) { log.severe("Wrong format of <burstMode maxEntries='" + ll + "'>, expected an integer number."); } } else if( attrs.getQName(ii).equalsIgnoreCase("maxBytes") ) { String ll = attrs.getValue(ii).trim(); try { setBurstModeMaxBytes(new Long(ll).longValue()); } catch (NumberFormatException e) { log.severe("Wrong format of <burstMode maxBytes='" + ll + "'>, expected a long in bytes."); } } } } else { log.severe("Missing 'collectTime' attribute in login-qos <burstMode>"); } return; } if (name.equalsIgnoreCase("compress")) { if (attrs != null) { int len = attrs.getLength(); for (int ii = 0; ii < len; ii++) { if (attrs.getQName(ii).equalsIgnoreCase("type")) { setCompressType(attrs.getValue(ii).trim()); } else if (attrs.getQName(ii).equalsIgnoreCase("minSize")) { String ll = attrs.getValue(ii).trim(); try { setMinSize(new Long(ll).longValue()); } catch (NumberFormatException e) { log.severe("Wrong format of <compress minSize='" + ll + "'>, expected a long in bytes, compress is switched off."); } } } } else { log.severe("Missing 'type' attribute in qos <compress>"); } return; } if (name.equalsIgnoreCase("ptp")) { setPtpAllowed(true); character.setLength(0); return; } } /** * Handle SAX parsed end element */ public final void endElement(String uri, String localName, String name, StringBuffer character) { if (name.equalsIgnoreCase(rootTag)) { // "callback" String tmp = character.toString().trim(); // The address (if after inner tags) if (tmp.length() > 0) setRawAddress(tmp); else if (getRawAddress() == null) log.severe(rootTag + " QoS contains no rawAddress data"); } else if (name.equalsIgnoreCase("burstMode")) { } else if (name.equalsIgnoreCase("compress")) { } else if (name.equalsIgnoreCase("ptp")) { String tmp = character.toString().trim(); if (tmp.length() > 0) setPtpAllowed(new Boolean(tmp).booleanValue()); return; } character.setLength(0); } /** * Dump state of this object into a XML ASCII string. */ public final String toXml() { return toXml((String)null); } /** * Dump state of this object into a XML ASCII string. * <br> * Only none default values are dumped for performance reasons * @param extraOffset indenting of tags for nice output * @return The xml representation */ public final String toXml(String extraOffset) { StringBuffer sb = new StringBuffer(1200); if (extraOffset == null) extraOffset = ""; String offset = Constants.OFFSET + extraOffset; sb.append(offset).append("<").append(rootTag).append(" type='").append(getType()).append("'"); // For debugging only: //sb.append(" nodeId='").append(this.nodeId).append("'"); //sb.append(" context='").append(this.context).append("'"); //sb.append(" className='").append(this.className).append("'"); //sb.append(" instanceName='").append(this.instanceName).append("'"); //sb.append(" envPrefix='").append(this.envPrefix).append("'"); if (this.version.isModified()) sb.append(" version='").append(getVersion()).append("'"); if (this.bootstrapHostname.isModified()) sb.append(" bootstrapHostname='").append(getBootstrapHostname()).append("'"); if (this.bootstrapPort.isModified()) sb.append(" bootstrapPort='").append(getBootstrapPort()).append("'"); if (this.sessionId.isModified()) sb.append(" sessionId='").append(getSecretSessionId()).append("'"); if (this.pingInterval.isModified()) sb.append(" pingInterval='").append(getPingInterval()).append("'"); if (this.retries.isModified()) sb.append(" retries='").append(getRetries()).append("'"); if (this.delay.isModified()) sb.append(" delay='").append(getDelay()).append("'"); if (this.oneway.isModified()) sb.append(" oneway='").append(oneway()).append("'"); if (this.dispatcherActive.isModified()) sb.append(" dispatcherActive='").append(isDispatcherActive()).append("'"); if (this.useForSubjectQueue.isModified()) sb.append(" useForSubjectQueue='").append(this.useForSubjectQueue.getValue()).append("'"); if (this.dispatchPlugin.isModified()) sb.append(" dispatchPlugin='").append(this.dispatchPlugin.getValue()).append("'"); if (this.stallOnPingTimeout.isModified()) sb.append(" stallOnPingTimeout='").append(isStallOnPingTimeout()).append("'"); sb.append(">"); sb.append(offset).append(" ").append(getRawAddress()); if (this.collectTime.isModified() || this.burstModeMaxEntries.isModified() || this.burstModeMaxBytes.isModified()) { sb.append(offset).append(" ").append("<burstMode"); if (this.collectTime.isModified()) sb.append(" collectTime='").append(getCollectTime()).append("'"); if (this.burstModeMaxEntries.isModified()) sb.append(" maxEntries='").append(getBurstModeMaxEntries()).append("'"); if (this.burstModeMaxBytes.isModified()) sb.append(" maxBytes='").append(getBurstModeMaxBytes()).append("'"); sb.append("/>"); } if (this.compressType.isModified()) sb.append(offset).append(" ").append("<compress type='").append(getCompressType()).append("' minSize='").append(getMinSize()).append("'/>"); if (this.ptpAllowed.isModified()) { if (this.ptpAllowed.getValue()) { sb.append(offset).append(" ").append("<ptp/>"); } else { sb.append(offset).append(" ").append("<ptp>").append(this.ptpAllowed).append("</ptp>"); } } if (this.pluginAttributes != null) { Iterator it = this.pluginAttributes.getClientPropertyMap().values().iterator(); while (it.hasNext()) { Object obj = it.next(); EncodableData cp = (EncodableData)obj; sb.append(cp.toXml(offset+" ", ClientProperty.ATTRIBUTE_TAG)); } } sb.append(offset).append("</").append(rootTag).append(">"); return sb.toString(); } /** * Get a usage string for the connection parameters. * Currently only for client side usage */ public String usage() { String text = ""; //text += " -oneway Shall the publish() messages be send oneway (no application level ACK) [" + Address.DEFAULT_oneway + "]\n"; text += " -dispatch/" + this.instanceName + "/protocol\n"; text += " Protocol to use [" + DEFAULT_type + "]\n"; // text += " -dispatch/" + this.instanceName + "/plugin/" + this.type + "/port\n"; // text += " Port to use for the protocol [" + DEFAULT_port + "]\n"; text += " -dispatch/" + this.instanceName + "/pingInterval\n"; text += " Pinging every given milliseconds [" + getDefaultPingInterval() + "]\n"; text += " 0 switches pinging off\n"; text += " -dispatch/" + this.instanceName + "/retries\n"; text += " How often to retry if connection fails (-1 is forever) [" + getDefaultRetries() + "]\n"; text += " Set to -1 for failsafe operation\n"; text += " -dispatch/" + this.instanceName + "/delay\n"; text += " Delay between connection retries in milliseconds [" + getDefaultDelay() + "]\n"; text += " A delay value > 0 switches fails save mode on, 0 switches it off\n"; text += " -dispatch/" + this.instanceName + "/stallOnPingTimeout\n"; text += " if true it will set the 'stalled' flag in the dispatch statistics instead of\n"; text += " going in polling mode when a ping response timeout occurs. Default is false\n"; // other settings like burstMode are in the derived classes return text; }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -