Example #1
0
  /**
   * Loads global settings for properties that haven't been initialized from command line or config
   * file
   *
   * @param config configuration
   */
  protected void readGlobalSettings(IConfiguration config) {
    if (m_port == 0) {
      m_port = DEFAULT_LISTEN_PORT;
    }
    if (m_threadCount == 0) {
      m_threadCount = DEFAULT_SIMULT_FAST_OPERATIONS;
    }
    if (m_memoryQuota == 0) {
      m_memoryQuota = config.getLongProperty(PROXY_PREFIX + MEMORY_QUOTA, DEFAULT_MEMORY_QUOTA_MB);
    }
    m_memoryQuota *= 1024 * 1024;

    m_memoryMultiplier = config.getDoubleProperty(PROXY_PREFIX + MEMORY_MULT, DEFAULT_MEMORY_MULT);

    m_quotaTimeout = config.getLongProperty(PROXY_PREFIX + QUOTA_TIMEOUT, DEFAULT_QUOTA_TIMEOUT);

    // check max memory setting
    long maxMessageSize = IndexEmailParser.getMaxIndexableDocSizeBytes();
    long cfgMaxBatchSize =
        1024L
            * config.getIntProperty(
                IIndexContentManager.CONFIG_MAX_KILOBYTES_IN_BATCH,
                IndexSubmissionBufferRegulator.DEFAULT_MAX_KB_PER_BATCH);
    setMaxBatchSize(effectiveMemoryCost(maxMessageSize + cfgMaxBatchSize));
    if (m_maxBatchSize > m_memoryQuota) {
      throw new IllegalArgumentException(
          "Invalid memory configuration: max effective batch size ("
              + m_maxBatchSize
              + " bytes) cannot be greater than the memory quota ("
              + m_memoryQuota
              + " bytes)");
    }

    m_proxyStats.configure(config);
  }
 private static DistributedKeyStore createDKS() {
   IConfiguration config = FakeConfiguration.getInstance();
   Map props = config.getProperties();
   props.put("distributedkey.filename", "xxx");
   props.put("sessionkey.clock.skew", "0");
   props.put("sessionkey.lifetime", "0");
   props.put("sessionkey.start.delay", "0");
   DistributedKeyStore ks = new DistributedKeyStore(config);
   ks.addKey(ks.generateKey(0, 24 * 60 * 60 * 1000L)); // 24 hours
   return ks;
 }
Example #3
0
  public ClientSupportManager(ITransactionManager txManager, IConfiguration config) {
    super(txManager);
    m_txManager = txManager;
    m_configuration = config;
    File nfsRoot = NFSUtils.getNFSRoot(config);
    m_cacheBaseDir = new File(nfsRoot, "sysconf/cache");
    try {
      m_sr = SecureRandom.getInstance("SHA1PRNG");
    } catch (NoSuchAlgorithmException ex) {
      // should never occur.
      m_logCategory.fatal("Can't initialize", ex);
      throw new RuntimeException("Initialization failed: " + ex);
    }

    String prefix = config.getProperty("client.url.prefix");
    if (prefix == null) {
      prefix = "http://" + config.getProperty("default.backend.hostname") + "/cache/client";
    }
    m_urlPrefix = prefix;

    m_smtpSession = createSMTPSession(config);
  }
Example #4
0
 protected void readInstanceSettings(IConfiguration config) {
   // load settings from config file without overwriting existing values
   String proxySection = PROXY_PREFIX + m_proxyId + ".";
   if (m_clusterID == 0) {
     m_clusterID = config.getIntProperty(proxySection + CLUSTER_ID_NAME, 0);
   }
   if (m_port == 0) {
     int defaultPort = config.getIntProperty(PROXY_PREFIX + LISTEN_PORT_NAME, DEFAULT_LISTEN_PORT);
     m_port = config.getIntProperty(proxySection + LISTEN_PORT_NAME, defaultPort);
   }
   if (m_threadCount == 0) {
     int defaultThreadCount =
         config.getIntProperty(CONFIG_SIMULT_FAST_OPERATIONS, DEFAULT_SIMULT_FAST_OPERATIONS);
     m_threadCount =
         config.getIntProperty(proxySection + SIMULTANEOUS_OPS_NAME, defaultThreadCount);
   }
   if (m_bindAddress == null) {
     String defaultBindAddress = config.getProperty(PROXY_PREFIX + BIND_ADDRESS);
     m_bindAddress = config.getProperty(proxySection + BIND_ADDRESS, defaultBindAddress);
   }
 }
Example #5
0
 private boolean isLocalBackend(String backend) {
   IConfiguration cm = ManagementContainer.getInstance().getConfiguration();
   String localBackend = cm.getProperty("default.backend.hostname");
   return EqualityUtils.nullsOrEqual(localBackend, backend);
 }
Example #6
0
 /** @return how many millis to wait between retries of batch submission */
 protected long getRetryDelayMillis() {
   return (long)
       m_configuration.getIntProperty(CONFIG_RETRY_DELAY_MILLIS, (int) DEFAULT_RETRY_DELAY_MILLIS);
 }
Example #7
0
 /** @return how many times to retry a batch that's failed because FAST is "busy" */
 protected int getNumBatchRetries() {
   return m_configuration.getIntProperty(CONFIG_RETRIES, DEFAULT_NUM_RETRIES);
 }
Example #8
0
 /** @return how many millis to wait for successful completion of one batch */
 protected long getBatchTimeoutMillis() {
   return (long)
       m_configuration.getIntProperty(
           CONFIG_BATCH_TIMEOUT_MILLIS, (int) DEFAULT_BATCH_TIMEOUT_MILLIS);
 }