Package com.sun.sgs.impl.sharedutil

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


     */
    public OperationLoggingProfileOpListener(Properties properties,
                                             Identity owner,
                                             ComponentRegistry registry)
    {
        logOps = (new PropertiesWrapper(properties)).
            getIntProperty(LOG_OPS_PROPERTY, DEFAULT_LOG_OPS);
  localCounters = new HashMap<String, Long>();
    }
View Full Code Here


    {
    taskCount = 0;
  lifetimeHistogram = new PowerOfTwoHistogram();
  windowHistogram = new PowerOfTwoHistogram();

  windowSize = new PropertiesWrapper(properties).
      getIntProperty(ProfileListener.WINDOW_SIZE_PROPERTY,
                           DEFAULT_WINDOW_SIZE);
    }
View Full Code Here

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

        map = new HashMap<String, TaskDetail>();

        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 TaskRunnable(), owner,
                                  System.currentTimeMillis() + reportPeriod,
                                  reportPeriod);
        handle.start();
View Full Code Here

   
    /** Creates a new instance of RoundRobinPolicy */
    public RoundRobinPolicy(Properties props, NodeMappingServerImpl server) {
        this.server = server;
       
        PropertiesWrapper wrappedProps = new PropertiesWrapper(props);
        moveCount = wrappedProps.getIntProperty(
                MOVE_COUNT_PROPERTY, DEFAULT_MOVE_COUNT);
    }
View Full Code Here

                                    ComponentRegistry registry)
        throws IOException
    {
  localCounters = new ConcurrentHashMap<String, Long>();

        PropertiesWrapper wrappedProps = new PropertiesWrapper(properties);

        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 AggregatingRunnable(), owner,
                                  System.currentTimeMillis() + reportPeriod,
                                  reportPeriod);
        handle.start();
View Full Code Here

  throws Exception
    {
  super(properties, systemRegistry, txnProxy, logger);
  logger.log(Level.CONFIG, "Creating WatchdogServiceImpl properties:{0}",
       properties);
  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);
            if (startServer) {
                localNodeId = serverImpl.localNodeId;
                renewInterval = serverImpl.renewInterval;
            } else {
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

    {
        super(properties, systemRegistry, txnProxy,
              new LoggerWrapper(Logger.getLogger(PKG_NAME)));
        logger.log(Level.CONFIG, "Creating NodeMappingServiceImpl");
       
        PropertiesWrapper wrappedProps = new PropertiesWrapper(properties);
       
  try {
            watchdogService = txnProxy.getService(WatchdogService.class);
           
            contextFactory = new ContextFactory(txnProxy);
               
            /*
       * Check service version.
       */
      transactionScheduler.runTask(
    new AbstractKernelRunnable("CheckServiceVersion") {
        public void run() {
      checkServiceVersion(
          NodeMapUtil.VERSION_KEY,
                            NodeMapUtil.MAJOR_VERSION,
                            NodeMapUtil.MINOR_VERSION);
        } },  taskOwner);
                   
            // Find or create our server.  
            String localHost =
                    InetAddress.getLocalHost().getHostName();
            NodeType nodeType =
                wrappedProps.getEnumProperty(StandardProperties.NODE_TYPE,
                                             NodeType.class,
                                             NodeType.singleNode);
            boolean instantiateServer = nodeType != NodeType.appNode;
           
            String host;
            int port;
           
            if (instantiateServer) {
                serverImpl =
                    new NodeMappingServerImpl(properties,
                                              systemRegistry, txnProxy);
                // Use the port actually used by our server instance
                host = localHost;
                port = serverImpl.getPort();
            } else {
                serverImpl = null;
                host =
                    wrappedProps.getProperty(
      SERVER_HOST_PROPERTY,
      wrappedProps.getProperty(
          StandardProperties.SERVER_HOST));
                if (host == null) {
                    throw new IllegalArgumentException(
                                           "A server host must be specified");
                }
                port = wrappedProps.getIntProperty(
                        NodeMappingServerImpl.SERVER_PORT_PROPERTY,
                        NodeMappingServerImpl.DEFAULT_SERVER_PORT, 0, 65535);  
            }         
         
            // TODO This code assumes that the server has already been started.
            // Perhaps it'd be better to block until the server is available?
            Registry registry = LocateRegistry.getRegistry(host, port);
            server = (NodeMappingServer) registry.lookup(
                         NodeMappingServerImpl.SERVER_EXPORT_NAME);     
           
            // Export our client object for server callbacks.
            int clientPort = wrappedProps.getIntProperty(
                                        CLIENT_PORT_PROPERTY,
                                        DEFAULT_CLIENT_PORT, 0, 65535);
            changeNotifierImpl = new MapChangeNotifier();
            exporter = new Exporter<NotifyClient>(NotifyClient.class);
            clientPort = exporter.export(changeNotifierImpl, clientPort);
View Full Code Here

  throws Exception
    {
        logger.log(Level.CONFIG, "Creating DataServiceImpl");
  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);
            NodeType nodeType =
                wrappedProps.getEnumProperty(StandardProperties.NODE_TYPE,
                                             NodeType.class,
                                             NodeType.singleNode);

      DataStore baseStore;
      if (dataStoreClassName != null) {
    baseStore = wrappedProps.getClassInstanceProperty(
        DATA_STORE_CLASS_PROPERTY, DataStore.class,
        new Class[] { Properties.class, ComponentRegistry.class,
          TransactionProxy.class },
        properties, systemRegistry, txnProxy);
    logger.log(Level.CONFIG, "Using data store {0}", baseStore);
View Full Code Here

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

  PropertiesWrapper wrappedProps = new PropertiesWrapper(properties);
  try {
            readBufferSize = wrappedProps.getIntProperty(
                READ_BUFFER_SIZE_PROPERTY, DEFAULT_READ_BUFFER_SIZE,
                MIN_READ_BUFFER_SIZE, Integer.MAX_VALUE);
      disconnectDelay = wrappedProps.getLongProperty(
    DISCONNECT_DELAY_PROPERTY, DEFAULT_DISCONNECT_DELAY,
    MIN_DISCONNECT_DELAY, Long.MAX_VALUE);
      identityManager =
    systemRegistry.getComponent(IdentityCoordinator.class);
              
            transport =
                wrappedProps.getClassInstanceProperty(
        TRANSPORT_PROPERTY, DEFAULT_TRANSPORT, Transport.class,
        new Class[] {Properties.class}, properties);

      protocolVersion =
    wrappedProps.getIntProperty(
    PROTOCOL_VERSION_PROPERTY, DEFAULT_PROTOCOL_VERSION,
    PROTOCOL4, SimpleSgsProtocol.VERSION);

            if (!transport.getDelivery().equals(Delivery.RELIABLE)) {
                transport.shutdown();
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.