Package com.sun.sgs.impl.sharedutil

Examples of com.sun.sgs.impl.sharedutil.PropertiesWrapper


        }
  logger.log(Level.CONFIG,
             "Creating TCP transport with properties:{0}",
             properties);
       
  PropertiesWrapper wrappedProps = new PropertiesWrapper(properties);

        acceptorBacklog = wrappedProps.getIntProperty(ACCEPTOR_BACKLOG_PROPERTY,
                                                      DEFAULT_ACCEPTOR_BACKLOG);
       
        String host = properties.getProperty(LISTEN_HOST_PROPERTY);
        int port = wrappedProps.getIntProperty(LISTEN_PORT_PROPERTY,
                                               DEFAULT_PORT, 1, 65535);

        try {
            // If no host address is supplied, default to listen on all
            // interfaces on the local host.
View Full Code Here


        propertiesWithDefaults.setProperty(
      property, defaultProperties.getProperty(property));
    }
      }
  }
  PropertiesWrapper wrappedProps = new PropertiesWrapper(
      propertiesWithDefaults);
  boolean flushToDisk = wrappedProps.getBooleanProperty(
      FLUSH_TO_DISK_PROPERTY, false);
  long txnTimeout = wrappedProps.getLongProperty(
      TransactionCoordinator.TXN_TIMEOUT_PROPERTY, -1);
  long defaultLockTimeout = (txnTimeout < 1)
      ? DEFAULT_LOCK_TIMEOUT : computeLockTimeout(txnTimeout);
  long lockTimeout = wrappedProps.getLongProperty(
      LOCK_TIMEOUT_PROPERTY, defaultLockTimeout, 1, Long.MAX_VALUE);
  /* Avoid overflow -- BDB treats 0 as unlimited */
  long lockTimeoutMicros = (lockTimeout < (Long.MAX_VALUE / 1000))
      ? lockTimeout * 1000 : 0;
  long stats = wrappedProps.getLongProperty(STATS_PROPERTY, -1);
  TxnIsolationLevel txnIsolation = wrappedProps.getEnumProperty(
      TXN_ISOLATION_PROPERTY, TxnIsolationLevel.class,
      TxnIsolationLevel.SERIALIZABLE);
  switch (txnIsolation) {
  case READ_UNCOMMITTED:
      defaultTxnConfig.setReadUncommitted(true);
View Full Code Here

      logger.log(Level.CONFIG,
           "BdbEnvironment directory:{0}, properties:{1}, " +
           "scheduler:{2}",
           directory, properties, scheduler);
  }
  PropertiesWrapper wrappedProps = new PropertiesWrapper(properties);
  long cacheSize = wrappedProps.getLongProperty(
      CACHE_SIZE_PROPERTY, DEFAULT_CACHE_SIZE, MIN_CACHE_SIZE,
      Long.MAX_VALUE);
  long checkpointInterval = wrappedProps.getLongProperty(
      CHECKPOINT_INTERVAL_PROPERTY, DEFAULT_CHECKPOINT_INTERVAL);
  long checkpointSize = wrappedProps.getLongProperty(
      CHECKPOINT_SIZE_PROPERTY, DEFAULT_CHECKPOINT_SIZE);
  boolean flushToDisk = wrappedProps.getBooleanProperty(
      FLUSH_TO_DISK_PROPERTY, false);
  long txnTimeout = wrappedProps.getLongProperty(
      TransactionCoordinator.TXN_TIMEOUT_PROPERTY, -1);
  long defaultLockTimeout = (txnTimeout < 1)
      ? DEFAULT_LOCK_TIMEOUT : computeLockTimeout(txnTimeout);
  long lockTimeout = wrappedProps.getLongProperty(
      LOCK_TIMEOUT_PROPERTY, defaultLockTimeout, 1, Long.MAX_VALUE);
  /* Avoid overflow -- BDB treats 0 as unlimited */
  long lockTimeoutMicros = (lockTimeout < (Long.MAX_VALUE / 1000))
      ? lockTimeout * 1000 : 0;
  boolean removeLogs = wrappedProps.getBooleanProperty(
      REMOVE_LOGS_PROPERTY, false);
  TxnIsolationLevel txnIsolation = wrappedProps.getEnumProperty(
      TXN_ISOLATION_PROPERTY, TxnIsolationLevel.class,
      TxnIsolationLevel.SERIALIZABLE);
  switch (txnIsolation) {
  case READ_UNCOMMITTED:
      defaultTxnConfig.setReadUncommitted(true);
View Full Code Here

     * @throws  IOException if a network problem occurs
     */
    public DataStoreServerImpl(Properties properties) throws IOException {
  logger.log(Level.CONFIG, "Creating DataStoreServerImpl properties:{0}",
       properties);
  PropertiesWrapper wrappedProps = new PropertiesWrapper(properties);
  store = new CustomDataStoreImpl(properties);
  maxTxnTimeout = wrappedProps.getLongProperty(
      MAX_TXN_TIMEOUT_PROPERTY, DEFAULT_MAX_TXN_TIMEOUT,
      1, Long.MAX_VALUE);
  int requestedPort = wrappedProps.getIntProperty(
      PORT_PROPERTY, DEFAULT_PORT, 0, 65535);
  exporter = noRmi ?
      new SocketExporter(DataStoreServer.class) :
      new Exporter<DataStoreServer>(DataStoreServer.class);
  port = exporter.export(this, "DataStoreServer", requestedPort);
  if (requestedPort == 0) {
      logger.log(Level.INFO, "Server is using port {0,number,#}", port);
  }
  long reapDelay = wrappedProps.getLongProperty(
      REAP_DELAY_PROPERTY, DEFAULT_REAP_DELAY);
  executor = Executors.newSingleThreadScheduledExecutor();
  executor.scheduleAtFixedRate(
      new Runnable() {
    public void run() {
View Full Code Here

  throws Exception
    {
  super(properties, systemRegistry, txnProxy, logger);
  logger.log(Level.CONFIG, "Creating WatchdogServerImpl properties:{0}",
       properties);
  PropertiesWrapper wrappedProps = new PropertiesWrapper(properties);
 
  isFullStack = fullStack;
  if (logger.isLoggable(Level.CONFIG)) {
      logger.log(Level.CONFIG, "WatchdogServerImpl[" + host +
           "]: detected " +
           (isFullStack ? "full stack" : "server stack"));
  }

  /*
   * Check service version.
   */
  transactionScheduler.runTask(
      new AbstractKernelRunnable("CheckServiceVersion") {
    public void run() {
        checkServiceVersion(
      VERSION_KEY, MAJOR_VERSION, MINOR_VERSION);
    } },  taskOwner);
 
  int requestedPort = wrappedProps.getIntProperty(
       PORT_PROPERTY, DEFAULT_PORT, 0, 65535);
  boolean noRenewIntervalProperty =
      wrappedProps.getProperty(RENEW_INTERVAL_PROPERTY) == null;
  renewInterval =
      isFullStack && noRenewIntervalProperty ?
      RENEW_INTERVAL_UPPER_BOUND :
      wrappedProps.getLongProperty(
    RENEW_INTERVAL_PROPERTY, DEFAULT_RENEW_INTERVAL,
    RENEW_INTERVAL_LOWER_BOUND, RENEW_INTERVAL_UPPER_BOUND);
  if (logger.isLoggable(Level.CONFIG)) {
      logger.log(Level.CONFIG, "WatchdogServerImpl[" + host +
           "]: renewInterval:" + renewInterval);
  }

  idBlockSize = wrappedProps.getIntProperty(
       ID_BLOCK_SIZE_PROPERTY, DEFAULT_ID_BLOCK_SIZE,
      IdGenerator.MIN_BLOCK_SIZE, Integer.MAX_VALUE);
 
  idGenerator =
      new IdGenerator(ID_GENERATOR_NAME,
          idBlockSize,
          txnProxy,
          transactionScheduler);

  FailedNodesRunnable failedNodesRunnable = new FailedNodesRunnable();
  transactionScheduler.runTask(failedNodesRunnable, taskOwner);
  Collection<NodeImpl> failedNodes = failedNodesRunnable.nodes;
        statusChangedNodes.addAll(failedNodes);
        for (NodeImpl failedNode : failedNodes) {
      recoveringNodes.put(failedNode.getId(), failedNode);
  }
               
        // Create the node manager MBean and register it.  This must be
        // done before regiseterNode is called.
        ProfileCollector collector =
            systemRegistry.getComponent(ProfileCollector.class);
        nodeMgr = new NodeManager(this);
        try {
            collector.registerMBean(nodeMgr, NodeManager.MXBEAN_NAME);
        } catch (JMException e) {
            logger.logThrow(Level.CONFIG, e, "Could not register MBean");
        }
       
        // register our local id
        int jmxPort = wrappedProps.getIntProperty(
                    StandardProperties.SYSTEM_JMX_REMOTE_PORT, -1);
        long[] values = registerNode(host, client, jmxPort);
        localNodeId = values[0];

  exporter = new Exporter<WatchdogServer>(WatchdogServer.class);
View Full Code Here

  Properties properties,
  TransactionProxy txnProxy,
  ProfileCollectorHandle profileCollectorHandle)
    {
  super(txnProxy, profileCollectorHandle);
  PropertiesWrapper wrappedProps = new PropertiesWrapper(properties);
  long txnTimeout = wrappedProps.getLongProperty(
      TransactionCoordinator.TXN_TIMEOUT_PROPERTY, -1);
  long defaultLockTimeout = (txnTimeout < 1)
      ? DEFAULT_LOCK_TIMEOUT : computeLockTimeout(txnTimeout);
  lockTimeout = wrappedProps.getLongProperty(
      LOCK_TIMEOUT_PROPERTY, defaultLockTimeout, 1, Long.MAX_VALUE);
  numKeyMaps = wrappedProps.getIntProperty(
      NUM_KEY_MAPS_PROPERTY, NUM_KEY_MAPS_DEFAULT, 1, Integer.MAX_VALUE);
  keyMaps = createKeyMaps(numKeyMaps);
  for (int i = 0; i < numKeyMaps; i++) {
      keyMaps[i] = new HashMap<Key, Lock>();
  }
View Full Code Here

           "systemRegistry:{1}, txnProxy:{2}",
           properties, systemRegistry, txnProxy);
  }
  DataStore storeToShutdown = null;
  try {
      PropertiesWrapper wrappedProps = new PropertiesWrapper(properties);
      appName = wrappedProps.getProperty(StandardProperties.APP_NAME);
      if (appName == null) {
    throw new IllegalArgumentException(
        "The " + StandardProperties.APP_NAME +
        " property must be specified");
      } else if (systemRegistry == null) {
    throw new NullPointerException(
        "The systemRegistry argument must not be null");
      } else if (txnProxy == null) {
    throw new NullPointerException(
        "The txnProxy argument must not be null");
      }
      debugCheckInterval = wrappedProps.getIntProperty(
    DEBUG_CHECK_INTERVAL_PROPERTY, Integer.MAX_VALUE);
      detectModifications = wrappedProps.getBooleanProperty(
    DETECT_MODIFICATIONS_PROPERTY, Boolean.TRUE);
      String dataStoreClassName = wrappedProps.getProperty(
    DATA_STORE_CLASS_PROPERTY);
      optimisticWriteLocks = wrappedProps.getBooleanProperty(
    OPTIMISTIC_WRITE_LOCKS, Boolean.FALSE);
      trackStaleObjects = wrappedProps.getBooleanProperty(
    TRACK_STALE_OBJECTS_PROPERTY, Boolean.FALSE);
      TaskScheduler taskScheduler =
    systemRegistry.getComponent(TaskScheduler.class);
      Identity taskOwner = txnProxy.getCurrentOwner();
      scheduler = new DelegatingScheduler(taskScheduler, taskOwner);
            NodeType nodeType =
                wrappedProps.getEnumProperty(StandardProperties.NODE_TYPE,
                                             NodeType.class,
                                             NodeType.singleNode);

      AccessCoordinator accessCoordinator =
    systemRegistry.getComponent(AccessCoordinator.class);     
      DataStore baseStore;
      if (dataStoreClassName != null) {
    baseStore = wrappedProps.getClassInstanceProperty(
        DATA_STORE_CLASS_PROPERTY, DataStore.class,
        new Class[] { Properties.class, AccessCoordinator.class },
        properties, accessCoordinator);
    logger.log(Level.CONFIG, "Using data store {0}", baseStore);
      } else if (nodeType == NodeType.singleNode) {
View Full Code Here

      throw new IllegalArgumentException(
    "The " + StandardProperties.APP_NAME +
    " property must be specified");
 

        PropertiesWrapper wrappedProps = new PropertiesWrapper(properties);
        retryWaitTime = wrappedProps.getIntProperty(
                IO_TASK_WAIT_TIME_PROPERTY, DEFAULT_RETRY_WAIT_TIME, 0,
                Integer.MAX_VALUE);
        maxIoAttempts = wrappedProps.getIntProperty(
                IO_TASK_RETRIES_PROPERTY, DEFAULT_MAX_IO_ATTEMPTS, 0,
                Integer.MAX_VALUE);
 
  this.logger = logger;
  this.taskScheduler = systemRegistry.getComponent(TaskScheduler.class);
View Full Code Here

        if (collectorHandle == null) {
      throw new NullPointerException("Collector handle must not be null");
  }
        this.collectorHandle = collectorHandle;

  PropertiesWrapper props = new PropertiesWrapper(properties);
  this.boundedTimeout =
      props.getLongProperty(TransactionCoordinator.TXN_TIMEOUT_PROPERTY,
          BOUNDED_TIMEOUT_DEFAULT, 1, Long.MAX_VALUE);
  this.unboundedTimeout =
      props.getLongProperty(TransactionCoordinator.
          TXN_UNBOUNDED_TIMEOUT_PROPERTY,
          UNBOUNDED_TIMEOUT_DEFAULT, 1,
          Long.MAX_VALUE);
        this.disablePrepareAndCommitOpt =
            props.getBooleanProperty(
                TransactionCoordinator.
                    TXN_DISABLE_PREPAREANDCOMMIT_OPT_PROPERTY,
                false);
       
        // Set our portion of the ConfigManager MXBean
View Full Code Here

        defaultProfileLevel = level;
       
        registeredMBeans = new ConcurrentHashMap<String, Object>();

        PropertiesWrapper wrappedProps = new PropertiesWrapper(appProperties);
        boolean createServer =
           wrappedProps.getBooleanProperty(CREATE_MBEAN_SERVER_PROPERTY, false);
        if (createServer) {
            mbeanServer = MBeanServerFactory.createMBeanServer();
        } else {
            mbeanServer = ManagementFactory.getPlatformMBeanServer();
        }
View Full Code Here

TOP

Related Classes of com.sun.sgs.impl.sharedutil.PropertiesWrapper

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.