Package com.sun.messaging.jmq.util

Examples of com.sun.messaging.jmq.util.SizeString


  throws BrokerCmdException {
        BrokerCmdException ex = null;

        try {

      SizeString  ss = new SizeString(byteString);
      long  bytesValue;

      bytesValue = ss.getBytes();

      if (bytesValue < -1)  {
                ex = new BrokerCmdException(BrokerCmdException.INVALID_BYTE_VALUE);
                ex.setProperties(brokerCmdProps);
      ex.setErrorString(type);
View Full Code Here


    public void setMaxBytesPerMsg(Long l) throws MBeanException  {
  try  {
            checkLongNegOneAndUp(l, DestinationAttributes.MAX_BYTES_PER_MSG);

      SizeString ss = new SizeString();
      ss.setBytes(l.longValue());
      d.setMaxByteSize(ss);
      d.update();
  } catch (Exception e)  {
      handleSetterException(
    DestinationAttributes.MAX_BYTES_PER_MSG, e);
View Full Code Here

    public void setMaxTotalMsgBytes(Long l) throws MBeanException  {
  try  {
            checkLongNegOneAndUp(l, DestinationAttributes.MAX_TOTAL_MSG_BYTES);

      SizeString ss = new SizeString();
      ss.setBytes(l.longValue());

      d.setByteCapacity(ss);
      d.update();
  } catch (Exception e)  {
      handleSetterException(
View Full Code Here

    /**
     * Sets the bytes string using the format
     * recognized by the SizeString class.
     */
    public void setSizeString(String strVal)  {
  SizeString  ss;
  String    tmp = strVal.trim();
  long    val;
  int    unit;
  char    c;

  try  {
      ss = new SizeString(tmp);
  } catch (Exception e)  {
      /*
       * Should not get here
       */
      return;
  }

  c = tmp.charAt(tmp.length() -1);

  if (Character.isLetter(c)) {
      switch (c)  {
      case 'm':
      case 'M':
    val = ss.getMBytes();
          unit = BytesField.MEGABYTES;
      break;

      case 'k':
      case 'K':
    val = ss.getKBytes();
          unit = BytesField.KILOBYTES;
      break;

      case 'b':
      case 'B':
    val = ss.getBytes();
          unit = BytesField.BYTES;
      break;

      default:
    val = 0;
          unit = BytesField.BYTES;
      break;
      }
  } else  {
      val = ss.getBytes();
      unit = BytesField.BYTES;
  }

  setText(Long.toString(val));
  setUnit(unit);
View Full Code Here

        di.fulltype=d.getType();
        di.maxMessages=d.getCapacity();
        if (di.maxMessages < 0)
            di.maxMessages = 0;
        SizeString bc = d.getByteCapacity();
        di.maxMessageBytes=(bc == null ? 0 : bc.getBytes());
        if (di.maxMessageBytes < 0)
            di.maxMessageBytes = 0;
        bc = d.getMaxByteSize();
        di.maxMessageSize=(bc == null ? 0 : bc.getBytes());
        if (di.maxMessageSize < 0)
            di.maxMessageSize = 0;
        di.destScope=d.getScope();
        di.destLimitBehavior=d.getLimitBehavior();
        di.maxPrefetch=d.getMaxPrefetch();
View Full Code Here

        String errMsg = null;

        // Default attributes of the destination
        int type = DestType.DEST_TYPE_QUEUE | DestType.DEST_FLAVOR_SINGLE;
        int maxMessages = -1;
        SizeString maxMessageBytes = null;
        SizeString maxMessageSize = null;

        HAMonitorService hamonitor = Globals.getHAMonitorService();
        if (hamonitor != null && hamonitor.inTakeover()) {
            status = Status.ERROR;
            errMsg =  rb.getString(rb.E_CANNOT_PROCEED_TAKEOVER_IN_PROCESS);

            logger.log(Logger.ERROR, this.getClass().getName() + ": " + errMsg);
  } else if (MemoryGlobals.MEM_DISALLOW_CREATE_DEST) {
            status = Status.ERROR;
            errMsg = rb.W_LOW_MEM_REJECT_DEST;
        } else if (info.isModified(DestinationInfo.NAME)) {
            if (info.isModified(DestinationInfo.TYPE)) {
                type = info.type;
            }
            if (info.isModified(DestinationInfo.MAX_MESSAGES)) {
                maxMessages = info.maxMessages;
            }
            if (info.isModified(DestinationInfo.MAX_MESSAGE_BYTES)) {
                maxMessageBytes = new SizeString();
                maxMessageBytes.setBytes(info.maxMessageBytes);
            }
            if (info.isModified(DestinationInfo.MAX_MESSAGE_SIZE)) {
                maxMessageSize = new SizeString();
                maxMessageSize.setBytes(info.maxMessageSize);
            }

        } else {
            status = Status.ERROR;
            errMsg = rb.X_NO_DEST_NAME_SET;
View Full Code Here

  Logger logger = Globals.getLogger();

        // Default attributes of the destination
        int type = DestType.DEST_TYPE_QUEUE | DestType.DEST_FLAVOR_SINGLE;
        int maxMessages = -1;
        SizeString maxMessageBytes = null;
        SizeString maxMessageSize = null;

        if (MemoryGlobals.MEM_DISALLOW_CREATE_DEST) {
            status = Status.ERROR;
            errMsg = rb.W_LOW_MEM_REJECT_DEST;
        } else if (info.isModified(DestinationInfo.NAME)) {
            if (info.isModified(DestinationInfo.TYPE)) {
                type = info.type;
            }
            if (info.isModified(DestinationInfo.MAX_MESSAGES)) {
                maxMessages = info.maxMessages;
            }
            if (info.isModified(DestinationInfo.MAX_MESSAGE_BYTES)) {
                maxMessageBytes = new SizeString();
                maxMessageBytes.setBytes(info.maxMessageBytes);
            }
            if (info.isModified(DestinationInfo.MAX_MESSAGE_SIZE)) {
                maxMessageSize = new SizeString();
                maxMessageSize.setBytes(info.maxMessageSize);
            }

        } else {
            status = Status.ERROR;
            errMsg = rb.X_NO_DEST_NAME_SET;
View Full Code Here

    // create txn log writers
    String filename = null;
    try {
      BrokerConfig config = Globals.getConfig();
      SizeString filesize = config.getSizeProperty(TXNLOG_FILE_SIZE_PROP,
          DEFAULT_TXNLOG_FILE_SIZE);
         
      filename = MSG_LOG_FILENAME;

      String mode = "rwd";
      boolean synch = true;
      if (!Destination.PERSIST_SYNC) {
        mode = "rw";
        synch = false;
      }
      logger.log(Logger.INFO, br.getKString(BrokerResources.I_OPEN_TXNLOG,
            mode, Long.valueOf(filesize.getBytes())));

      FileTransactionLogWriter ftlw = new FileTransactionLogWriter(
          rootDir, filename, filesize.getBytes(), mode, synch,
          isTxnLogGroupCommits,
          BaseTransaction.CURRENT_FORMAT_VERSION);
      long existingFormatVersion = ftlw.getExistingAppCookie();
     
      //
View Full Code Here

    /**
     * When instantiated, all interests are loaded.
     */
    InterestStore(File topDir, boolean clear) throws BrokerException {

  SizeString filesize = config.getSizeProperty(INTEREST_FILE_SIZE_PROP,
          DEFAULT_INTEREST_FILE_SIZE);

  backingFile = new File(topDir, BASENAME);
  try {
      // safe=false; data synchronization is controlled by caller
      interestMap = new PHashMap(backingFile, filesize.getBytes(),
                false, clear);
  } catch (IOException e) {
      throw new BrokerException(br.getString(
          br.X_LOAD_INTERESTS_FAILED), e);
  }
View Full Code Here

     * if clear is true, just remove all data in old store
     */
    InterestStore(FileStore p, File topDir, File oldDir, boolean clear)
  throws BrokerException {

  SizeString filesize = config.getSizeProperty(INTEREST_FILE_SIZE_PROP,
          DEFAULT_INTEREST_FILE_SIZE);

  File oldFile = new File(oldDir, BASENAME);
  PHashMap olddata = null;

View Full Code Here

TOP

Related Classes of com.sun.messaging.jmq.util.SizeString

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.