Package com.sun.sgs.impl.sharedutil

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


     */
    public SnapshotParticipantListener(Properties properties, Identity owner,
                                       ComponentRegistry registry)
  throws IOException
    {
  PropertiesWrapper wrappedProps = new PropertiesWrapper(properties);

        participantMap = new HashMap<String, ParticipantCounts>();

        int port = wrappedProps.getIntProperty(PORT_PROPERTY, DEFAULT_PORT);
        networkReporter = new NetworkReporter(port);

        long reportPeriod =
            wrappedProps.getLongProperty(PERIOD_PROPERTY, DEFAULT_PERIOD);
        handle = registry.getComponent(TaskScheduler.class).
            scheduleRecurringTask(new ParticipantRunnable(), owner,
                                  System.currentTimeMillis() + reportPeriod,
                                  reportPeriod);
        handle.start();
View Full Code Here


  super(systemRegistry,
        new LoggerWrapper(Logger.getLogger(PACKAGE + ".client")),
        new LoggerWrapper(Logger.getLogger(PACKAGE + ".client.abort")));
  logger.log(Level.CONFIG, "Creating DataStoreClient properties:{0}",
       properties);
  PropertiesWrapper wrappedProps = new PropertiesWrapper(properties);
        NodeType nodeType =
                wrappedProps.getEnumProperty(StandardProperties.NODE_TYPE,
                                             NodeType.class,
                                             NodeType.singleNode);
        boolean serverStart = nodeType != NodeType.appNode;
        if (serverStart) {
            // we default to localHost;  this is useful for starting
            // single node systems
            String localHost = InetAddress.getLocalHost().getHostName();
            serverHost = wrappedProps.getProperty(
                SERVER_HOST_PROPERTY,
                wrappedProps.getProperty(
                    StandardProperties.SERVER_HOST, localHost));
        } else {
            // a server host most be specified
            serverHost = wrappedProps.getProperty(
                SERVER_HOST_PROPERTY,
                wrappedProps.getProperty(
                    StandardProperties.SERVER_HOST));
            if (serverHost == null) {
                throw new IllegalArgumentException(
                                           "A server host must be specified");
            }
        }
  int specifiedServerPort = wrappedProps.getIntProperty(
      SERVER_PORT_PROPERTY, DEFAULT_SERVER_PORT, serverStart ? 0 : 1,
      65535);
  maxTxnTimeout = wrappedProps.getLongProperty(
      MAX_TXN_TIMEOUT_PROPERTY, DEFAULT_MAX_TXN_TIMEOUT, 1,
      Long.MAX_VALUE);
  if (serverStart) {
      try {
    localServer = new DataStoreServerImpl(
View Full Code Here

        logger.log(Level.CONFIG, "Creating TcpTransport");
        if (properties == null) {
            throw new NullPointerException("properties is null");
        }
  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

  Properties properties,
  TransactionProxy txnProxy,
  ProfileCollectorHandle profileCollectorHandle)
    {
  super(txnProxy, profileCollectorHandle);
  PropertiesWrapper wrappedProps = new PropertiesWrapper(properties);
  long txnTimeout = wrappedProps.getLongProperty(
      TransactionCoordinator.TXN_TIMEOUT_PROPERTY,
      TransactionCoordinatorImpl.BOUNDED_TIMEOUT_DEFAULT);
  long defaultLockTimeout = Math.max(
      1L, (long) (txnTimeout * DEFAULT_LOCK_TIMEOUT_PROPORTION));
  long lockTimeout = wrappedProps.getLongProperty(
      LOCK_TIMEOUT_PROPERTY, defaultLockTimeout, 1, Long.MAX_VALUE);
  int numKeyMaps = wrappedProps.getIntProperty(
      NUM_KEY_MAPS_PROPERTY, NUM_KEY_MAPS_DEFAULT, 1, Integer.MAX_VALUE);
  lockManager = new TxnLockManager<Key>(lockTimeout, numKeyMaps);
  if (logger.isLoggable(CONFIG)) {
      logger.log(CONFIG,
           "Created LockingAccessCoordinator with properties:" +
View Full Code Here

  throws Exception
    {
  super(properties, systemRegistry, txnProxy, logger);
        logger.log(Level.CONFIG, "Creating ChannelServiceImpl");
 
  PropertiesWrapper wrappedProps = new PropertiesWrapper(properties);

  try {
      synchronized (ChannelServiceImpl.class) {
    if (contextMap == null) {
        contextMap = new TransactionContextMap<Context>(txnProxy);
    }
    if (collectionsFactory == null) {
        collectionsFactory =
      systemRegistry.getComponent(
          BindingKeyedCollections.class);
    }
    if (channelServerMap == null) {
        channelServerMap =
      collectionsFactory.newMap(CHANNEL_SERVER_MAP_PREFIX);
    }
      }
      contextFactory = new ContextFactory(contextMap);
      WatchdogService watchdogService =
    txnProxy.getService(WatchdogService.class);
      sessionService = txnProxy.getService(ClientSessionService.class);
      localNodeId =
    txnProxy.getService(DataService.class).getLocalNodeId();

      /*
       * Get the properties for controlling write buffer size,
       * channel event processing, and session relocation timeout
       */
            writeBufferSize = wrappedProps.getIntProperty(
                WRITE_BUFFER_SIZE_PROPERTY, DEFAULT_WRITE_BUFFER_SIZE,
                8192, Integer.MAX_VALUE);
      eventsPerTxn = wrappedProps.getIntProperty(
    EVENTS_PER_TXN_PROPERTY, DEFAULT_EVENTS_PER_TXN,
    1, Integer.MAX_VALUE);
      sessionRelocationTimeout = wrappedProps.getLongProperty(
    StandardProperties.SESSION_RELOCATION_TIMEOUT_PROPERTY,
    StandardProperties.DEFAULT_SESSION_RELOCATION_TIMEOUT,
    500, Long.MAX_VALUE);
     
      /*
       * Export the ChannelServer.
       */
      int serverPort = wrappedProps.getIntProperty(
    SERVER_PORT_PROPERTY, DEFAULT_SERVER_PORT, 0, 65535);
      serverImpl = new ChannelServerImpl();
      exporter = new Exporter<ChannelServer>(ChannelServer.class);
      try {
    int port = exporter.export(serverImpl, serverPort);
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

        // filter the properties with appropriate defaults
        filterProperties(appProperties);
       
        // check the standard properties
        checkProperties(appProperties);
        this.wrappedProperties = new PropertiesWrapper(appProperties);

        try {
            // See if we're doing any profiling.
            String level = wrappedProperties.getProperty(PROFILE_LEVEL_PROPERTY,
                    ProfileLevel.MIN.name());
View Full Code Here

                // test to see if this name if the listener is already bound...
                dataService.getServiceBinding(StandardProperties.APP_LISTENER);
            } catch (NameNotBoundException nnbe) {
                // ...if it's not, create and then bind the listener
                AppListener listener =
                    (new PropertiesWrapper(properties)).
                    getClassInstanceProperty(StandardProperties.APP_LISTENER,
                                             AppListener.class, new Class[] {});
                if (listener instanceof ManagedObject) {
                    dataService.setServiceBinding(
                            StandardProperties.APP_LISTENER, listener);
View Full Code Here

    public LPADriver(Properties properties,
                     ComponentRegistry systemRegistry,
                     TransactionProxy txnProxy)
        throws Exception
    {
        PropertiesWrapper wrappedProps = new PropertiesWrapper(properties);
        int updateSeconds = wrappedProps.getIntProperty(UPDATE_FREQ_PROPERTY,
                                               DEFAULT_UPDATE_FREQ, 5, 65535);
        updatePeriod = updateSeconds * 1000L;
        taskScheduler = systemRegistry.getComponent(TaskScheduler.class);
        taskOwner = txnProxy.getCurrentOwner();

        NodeType type =
            NodeType.valueOf(
                properties.getProperty(StandardProperties.NODE_TYPE));
        String builderName = wrappedProps.getProperty(GRAPH_CLASS_PROPERTY);
        if (GRAPH_CLASS_NONE.equals(builderName)) {
            // do not instantiate anything
            graphBuilder = null;
            graphListener = null;
            return;
        }
        if (builderName != null) {
            graphBuilder = wrappedProps.getClassInstanceProperty(
                    GRAPH_CLASS_PROPERTY, AffinityGraphBuilder.class,
                    new Class[] { Properties.class,
                                  ComponentRegistry.class,
                                  TransactionProxy.class },
                    properties, systemRegistry, txnProxy);
View Full Code Here

    public AbstractLPA(long nodeId, Properties properties)
        throws Exception
    {
        localNodeId = nodeId;

        PropertiesWrapper wrappedProps = new PropertiesWrapper(properties);
        numThreads = wrappedProps.getIntProperty(
            NUM_THREADS_PROPERTY, DEFAULT_NUM_THREADS, 1, 65535);
        if (numThreads > 1) {
            executor = Executors.newFixedThreadPool(numThreads,
                    new NamedThreadFactory("LPA"));
        } else {
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.