⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 queuepropertybase.java

📁 java开源的企业总线.xmlBlaster
💻 JAVA
📖 第 1 页 / 共 3 页
字号:
    */   public final void startElement(String uri, String localName, String name, Attributes attrs) {      if (attrs != null) {         int len = attrs.getLength();         int ii=0;         for (ii = 0; ii < len; ii++) {            if (attrs.getQName(ii).equalsIgnoreCase("relating")) {               setRelating(attrs.getValue(ii).trim());            }            else if (attrs.getQName(ii).equalsIgnoreCase("maxEntries")) {               String tmp = attrs.getValue(ii).trim();               try {                  setMaxEntriesUnchecked(new Long(tmp).longValue());               } catch (NumberFormatException e) {                  log.severe("Wrong format of <" + getRootTagName() + " maxEntries='" + tmp + "'>, expected a long, using default.");               }            }            else if (attrs.getQName(ii).equalsIgnoreCase("type")) {               setType(attrs.getValue(ii).trim());            }            else if (attrs.getQName(ii).equalsIgnoreCase("debug")) {               String tmp = attrs.getValue(ii).trim();               try {                  setDebug(new Boolean(tmp).booleanValue());               } catch (NumberFormatException e) {                  log.severe("Wrong format of <" + getRootTagName() + " debug='" + tmp + "'>, expected a boolean, using default.");               }            }            else if (attrs.getQName(ii).equalsIgnoreCase("version")) {               setVersion(attrs.getValue(ii).trim());            }            else if (attrs.getQName(ii).equalsIgnoreCase("maxEntriesCache")) {               String tmp = attrs.getValue(ii).trim();               try {                  setMaxEntriesCacheUnchecked(new Long(tmp).longValue());               } catch (NumberFormatException e) {                  log.severe("Wrong format of <" + getRootTagName() + " maxEntriesCache='" + tmp + "'>, expected an long, using default.");               }            }            else if (attrs.getQName(ii).equalsIgnoreCase("maxBytes")) {               String tmp = attrs.getValue(ii).trim();               try {                  setMaxBytesUnchecked(new Long(tmp).longValue());               } catch (NumberFormatException e) {                  log.severe("Wrong format of <" + getRootTagName() + " maxBytes='" + tmp + "'>, expected a long in bytes, using default.");               }            }            else if (attrs.getQName(ii).equalsIgnoreCase("maxBytesCache")) {               String tmp = attrs.getValue(ii).trim();               try {                  setMaxBytesCacheUnchecked(new Long(tmp).longValue());               } catch (NumberFormatException e) {                  log.severe("Wrong format of <" + getRootTagName() + " maxBytesCache='" + tmp + "'>, expected a long in bytes, using default.");               }            }            else if (attrs.getQName(ii).equalsIgnoreCase("storeSwapLevel")) {               String tmp = attrs.getValue(ii).trim();               try {                  setStoreSwapLevel(new Long(tmp).longValue());               } catch (NumberFormatException e) {                  log.severe("Wrong format of <" + getRootTagName() + " storeSwapLevel='" + tmp + "'>, expected a long in bytes, using default.");               }            }            else if (attrs.getQName(ii).equalsIgnoreCase("storeSwapBytes")) {               String tmp = attrs.getValue(ii).trim();               try {                  setStoreSwapBytes(new Long(tmp).longValue());               } catch (NumberFormatException e) {                  log.severe("Wrong format of <" + getRootTagName() + " storeSwapBytes='" + tmp + "'>, expected a long in bytes, using default.");               }            }            else if (attrs.getQName(ii).equalsIgnoreCase("reloadSwapLevel")) {               String tmp = attrs.getValue(ii).trim();               try {                  setReloadSwapLevel(new Long(tmp).longValue());               } catch (NumberFormatException e) {                  log.severe("Wrong format of <" + getRootTagName() + " reloadSwapLevel='" + tmp + "'>, expected a long in bytes, using default.");               }            }            else if (attrs.getQName(ii).equalsIgnoreCase("reloadSwapBytes")) {               String tmp = attrs.getValue(ii).trim();               try {                  setReloadSwapBytes(new Long(tmp).longValue());               } catch (NumberFormatException e) {                  log.severe("Wrong format of <" + getRootTagName() + " reloadSwapBytes='" + tmp + "'>, expected a long in bytes, using default.");               }            }            else if (attrs.getQName(ii).equalsIgnoreCase("onOverflow")) {               setOnOverflow(attrs.getValue(ii).trim());            }            else if (attrs.getQName(ii).equalsIgnoreCase("onFailure")) {               setOnFailure(attrs.getValue(ii).trim());            }            else               log.warning("Ignoring unknown attribute '" + attrs.getQName(ii) + "' in connect QoS <" + getRootTagName() + ">");         }      }      else {         log.warning("Missing 'relating' attribute in connect QoS <" + getRootTagName() + ">");      }      checkConsistency();   }   public String usage() {      return usage("Control the "+getRootTagName()+"/"+this.relating+" storage properties:");   }   /**    * Defaults to queue for &lt;queue .../>, other used tag name is &lt;persistence .../>    */   public String getRootTagName() {      return "queue";   }   /**    * Get a usage string for queue configuration (in xmlBlaster.properties or on command line)    */   public String usage(String headerline) {      String prefix = getPrefix();      String text = "";      text += "\n" + headerline + "\n";      text += "   -"+prefix+"debug    Sets a debug flag on the queue [false].\n";      text += "                       Currently used for consistency asserts on jdbc queue.\n";      text += "   -"+prefix+"maxEntries\n";      text += "                       The maximum allowed number of messages [" + this.maxEntries.getDefaultValue() + "].\n";      text += "   -"+prefix+"maxEntriesCache\n";      text += "                       The maximum allowed number of messages in the cache [" + this.maxEntriesCache.getDefaultValue() + "].\n";      text += "   -"+prefix+"maxBytes\n";      text += "                       The maximum size in bytes of the storage [" + this.maxBytes.getDefaultValue() + "].\n";      text += "   -"+prefix+"maxBytesCache.\n";      text += "                       The maximum size in bytes in the cache [" + this.maxBytesCache.getDefaultValue() + "].\n";      text += "   -"+prefix+"onOverflow\n";      text += "                       What happens if storage is full [" + this.onOverflow.getDefaultValue() + "]\n";      text += "   -"+prefix+"onFailure\n";      text += "                       Error handling when storage failed [" + this.onFailure.getDefaultValue() + "]\n";      text += "   -"+prefix+"type\n";      text += "                       The plugin type [" + this.type.getDefaultValue() + "]\n";      text += "   -"+prefix+"version\n";      text += "                       The plugin version [" + this.version.getDefaultValue() + "]\n";      text += "   -"+prefix+"defaultPlugin\n";      text += "                       The plugin type,version (short form) [" + this.type.getDefaultValue()+","+this.version.getDefaultValue() + "]\n";      return text;   }   /**    * Should be called after parsing    */   public final void checkConsistency() { // throws XmlBlasterException {      if (getMaxEntriesCache() > getMaxEntries()) {         log.warning(this.relating + " maxEntriesCache=" + getMaxEntriesCache() + " is bigger than maxEntries=" + getMaxEntries() + ", we reduce maxEntriesCache to maxEntries and continue.");         this.maxEntriesCache.setValue(getMaxEntries());      }      if (getMaxBytesCache() > getMaxBytes()) {         log.warning(this.relating + " maxBytesCache=" + getMaxBytesCache() + " is bigger than maxBytes=" + getMaxBytes() + ", we reduce maxBytesCache to maxBytes and continue.");         this.maxBytesCache.setValue(getMaxBytes());      }   }   /**    * 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>    * @param extraOffset indenting of tags for nice output    * @return The xml representation    */   public final String toXml(String extraOffset) {      StringBuffer sb = new StringBuffer(256);      if (extraOffset == null) extraOffset = "";      String offset = Constants.OFFSET + extraOffset;      checkConsistency();      // open <queue ...      sb.append(offset).append("<").append(getRootTagName());      if (this.debug.isModified())         sb.append(" debug='").append(getDebug()).append("'");      sb.append(" relating='").append(getRelating()).append("'");      if (this.type.isModified())         sb.append(" type='").append(getType()).append("'");      if (this.version.isModified())         sb.append(" version='").append(getVersion()).append("'");      if (this.maxEntries.isModified())         sb.append(" maxEntries='").append(getMaxEntries()).append("'");      if (this.maxEntriesCache.isModified())         sb.append(" maxEntriesCache='").append(getMaxEntriesCache()).append("'");      if (this.maxBytes.isModified())         sb.append(" maxBytes='").append(getMaxBytes()).append("'");      if (this.maxBytesCache.isModified())         sb.append(" maxBytesCache='").append(getMaxBytesCache()).append("'");      /* Deactivated until implemented in queue framework      if ((long)(DEFAULT_storeSwapLevelRatio*this.maxBytesCache.getValue()) != getStoreSwapLevel())         sb.append(" storeSwapLevel='").append(getStoreSwapLevel()).append("'");      if ((long)(DEFAULT_storeSwapBytesRatio*this.maxBytesCache.getValue()) != getStoreSwapBytes())         sb.append(" storeSwapBytes='").append(getStoreSwapBytes()).append("'");      if ((long)(DEFAULT_reloadSwapLevelRatio*this.maxBytesCache.getValue()) != getReloadSwapLevel())         sb.append(" reloadSwapLevel='").append(getReloadSwapLevel()).append("'");      if ((long)(DEFAULT_reloadSwapBytesRatio*this.maxBytesCache.getValue()) != getReloadSwapBytes())         sb.append(" reloadSwapBytes='").append(getReloadSwapBytes()).append("'");      */      if (this.onOverflow.isModified())         sb.append(" onOverflow='").append(getOnOverflow()).append("'");      if (this.onFailure.isModified())         sb.append(" onFailure='").append(getOnFailure()).append("'");      if (addressArr.length > 0 && addressArr[0] != null) {         sb.append(">");         for (int ii=0; ii<addressArr.length; ii++) {            AddressBase ad = addressArr[ii];            sb.append(ad.toXml(extraOffset+Constants.INDENT));         }         sb.append(offset).append("</").append(getRootTagName()).append(">");  // closing </queue>      }      else         sb.append("/>");      return sb.toString();   }   /**    * returns the global object    */   public Global getGlobal() {      return this.glob;   }   /**    * Returns a shallow clone, you can change savely all basic or immutable types    * like boolean, String, int.    */   public Object clone() {      QueuePropertyBase newOne = null;      try {         newOne = (QueuePropertyBase)super.clone();         synchronized(this) {            newOne.maxEntries = (PropLong)this.maxEntries.clone();            newOne.maxEntriesCache = (PropLong)this.maxEntriesCache.clone();            newOne.maxBytes = (PropLong)this.maxBytes.clone();            newOne.maxBytesCache = (PropLong)this.maxBytesCache.clone();            newOne.type = (PropString)this.type.clone();            newOne.version = (PropString)this.version.clone();            newOne.onOverflow = (PropString)this.onOverflow.clone();            newOne.onFailure = (PropString)this.onFailure.clone();         }         return newOne;      }      catch (CloneNotSupportedException e) {         return null;      }   }   public final boolean getDebug() {      return this.debug.getValue();   }   public final void setDebug(boolean debug) {      this.debug.setValue(debug);   }   public void setEmbedded(boolean embedded) {      this.embedded = embedded;   }      public boolean isEmbedded() {      return this.embedded;   }}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -