Package com.sun.sgs.impl.sharedutil

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


        super(properties, systemRegistry, txnProxy, logger);
        logger.log(Level.CONFIG, "Creating NodeMappingServerImpl");

        watchdogService = txnProxy.getService(WatchdogService.class);
      
   PropertiesWrapper wrappedProps = new PropertiesWrapper(properties);
        int requestedPort = wrappedProps.getIntProperty(
                SERVER_PORT_PROPERTY, DEFAULT_SERVER_PORT, 0, 65535);

        assignPolicy = wrappedProps.getClassInstanceProperty(
                                            ASSIGN_POLICY_CLASS_PROPERTY,
                                            DEFAULT_ASSIGN_POLICY_CLASS,
                                            NodeAssignPolicy.class,
                                            new Class[] { Properties.class },
                                            properties);

        /*
         * Check service version.
         */
        transactionScheduler.runTask(
      new AbstractKernelRunnable("CheckServiceVersion") {
                public void run() {
                    checkServiceVersion(
                        NodeMapUtil.VERSION_KEY,
                        NodeMapUtil.MAJOR_VERSION,
                        NodeMapUtil.MINOR_VERSION);
                }
        },  taskOwner);
       
        // Create and start the remove thread, which removes unused identities
        // from the map.
        long removeExpireTime = wrappedProps.getLongProperty(
                REMOVE_EXPIRE_PROPERTY, DEFAULT_REMOVE_EXPIRE_TIME,
                1, Long.MAX_VALUE);
        removeThread = new RemoveThread(removeExpireTime);
        removeThread.start();
       
        // Find how long we'll give listeners to say they've finished move
        // preparations.
        relocationExpireTime = wrappedProps.getLongProperty(
                RELOCATION_EXPIRE_PROPERTY, DEFAULT_RELOCATION_EXPIRE_TIME,
                1, Long.MAX_VALUE);

        // Register our node listener with the watchdog service.
        watchdogNodeListener = new Listener();
View Full Code Here


                              boolean fullStack)
  throws Exception
    {
  super(properties, systemRegistry, txnProxy, logger);
        logger.log(Level.CONFIG, "Creating WatchdogServerImpl");
  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);
  }

        timeflushInterval = wrappedProps.getLongProperty(
                TIMEFLUSH_INTERVAL_PROPERTY, DEFAULT_TIMEFLUSH_INTERVAL,
                100, 300000);

  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);
  localNodeId = dataService.getLocalNodeId();
        registerNode(localNodeId, host, client, jmxPort);

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

        }
  if (accessCoordinator == null) {
      throw new NullPointerException("AccessCoordinator cannot be null");
        }

        PropertiesWrapper wrappedProps = new PropertiesWrapper(properties);

        this.transactionCoordinator = transactionCoordinator;
        this.profileCollectorHandle = profileCollectorHandle;
        this.accessCoordinator = accessCoordinator;
       
        this.backingQueue = wrappedProps.getClassInstanceProperty(
                SCHEDULER_QUEUE_PROPERTY, DEFAULT_SCHEDULER_QUEUE,
                SchedulerQueue.class, new Class[]{Properties.class},
                properties);
        this.retryPolicy = wrappedProps.getClassInstanceProperty(
                SCHEDULER_RETRY_PROPERTY, DEFAULT_SCHEDULER_RETRY,
                SchedulerRetryPolicy.class, new Class[]{Properties.class},
                properties);

        // startup the requested number of consumer threads
View Full Code Here

     * Constructs an {@code ImmediateRetryPolicy}.
     *
     * @param properties the system properties available
     */
    public ImmediateRetryPolicy(Properties properties) {
        PropertiesWrapper wrappedProps = new PropertiesWrapper(properties);
        this.retryWarningThreshold = wrappedProps.getIntProperty(
                RETRY_WARNING_THRESHOLD_PROPERTY,
                DEFAULT_RETRY_WARNING_THRESHOLD,
                1, Integer.MAX_VALUE);

        logger.log(Level.CONFIG,
View Full Code Here

     * Parses common graph builder properties.
     *
     * @param properties the configuration properties for this graph builder
     */
    protected AbstractAffinityGraphBuilder(Properties properties) {
        wrappedProps = new PropertiesWrapper(properties);
        snapshot =
                wrappedProps.getLongProperty(PERIOD_PROPERTY, DEFAULT_PERIOD);
        periodCount = wrappedProps.getIntProperty(
                PERIOD_COUNT_PROPERTY, DEFAULT_PERIOD_COUNT,
                1, Integer.MAX_VALUE);
View Full Code Here

     * Constructs a {@code NowOrLaterRetryPolicy}.
     *
     * @param properties the system properties available
     */
    public NowOrLaterRetryPolicy(Properties properties) {
        PropertiesWrapper wrappedProps = new PropertiesWrapper(properties);
        this.retryBackoffThreshold = wrappedProps.getIntProperty(
                RETRY_BACKOFF_THRESHOLD_PROPERTY,
                DEFAULT_RETRY_BACKOFF_THRESHOLD,
                1, Integer.MAX_VALUE);

        logger.log(Level.CONFIG,
View Full Code Here

            TransactionProxy txnProxy)
  throws Exception
    {
  super(properties, systemRegistry, txnProxy, logger);
        logger.log(Level.CONFIG, "Creating ClientSessionServiceImpl");
  PropertiesWrapper wrappedProps = new PropertiesWrapper(properties)
  try {
      /*
       * Get the property for controlling session event processing
       * and connection disconnection.
       */
            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);
      allowNewLogin = wrappedProps.getBooleanProperty(
     ALLOW_NEW_LOGIN_PROPERTY, false);
      relocationKeyLength = wrappedProps.getIntProperty(
     RELOCATION_KEY_LENGTH_PROPERTY, DEFAULT_RELOCATION_KEY_LENGTH,
    16, Integer.MAX_VALUE);
      relocationTimeout = wrappedProps.getLongProperty(
    StandardProperties.SESSION_RELOCATION_TIMEOUT_PROPERTY,
    StandardProperties.DEFAULT_SESSION_RELOCATION_TIMEOUT,
    1000L, Long.MAX_VALUE);

            /* Export the ClientSessionServer. */
      int serverPort = wrappedProps.getIntProperty(
    SERVER_PORT_PROPERTY, DEFAULT_SERVER_PORT, 0, 65535);
      serverImpl = new SessionServerImpl();
      exporter =
    new Exporter<ClientSessionServer>(ClientSessionServer.class);
      try {
    int port = exporter.export(serverImpl, serverPort);
    serverProxy = exporter.getProxy();
    if (logger.isLoggable(Level.CONFIG)) {
        logger.log(Level.CONFIG,
                            "export successful. port:{0,number,#}", port);
    }
      } catch (Exception e) {
    try {
        exporter.unexport();
    } catch (RuntimeException re) {
    }
    throw e;
      }

      /* Get services and check service version. */
      flushContextsThread.start();
      contextFactory = new ContextFactory(txnProxy);
      watchdogService = txnProxy.getService(WatchdogService.class);
      nodeMapService = txnProxy.getService(NodeMappingService.class);
      taskService = txnProxy.getService(TaskService.class);
      localNodeId = dataService.getLocalNodeId();
      watchdogService.addRecoveryListener(
    new ClientSessionServiceRecoveryListener());
     
      transactionScheduler.runTask(
    new AbstractKernelRunnable("CheckServiceVersion") {
        public void run() {
      checkServiceVersion(
          VERSION_KEY, MAJOR_VERSION, MINOR_VERSION);
        } },  taskOwner);
     
      /* Store the ClientSessionServer proxy in the data store. */
      transactionScheduler.runTask(
    new AbstractKernelRunnable("StoreClientSessionServiceProxy") {
        public void run() {
      // TBD: this could use a BindingKeyedMap.
      dataService.setServiceBinding(
          getClientSessionServerKey(localNodeId),
          new ManagedSerializable<ClientSessionServer>(
        serverProxy));
        } },
    taskOwner);

      /* Register the identity relocation and node mapping listeners. */
      nodeMapService.addIdentityRelocationListener(
    new IdentityRelocationListenerImpl());
      nodeMapService.addNodeMappingListener(
    new NodeMappingListenerImpl());

      /*
       * Create the protocol listener and acceptor.
       */
      protocolListener = new ProtocolListenerImpl();

      protocolAcceptor =
    wrappedProps.getClassInstanceProperty(
        PROTOCOL_ACCEPTOR_PROPERTY,
                    DEFAULT_PROTOCOL_ACCEPTOR,
        ProtocolAcceptor.class,
        new Class[] {
      Properties.class, ComponentRegistry.class,
View Full Code Here

      } else {
    assert AbstractService.txnProxy == txnProxy;
      }
  }

        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

  throws Exception
    {
  super(properties, systemRegistry, txnProxy, logger);
        logger.log(Level.CONFIG, "Creating WatchdogServiceImpl");

  PropertiesWrapper wrappedProps = new PropertiesWrapper(properties);

  // Setup the KernelShutdownController object
        if (ctrl == null) {
            throw new NullPointerException("null shutdown controller");
        }
  shutdownController = ctrl;
 
  try {
      localHost = InetAddress.getLocalHost().getHostName();
               
            NodeType nodeType =
                wrappedProps.getEnumProperty(StandardProperties.NODE_TYPE,
                                             NodeType.class,
                                             NodeType.singleNode);
            boolean startServer = nodeType != NodeType.appNode;
            boolean isFullStack = nodeType != NodeType.coreServerNode;
           
      int clientPort = wrappedProps.getIntProperty(
    CLIENT_PORT_PROPERTY, DEFAULT_CLIENT_PORT, 0, 65535);
           
      String clientHost = wrappedProps.getProperty(
    CLIENT_HOST_PROPERTY, localHost);

      /*
       * Check service version.
       */
      transactionScheduler.runTask(
    new AbstractKernelRunnable("CheckServiceVersion") {
        public void run() {
      checkServiceVersion(
          VERSION_KEY, MAJOR_VERSION, MINOR_VERSION);
        } },  taskOwner);

      clientImpl = new WatchdogClientImpl();
      exporter = new Exporter<WatchdogClient>(WatchdogClient.class);
      exporter.export(clientImpl, clientPort);
      clientProxy = exporter.getProxy();
           
      String host;
      int serverPort;
      if (startServer) {
    serverImpl = new WatchdogServerImpl(
        properties, systemRegistry, txnProxy,
        clientHost, clientProxy, isFullStack);
    host = localHost;
    serverPort = serverImpl.getPort();
      } else {
    host = wrappedProps.getProperty(
        HOST_PROPERTY,
        wrappedProps.getProperty(
      StandardProperties.SERVER_HOST));
                if (host == null) {
                    throw new IllegalArgumentException(
                                           "A server host must be specified");
                }
    serverPort = wrappedProps.getIntProperty(
        SERVER_PORT_PROPERTY, DEFAULT_SERVER_PORT, 1, 65535);
      }

      Registry rmiRegistry = LocateRegistry.getRegistry(host, serverPort);
      serverProxy = (WatchdogServer)
    rmiRegistry.lookup(WatchdogServerImpl.WATCHDOG_SERVER_NAME);

            int jmxPort = wrappedProps.getIntProperty(
                    StandardProperties.SYSTEM_JMX_REMOTE_PORT, -1);
      localNodeId = dataService.getLocalNodeId();
            if (startServer) {
                renewInterval = serverImpl.renewInterval;
            } else {
                renewInterval = serverProxy.registerNode(
        localNodeId, clientHost, clientProxy, jmxPort);
            }
            renewThread.start();

            timesyncInterval = wrappedProps.getLongProperty(
                    TIMESYNC_INTERVAL_PROPERTY, DEFAULT_TIMESYNC_INTERVAL,
                    1000, Long.MAX_VALUE);

            // create our profiling info and register our MBean
            ProfileCollector collector =
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

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.