当前位置: 首页>>代码示例>>Java>>正文


Java WALActionsListener类代码示例

本文整理汇总了Java中org.apache.hadoop.hbase.regionserver.wal.WALActionsListener的典型用法代码示例。如果您正苦于以下问题:Java WALActionsListener类的具体用法?Java WALActionsListener怎么用?Java WALActionsListener使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


WALActionsListener类属于org.apache.hadoop.hbase.regionserver.wal包,在下文中一共展示了WALActionsListener类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: WALFactory

import org.apache.hadoop.hbase.regionserver.wal.WALActionsListener; //导入依赖的package包/类
/**
 * @param conf must not be null, will keep a reference to read params in later reader/writer
 *     instances.
 * @param listeners may be null. will be given to all created wals (and not meta-wals)
 * @param factoryId a unique identifier for this factory. used i.e. by filesystem implementations
 *     to make a directory
 */
public WALFactory(final Configuration conf, final List<WALActionsListener> listeners,
    final String factoryId) throws IOException {
  // until we've moved reader/writer construction down into providers, this initialization must
  // happen prior to provider initialization, in case they need to instantiate a reader/writer.
  timeoutMillis = conf.getInt("hbase.hlog.open.timeout", 300000);
  /* TODO Both of these are probably specific to the fs wal provider */
  logReaderClass = conf.getClass("hbase.regionserver.hlog.reader.impl", ProtobufLogReader.class,
      DefaultWALProvider.Reader.class);
  this.conf = conf;
  this.factoryId = factoryId;
  // end required early initialization
  if (conf.getBoolean("hbase.regionserver.hlog.enabled", true)) {
    provider = getProvider(WAL_PROVIDER, DEFAULT_WAL_PROVIDER, listeners, null);
  } else {
    // special handling of existing configuration behavior.
    LOG.warn("Running with WAL disabled.");
    provider = new DisabledWALProvider();
    provider.init(this, conf, null, factoryId);
  }
}
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:28,代码来源:WALFactory.java

示例2: getMetaWAL

import org.apache.hadoop.hbase.regionserver.wal.WALActionsListener; //导入依赖的package包/类
/**
 * @param identifier may not be null, contents will not be altered
 */
public WAL getMetaWAL(final byte[] identifier) throws IOException {
  WALProvider metaProvider = this.metaProvider.get();
  if (null == metaProvider) {
    final WALProvider temp = getProvider(META_WAL_PROVIDER, DEFAULT_META_WAL_PROVIDER,
        Collections.<WALActionsListener>singletonList(new MetricsWAL()),
        DefaultWALProvider.META_WAL_PROVIDER_ID);
    if (this.metaProvider.compareAndSet(null, temp)) {
      metaProvider = temp;
    } else {
      // reference must now be to a provider created in another thread.
      temp.close();
      metaProvider = this.metaProvider.get();
    }
  }
  return metaProvider.getWAL(identifier);
}
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:20,代码来源:WALFactory.java

示例3: append

import org.apache.hadoop.hbase.regionserver.wal.WALActionsListener; //导入依赖的package包/类
@Override
public long append(HTableDescriptor htd, HRegionInfo info, WALKey key, WALEdit edits,
                   boolean inMemstore) {
  if (!this.listeners.isEmpty()) {
    final long start = System.nanoTime();
    long len = 0;
    for (Cell cell : edits.getCells()) {
      len += CellUtil.estimatedSerializedSizeOf(cell);
    }
    final long elapsed = (System.nanoTime() - start)/1000000l;
    for (WALActionsListener listener : this.listeners) {
      listener.postAppend(len, elapsed);
    }
  }
  return -1;
}
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:17,代码来源:DisabledWALProvider.java

示例4: createHRegion

import org.apache.hadoop.hbase.regionserver.wal.WALActionsListener; //导入依赖的package包/类
/**
 * Convenience method creating new HRegions. Used by createTable. The {@link WAL} for the created
 * region needs to be closed explicitly, if it is not null. Use {@link HRegion#getWAL()} to get
 * access.
 *
 * @param info       Info for region to create.
 * @param rootDir    Root directory for HBase instance
 * @param tableDir   table directory
 * @param wal        shared WAL
 * @param initialize - true to initialize the region
 * @param ignoreWAL  - true to skip generate new wal if it is null, mostly for createTable
 * @return new HRegion
 * @throws IOException
 */
public static HRegion createHRegion(final HRegionInfo info, final Path rootDir,
    final Path tableDir, final Configuration conf, final HTableDescriptor hTableDescriptor,
    final WAL wal, final boolean initialize, final boolean ignoreWAL) throws IOException {
  LOG.info("creating HRegion " + info.getTable().getNameAsString() + " HTD == " + hTableDescriptor
      + " RootDir = " + rootDir + " Table name == " + info.getTable().getNameAsString());
  FileSystem fs = FileSystem.get(conf);
  HRegionFileSystem.createRegionOnFileSystem(conf, fs, tableDir, info);
  WAL effectiveWAL = wal;
  if (wal == null && !ignoreWAL) {
    // TODO HBASE-11983 There'll be no roller for this wal?
    // The WAL subsystem will use the default rootDir rather than the passed
    // in rootDir
    // unless I pass along via the conf.
    Configuration confForWAL = new Configuration(conf);
    confForWAL.set(HConstants.HBASE_DIR, rootDir.toString());
    effectiveWAL = (new WALFactory(confForWAL,
        Collections.<WALActionsListener>singletonList(new MetricsWAL()),
        "hregion-" + RandomStringUtils.randomNumeric(8))).getWAL(info.getEncodedNameAsBytes());
  }
  HRegion region =
      HRegion.newHRegion(tableDir, effectiveWAL, fs, conf, info, hTableDescriptor, null);
  if (initialize) region.initialize(null);
  return region;
}
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:39,代码来源:HRegion.java

示例5: init

import org.apache.hadoop.hbase.regionserver.wal.WALActionsListener; //导入依赖的package包/类
/**
 * @param factory factory that made us, identity used for FS layout. may not be null
 * @param conf may not be null
 * @param listeners may be null
 * @param providerId differentiate between providers from one facotry, used for FS layout. may be
 *                   null
 */
@Override
public void init(final WALFactory factory, final Configuration conf,
    final List<WALActionsListener> listeners, String providerId) throws IOException {
  if (null != log) {
    throw new IllegalStateException("WALProvider.init should only be called once.");
  }
  if (null == providerId) {
    providerId = DEFAULT_PROVIDER_ID;
  }
  final String logPrefix = factory.factoryId + WAL_FILE_NAME_DELIMITER + providerId;
  log = new IOTestWAL(FileSystem.get(conf), FSUtils.getRootDir(conf),
      DefaultWALProvider.getWALDirectoryName(factory.factoryId),
      HConstants.HREGION_OLDLOGDIR_NAME, conf, listeners,
      true, logPrefix, META_WAL_PROVIDER_ID.equals(providerId) ? META_WAL_PROVIDER_ID : null);
}
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:23,代码来源:IOTestProvider.java

示例6: append

import org.apache.hadoop.hbase.regionserver.wal.WALActionsListener; //导入依赖的package包/类
@Override
public long append(HTableDescriptor htd, HRegionInfo info, WALKey key, WALEdit edits,
    AtomicLong sequenceId, boolean inMemstore, List<Cell> memstoreKVs) {
  if (!this.listeners.isEmpty()) {
    final long start = System.nanoTime();
    long len = 0;
    for (Cell cell : edits.getCells()) {
      len += CellUtil.estimatedSerializedSizeOf(cell);
    }
    final long elapsed = (System.nanoTime() - start)/1000000l;
    for (WALActionsListener listener : this.listeners) {
      listener.postAppend(len, elapsed);
    }
  }
  return -1;
}
 
开发者ID:grokcoder,项目名称:pbase,代码行数:17,代码来源:DisabledWALProvider.java

示例7: append

import org.apache.hadoop.hbase.regionserver.wal.WALActionsListener; //导入依赖的package包/类
@Override
public long append(RegionInfo info, WALKeyImpl key, WALEdit edits, boolean inMemstore)
    throws IOException {
  if (!this.listeners.isEmpty()) {
    final long start = System.nanoTime();
    long len = 0;
    for (Cell cell : edits.getCells()) {
      len += PrivateCellUtil.estimatedSerializedSizeOf(cell);
    }
    final long elapsed = (System.nanoTime() - start) / 1000000L;
    for (WALActionsListener listener : this.listeners) {
      listener.postAppend(len, elapsed, key, edits);
    }
  }
  return -1;
}
 
开发者ID:apache,项目名称:hbase,代码行数:17,代码来源:DisabledWALProvider.java

示例8: init

import org.apache.hadoop.hbase.regionserver.wal.WALActionsListener; //导入依赖的package包/类
@Override
public void init(final WALFactory factory, final Configuration conf,
    final List<WALActionsListener> listeners, final String providerId) throws IOException {
  if (null != strategy) {
    throw new IllegalStateException("WALProvider.init should only be called once.");
  }
  this.factory = factory;
  this.listeners = null == listeners ? null : Collections.unmodifiableList(listeners);
  this.providerId = providerId;
  this.strategy = getStrategy(conf, REGION_GROUPING_STRATEGY, DEFAULT_REGION_GROUPING_STRATEGY);
}
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:12,代码来源:RegionGroupingProvider.java

示例9: init

import org.apache.hadoop.hbase.regionserver.wal.WALActionsListener; //导入依赖的package包/类
@Override
public void init(final WALFactory factory, final Configuration conf,
    final List<WALActionsListener> listeners, final String providerId) throws IOException {
  super.init(factory, conf, listeners, providerId);
  // no need to check for and close down old providers; our parent class will throw on re-invoke
  delegates = new WALProvider[Math.max(1, conf.getInt(NUM_REGION_GROUPS,
      DEFAULT_NUM_REGION_GROUPS))];
  for (int i = 0; i < delegates.length; i++) {
    delegates[i] = factory.getProvider(DELEGATE_PROVIDER, DEFAULT_DELEGATE_PROVIDER, listeners,
        providerId + i);
  }
  LOG.info("Configured to run with " + delegates.length + " delegate WAL providers.");
}
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:14,代码来源:BoundedRegionGroupingProvider.java

示例10: init

import org.apache.hadoop.hbase.regionserver.wal.WALActionsListener; //导入依赖的package包/类
@Override
public void init(final WALFactory factory, final Configuration conf,
    final List<WALActionsListener> listeners, String providerId) throws IOException {
  if (null != disabled) {
    throw new IllegalStateException("WALProvider.init should only be called once.");
  }
  if (null == providerId) {
    providerId = "defaultDisabled";
  }
  disabled = new DisabledWAL(new Path(FSUtils.getRootDir(conf), providerId), conf, null);
}
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:12,代码来源:DisabledWALProvider.java

示例11: DisabledWAL

import org.apache.hadoop.hbase.regionserver.wal.WALActionsListener; //导入依赖的package包/类
public DisabledWAL(final Path path, final Configuration conf,
    final List<WALActionsListener> listeners) {
  this.coprocessorHost = new WALCoprocessorHost(this, conf);
  this.path = path;
  if (null != listeners) {
    for(WALActionsListener listener : listeners) {
      registerWALActionsListener(listener);
    }
  }
}
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:11,代码来源:DisabledWALProvider.java

示例12: shutdown

import org.apache.hadoop.hbase.regionserver.wal.WALActionsListener; //导入依赖的package包/类
@Override
public void shutdown() {
  if(closed.compareAndSet(false, true)) {
    if (!this.listeners.isEmpty()) {
      for (WALActionsListener listener : this.listeners) {
        listener.logCloseRequested();
      }
    }
  }
}
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:11,代码来源:DisabledWALProvider.java

示例13: sync

import org.apache.hadoop.hbase.regionserver.wal.WALActionsListener; //导入依赖的package包/类
@Override
public void sync() {
  if (!this.listeners.isEmpty()) {
    for (WALActionsListener listener : this.listeners) {
      listener.postSync(0l, 0);
    }
  }
}
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:9,代码来源:DisabledWALProvider.java

示例14: setupWALAndReplication

import org.apache.hadoop.hbase.regionserver.wal.WALActionsListener; //导入依赖的package包/类
/**
 * Setup WAL log and replication if enabled.
 * Replication setup is done in here because it wants to be hooked up to WAL.
 *
 * @return A WAL instance.
 * @throws IOException
 */
private WALFactory setupWALAndReplication() throws IOException {
  // TODO Replication make assumptions here based on the default filesystem impl
  final Path oldLogDir = new Path(rootDir, HConstants.HREGION_OLDLOGDIR_NAME);
  final String logName = DefaultWALProvider.getWALDirectoryName(this.serverName.toString());

  Path logdir = new Path(rootDir, logName);
  if (LOG.isDebugEnabled()) LOG.debug("logdir=" + logdir);
  if (this.fs.exists(logdir)) {
    throw new RegionServerRunningException(
        "Region server has already " + "created directory at " + this.serverName.toString());
  }

  // Instantiate replication manager if replication enabled.  Pass it the
  // log directories.
  createNewReplicationInstance(conf, this, this.fs, logdir, oldLogDir);

  // listeners the wal factory will add to wals it creates.
  final List<WALActionsListener> listeners = new ArrayList<WALActionsListener>();
  listeners.add(new MetricsWAL());
  if (this.replicationSourceHandler != null
      && this.replicationSourceHandler.getWALActionsListener() != null) {
    // Replication handler is an implementation of WALActionsListener.
    listeners.add(this.replicationSourceHandler.getWALActionsListener());
  }

  return new WALFactory(conf, listeners, serverName.toString());
}
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:35,代码来源:HRegionServer.java

示例15: addWAL

import org.apache.hadoop.hbase.regionserver.wal.WALActionsListener; //导入依赖的package包/类
public void addWAL(final WAL wal) {
  if (null == walNeedsRoll.putIfAbsent(wal, Boolean.FALSE)) {
    wal.registerWALActionsListener(new WALActionsListener.Base() {
      @Override
      public void logRollRequested(boolean lowReplicas) {
        walNeedsRoll.put(wal, Boolean.TRUE);
        // TODO logs will contend with each other here, replace with e.g. DelayedQueue
        synchronized(rollLog) {
          rollLog.set(true);
          rollLog.notifyAll();
        }
      }
    });
  }
}
 
开发者ID:fengchen8086,项目名称:ditb,代码行数:16,代码来源:LogRoller.java


注:本文中的org.apache.hadoop.hbase.regionserver.wal.WALActionsListener类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。