Пример #1
0
  @Override
  public void start() throws CacheLoaderException {

    try {
      dataSource = new DataSource(config.getPoolProperties());
      readConsistencyLevel = ConsistencyLevel.valueOf(config.readConsistencyLevel);
      writeConsistencyLevel = ConsistencyLevel.valueOf(config.writeConsistencyLevel);
      entryColumnPath =
          new ColumnPath(config.entryColumnFamily)
              .setColumn(ENTRY_COLUMN_NAME.getBytes(UTF8Charset));
      entryColumnParent = new ColumnParent(config.entryColumnFamily);
      entryKeyPrefix = ENTRY_KEY_PREFIX + (config.isSharedKeyspace() ? cacheName + "_" : "");
      expirationColumnParent = new ColumnParent(config.expirationColumnFamily);
      expirationKey =
          ByteBufferUtil.bytes(EXPIRATION_KEY + (config.isSharedKeyspace() ? "_" + cacheName : ""));
      keyMapper = (TwoWayKey2StringMapper) Util.getInstance(config.getKeyMapper());
    } catch (Exception e) {
      throw new ConfigurationException(e);
    }

    log.debug("cleaning up expired entries...");
    purgeInternal();

    log.debug("started");
    super.start();
  }
 protected AbstractColumnFamilyRecordWriter(Configuration conf) {
   this.conf = conf;
   this.ringCache = new RingCache(conf);
   this.queueSize =
       conf.getInt(
           AbstractColumnFamilyOutputFormat.QUEUE_SIZE, 32 * FBUtilities.getAvailableProcessors());
   batchThreshold = conf.getLong(AbstractColumnFamilyOutputFormat.BATCH_THRESHOLD, 32);
   consistencyLevel = ConsistencyLevel.valueOf(ConfigHelper.getWriteConsistencyLevel(conf));
 }