Package com.sun.messaging.jmq.util

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


          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


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

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

  backingFile = new File(topDir, BASENAME);
  try {
      // safe=false; reset=clear
      olddata = new PHashMap(oldFile, false, clear);
  } catch (IOException e) {
      logger.log(logger.ERROR, br.X_UPGRADE_INTERESTS_FAILED,
      oldFile, backingFile, e);
      throw new BrokerException(br.getString(
        br.X_UPGRADE_INTERESTS_FAILED, oldFile,
          backingFile), e);
  }

  try {
      olddata.load();
  } catch (IOException e) {
      logger.log(logger.ERROR, br.X_UPGRADE_INTERESTS_FAILED,
      oldFile, backingFile, e);
      throw new BrokerException(br.getString(
        br.X_UPGRADE_INTERESTS_FAILED, oldFile,
          backingFile), e);
  } catch (ClassNotFoundException e) {
      logger.log(logger.ERROR, br.X_UPGRADE_INTERESTS_FAILED,
      oldFile, backingFile, e);
      throw new BrokerException(br.getString(
        br.X_UPGRADE_INTERESTS_FAILED, oldFile,
          backingFile), e);
  } catch (PHashMapLoadException le) {
 
      while (le != null) {
    logger.log(Logger.WARNING,
      br.X_FAILED_TO_LOAD_A_CONSUMER_FROM_OLDSTORE, le);

    // save info in LoadException
    LoadException e = new LoadException(le.getMessage(),
            le.getCause());
    e.setKey(le.getKey());
    e.setValue(le.getValue());
    e.setKeyCause(le.getKeyCause());
    e.setValueCause(le.getValueCause());
    e.setNextException(loadException);
    loadException = e;

    // get the chained exception
    le = le.getNextException();
      }
  }

  VRFileWarning w = olddata.getWarning();
  if (w != null) {
      logger.log(logger.WARNING,
      "possible loss of consumer data in old store", w);
  }

  try {
      // safe=false; reset=false
      interestMap = new PHashMap(backingFile, oldFile.length(),
                false, false);
  } catch (IOException e) {
      logger.log(logger.ERROR, br.X_UPGRADE_INTERESTS_FAILED,
      oldFile, backingFile, e);
      throw new BrokerException(br.getString(
        br.X_UPGRADE_INTERESTS_FAILED, oldFile,
          backingFile), e);
  }

  try {
      interestMap.load();
  } catch (IOException e) {
      // should not happen so throw exception
      logger.log(logger.ERROR, br.X_UPGRADE_INTERESTS_FAILED,
      oldFile, backingFile, e);
      throw new BrokerException(br.getString(
        br.X_UPGRADE_INTERESTS_FAILED, oldFile,
          backingFile), e);
  } catch (ClassNotFoundException e) {
      // should not happen so throw exception
      logger.log(logger.ERROR, br.X_UPGRADE_INTERESTS_FAILED,
      oldFile, backingFile, e);
      throw new BrokerException(br.getString(
        br.X_UPGRADE_INTERESTS_FAILED, oldFile,
          backingFile), e);
  } catch (PHashMapLoadException e) {
      // should not happen so throw exception
      logger.log(logger.ERROR, br.X_UPGRADE_INTERESTS_FAILED,
      oldFile, backingFile, e);
      throw new BrokerException(br.getString(
        br.X_UPGRADE_INTERESTS_FAILED, oldFile,
          backingFile), e);
  }

  w = interestMap.getWarning();
  if (w != null) {
      logger.log(logger.WARNING,
      "possible loss of consumer data", w);
  }

  Iterator itr = olddata.entrySet().iterator();
  while (itr.hasNext()) {
      Map.Entry entry = (Map.Entry)itr.next();
      Object key = entry.getKey();
      Object value = entry.getValue();
      interestMap.put(key, value);
  }
  olddata.close();

  if (Store.getDEBUG()) {
      logger.log(logger.DEBUG, "UPGRADED " + (interestMap.size()) +
        " INTERESTS");
  }
View Full Code Here

  }

  backingFile = new File(topDir, BASENAME);
  try {
      // pass in safe=false; caller decide when to sync
      dstMap = new PHashMap(backingFile, filesize.getBytes(), false, clear);
  } catch (IOException e) {
      logger.log(logger.ERROR, br.X_LOAD_DESTINATIONS_FAILED, e);
      throw new BrokerException(
      br.getString(br.X_LOAD_DESTINATIONS_FAILED), e);
  }
View Full Code Here

  throws BrokerException {

  this.parent = p;

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

  backingFile = new File(topDir, BASENAME);
  try {
      // load old data
      // safe=false; reset=false
      olddata = new PHashMap(oldFile, false, false);
  } catch (IOException e) {
      logger.log(logger.ERROR, br.X_UPGRADE_DESTINATIONS_FAILED,
      oldFile, backingFile, e);
      throw new BrokerException(
      br.getString(br.X_UPGRADE_DESTINATIONS_FAILED,
        oldFile, backingFile), e);
  }

  try {
      olddata.load();
  } catch (IOException e) {
      logger.log(logger.ERROR, br.X_UPGRADE_DESTINATIONS_FAILED,
      oldFile, backingFile, e);
      throw new BrokerException(
      br.getString(br.X_UPGRADE_DESTINATIONS_FAILED,
        oldFile, backingFile), e);
  } catch (ClassNotFoundException e) {
      logger.log(logger.ERROR, br.X_UPGRADE_DESTINATIONS_FAILED,
      oldFile, backingFile, e);
      throw new BrokerException(
      br.getString(br.X_UPGRADE_DESTINATIONS_FAILED,
        oldFile, backingFile), e);
  } catch (PHashMapLoadException le) {
 
      while (le != null) {
    logger.log(Logger.WARNING,
      br.X_FAILED_TO_LOAD_A_DEST_FROM_OLDSTORE, le);

    // save info in LoadException
    LoadException e = new LoadException(le.getMessage(),
            le.getCause());
    e.setKey(le.getKey());
    e.setValue(le.getValue());
    e.setKeyCause(le.getKeyCause());
    e.setValueCause(le.getValueCause());
    e.setNextException(loadException);
    loadException = e;

    // get the chained exception
    le = le.getNextException();
      }
  }

  VRFileWarning w = olddata.getWarning();
  if (w != null) {
      logger.log(logger.WARNING,
      "possible loss of destination data in old store", w);
  }

  try {
      // pass in safe=false; caller decide when to sync
      // safe=false; reset=false
      dstMap = new PHashMap(backingFile, oldFile.length(), false, false);
  } catch (IOException e) {
      logger.log(logger.ERROR, br.X_UPGRADE_DESTINATIONS_FAILED,
      oldFile, backingFile, e);
      throw new BrokerException(
      br.getString(br.X_UPGRADE_DESTINATIONS_FAILED,
        oldFile, backingFile), e);
  }

  try {
      dstMap.load();
  } catch (IOException e) {
      // should not happen so throw exception
      logger.log(logger.ERROR, br.X_UPGRADE_DESTINATIONS_FAILED,
      oldFile, backingFile, e);
      throw new BrokerException(
      br.getString(br.X_UPGRADE_DESTINATIONS_FAILED,
        oldFile, backingFile), e);
  } catch (ClassNotFoundException e) {
      // should not happen so throw exception
      logger.log(logger.ERROR, br.X_UPGRADE_DESTINATIONS_FAILED,
      oldFile, backingFile, e);
      throw new BrokerException(
      br.getString(br.X_UPGRADE_DESTINATIONS_FAILED,
        oldFile, backingFile), e);
  } catch (PHashMapLoadException e) {
      // should not happen so throw exception
      logger.log(logger.ERROR, br.X_UPGRADE_DESTINATIONS_FAILED,
      oldFile, backingFile, e);
      throw new BrokerException(
      br.getString(br.X_UPGRADE_DESTINATIONS_FAILED,
        oldFile, backingFile), e);
  }

  w = dstMap.getWarning();
  if (w != null) {
      logger.log(logger.WARNING,
      "possible loss of destination data", w);
  }

  // put data in new store
  // migration done when the old data is read in
  Iterator itr = olddata.values().iterator();
  Destination dst = null;
  while (itr.hasNext()) {
      dst = (Destination)itr.next();
      dstMap.put(dst.getDestinationUID().toString(), dst);
  }
  olddata.close();

  if (Store.getDEBUG()) {
      logger.log(logger.DEBUG, "DestinationList: upgraded "+
          dstMap.size()+" destinations");
  }
View Full Code Here

        if (_useMmappedFile) {
            _gxidMap = new PHashMapMMF(_backFile, _logsize, 1024, false, reset);
            ((PHashMapMMF)_gxidMap).intClientData(_clientDataSize);
        } else {
            _gxidMap = new PHashMap(_backFile, _logsize, 1024, false, reset);
        }
        try {
            _gxidMap.load();
            if (_clientDataSize > 0) {
                loadClientData();
View Full Code Here

                    backingFile, filesize.getBytes(), 1024, false, clear);
                if (updateOptimization) {
                    ((PHashMapMMF)tidMap).intClientData(CLIENT_DATA_SIZE);
                }
            } else {
                tidMap = new PHashMap(
                    backingFile, filesize.getBytes(), 1024, false, clear);
            }
  } catch (IOException e) {
      logger.log(logger.ERROR, br.X_LOAD_TRANSACTIONS_FAILED, e);
      throw new BrokerException(
View Full Code Here

    // when instantiated, old data are upgraded
    TidList(FileStore p, File topDir, File oldTop)
  throws BrokerException {

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

  backingFile = new File(topDir, BASENAME);
  try {
      // load old data
      // safe=false; reset=false
      olddata = new PHashMap(oldFile, false, false);
  } catch (IOException e) {
      logger.log(logger.ERROR, br.X_UPGRADE_TRANSACTIONS_FAILED,
      oldFile, backingFile, e);
      throw new BrokerException(
      br.getString(br.X_UPGRADE_TRANSACTIONS_FAILED,
        oldFile, backingFile), e);
  }

  try {
      olddata.load();
  } catch (IOException e) {
      logger.log(logger.ERROR, br.X_UPGRADE_TRANSACTIONS_FAILED,
      oldFile, backingFile, e);
      throw new BrokerException(
      br.getString(br.X_UPGRADE_TRANSACTIONS_FAILED,
        oldFile, backingFile), e);
  } catch (ClassNotFoundException e) {
      logger.log(logger.ERROR, br.X_UPGRADE_TRANSACTIONS_FAILED,
      oldFile, backingFile, e);
      throw new BrokerException(
      br.getString(br.X_UPGRADE_TRANSACTIONS_FAILED,
        oldFile, backingFile), e);
  } catch (PHashMapLoadException le) {

      while (le != null) {
    logger.log(Logger.WARNING,
      br.X_FAILED_TO_LOAD_A_TXN_FROM_OLDSTORE, le);

    // save info in LoadException
    LoadException e = new LoadException(le.getMessage(),
            le.getCause());
    e.setKey(le.getKey());
    e.setValue(le.getValue());
    e.setKeyCause(le.getKeyCause());
    e.setValueCause(le.getValueCause());
    e.setNextException(loadException);
    loadException = e;

    // get the chained exception
    le = le.getNextException();
      }
  }

  VRFileWarning w = olddata.getWarning();
  if (w != null) {
      logger.log(logger.WARNING,
      "possible loss of transaction data in old store", w);
  }

  try {
            useMemoryMappedFile = config.getBooleanProperty(
                TXN_USE_MEMORY_MAPPED_FILE_PROP,
                DEFAULT_TXN_USE_MEMORY_MAPPED_FILE);
            updateOptimization = useMemoryMappedFile &&
                config.getBooleanProperty(
                    TXN_UPDATE_OPTIMIZATION_PROP,
                    DEFAULT_TXN_UPDATE_OPTIMIZATION);

            // pass in safe=false; caller decide when to sync
            // safe=false; reset=false
            if (useMemoryMappedFile) {
          tidMap = new PHashMapMMF(
                    backingFile, oldFile.length(), 1024, false, false);
                if (updateOptimization) {
                    ((PHashMapMMF)tidMap).intClientData(CLIENT_DATA_SIZE);
                }
            } else {
                tidMap = new PHashMap(
                    backingFile, oldFile.length(), 1024, false, false);
            }
  } catch (IOException e) {
      logger.log(logger.ERROR, br.X_UPGRADE_TRANSACTIONS_FAILED,
      oldFile, backingFile, e);
      throw new BrokerException(
      br.getString(br.X_UPGRADE_TRANSACTIONS_FAILED,
        oldFile, backingFile), e);
  }

  try {
      tidMap.load();

            // Process client data
            loadClientData();
  } catch (ClassNotFoundException e) {
      // should not happen so throw exception
      logger.log(logger.ERROR, br.X_UPGRADE_TRANSACTIONS_FAILED,
      oldFile, backingFile, e);
      throw new BrokerException(
      br.getString(br.X_UPGRADE_TRANSACTIONS_FAILED,
        oldFile, backingFile), e);
  } catch (IOException e) {
      // should not happen so throw exception
      logger.log(logger.ERROR, br.X_UPGRADE_TRANSACTIONS_FAILED,
      oldFile, backingFile, e);
      throw new BrokerException(
      br.getString(br.X_UPGRADE_TRANSACTIONS_FAILED,
        oldFile, backingFile), e);
  } catch (PHashMapLoadException e) {
      // should not happen so throw exception
      logger.log(logger.ERROR, br.X_UPGRADE_TRANSACTIONS_FAILED,
      oldFile, backingFile, e);
      throw new BrokerException(
      br.getString(br.X_UPGRADE_TRANSACTIONS_FAILED,
        oldFile, backingFile), e);
  }

  w = tidMap.getWarning();
  if (w != null) {
      logger.log(logger.WARNING,
      "possible loss of transaction data", w);
  }

  // just copy old data to new store
  Iterator itr = olddata.entrySet().iterator();
  while (itr.hasNext()) {
      Map.Entry entry = (Map.Entry)itr.next();
      Object key = entry.getKey();
      Object value = entry.getValue();

            // replace TransactionState obj with TransactionInfo obj
      tidMap.put(key, new TransactionInfo((TransactionState)value));
  }
  olddata.close();

  if (Store.getDEBUG()) {
      logger.log(logger.DEBUG,
                "TidList: upgraded " + tidMap.size() + " transactions");
  }
View Full Code Here

            if (useMemoryMappedFile) {
          tidMap = new PHashMapMMF(
                    backingFile, filesize.getBytes(), 1024, false, clear);
            } else {
                tidMap = new PHashMap(
                    backingFile, filesize.getBytes(), 1024, false, clear);
            }
  } catch (IOException e) {
      logger.log(logger.ERROR, br.X_LOAD_TXNACK_FAILED, e);
      throw new BrokerException(
View Full Code Here

    // when instantiated, old data are upgraded
    TxnAckList(File topDir, File oldTop, boolean deleteold)
  throws BrokerException {

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

  backingFile = new File(topDir, BASENAME);

  try {
      // load old data
      // safe=false; reset=false
      olddata = new PHashMap(oldFile, false, false);
  } catch (IOException e) {
      logger.log(logger.ERROR, br.X_UPGRADE_TXNACK_FAILED, oldFile,
      backingFile, e);
      throw new BrokerException(
      br.getString(br.X_UPGRADE_TXNACK_FAILED,
        oldFile, backingFile), e);
  }

  try {
      olddata.load();
  } catch (IOException e) {
      logger.log(logger.ERROR, br.X_UPGRADE_TXNACK_FAILED, oldFile,
          backingFile, e);
      throw new BrokerException(
      br.getString(br.X_UPGRADE_TXNACK_FAILED,
        oldFile, backingFile), e);
  } catch (ClassNotFoundException e) {
      logger.log(logger.ERROR, br.X_UPGRADE_TXNACK_FAILED, oldFile,
          backingFile, e);
      throw new BrokerException(
      br.getString(br.X_UPGRADE_TXNACK_FAILED,
        oldFile, backingFile), e);
  } catch (PHashMapLoadException le) {
 
      while (le != null) {
    logger.log(Logger.WARNING,
      br.X_FAILED_TO_LOAD_A_TXNACK_FROM_OLDSTORE, le);

    // save info in LoadException
    LoadException e = new LoadException(le.getMessage(),
            le.getCause());
    e.setKey(le.getKey());
    e.setValue(le.getValue());
    e.setKeyCause(le.getKeyCause());
    e.setValueCause(le.getValueCause());
    e.setNextException(loadException);
    loadException = e;

    // get the chained exception
    le = le.getNextException();
      }
  }

  VRFileWarning w = olddata.getWarning();
  if (w != null) {
    logger.log(logger.WARNING,
      "possible loss of transaction data in old store", w);
  }

  try {
      // pass in safe=false; let caller decide when to sync
      // safe=false; reset=false
            if (config.getBooleanProperty(TidList.TXN_USE_MEMORY_MAPPED_FILE_PROP,
                TidList.DEFAULT_TXN_USE_MEMORY_MAPPED_FILE)) {
          tidMap = new PHashMapMMF(
                    backingFile, oldFile.length(), 1024, false, false);
            } else {
                tidMap = new PHashMap(
                    backingFile, oldFile.length(), 1024, false, false);
            }
  } catch (IOException e) {
      logger.log(logger.ERROR, br.X_UPGRADE_TXNACK_FAILED, oldFile,
      backingFile, e);
      throw new BrokerException(
      br.getString(br.X_UPGRADE_TXNACK_FAILED,
        oldFile, backingFile), e);
  }

  try {
      tidMap.load();
  } catch (IOException e) {
      // should not happen so throw exception
      logger.log(logger.ERROR, br.X_UPGRADE_TXNACK_FAILED, oldFile,
          backingFile, e);
      throw new BrokerException(
      br.getString(br.X_UPGRADE_TXNACK_FAILED,
        oldFile, backingFile), e);
  } catch (ClassNotFoundException e) {
      // should not happen so throw exception
      logger.log(logger.ERROR, br.X_UPGRADE_TXNACK_FAILED, oldFile,
          backingFile, e);
      throw new BrokerException(
      br.getString(br.X_UPGRADE_TXNACK_FAILED,
        oldFile, backingFile), e);
  } catch (PHashMapLoadException e) {
      // should not happen so throw exception
      logger.log(logger.ERROR, br.X_UPGRADE_TXNACK_FAILED, oldFile,
          backingFile, e);
      throw new BrokerException(
      br.getString(br.X_UPGRADE_TXNACK_FAILED,
        oldFile, backingFile), e);
  }

  w = tidMap.getWarning();
  if (w != null) {
      logger.log(logger.WARNING,
      "possible loss of transaction data", w);
  }

  // just copy old data to new store
  Iterator itr = olddata.entrySet().iterator();
  while (itr.hasNext()) {
      Map.Entry entry = (Map.Entry)itr.next();
      Object key = entry.getKey();
      Object value = entry.getValue();
      tidMap.put(key, value);
  }
  olddata.close();

  if (Store.getDEBUG()) {
      logger.log(logger.DEBUG, "TxnAckList: upgraded acks for "+
          tidMap.size() + " txns");
  }
View Full Code Here

          DEFAULT_PROP_FILE_SIZE);

  backingFile = new File(topDir, BASENAME);
  try {
      // safe=false; caller controls data synchronization
      propMap = new PHashMap(backingFile, filesize.getBytes(),
                false, clear);
  } catch (IOException e) {
      logger.logStack(logger.ERROR, br.X_LOAD_PROPERTIES_FAILED, e);
      throw new BrokerException(
      br.getString(br.X_LOAD_PROPERTIES_FAILED), e);
View Full Code Here

TOP

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

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.