MCPcopy Create free account
hub / github.com/OpenTSDB/asynchbase / newTimer

Method newTimer

src/HBaseClient.java:660–675  ·  view source on GitHub ↗

Package private timer constructor that provides a useful name for the timer thread. @param config The config object used to pull out the tick interval @param name A name to stash in the timer @return A timer

(final Config config, final String name)

Source from the content-addressed store, hash-verified

658 * @return A timer
659 */
660 static HashedWheelTimer newTimer(final Config config, final String name) {
661 class TimerThreadNamer implements ThreadNameDeterminer {
662 @Override
663 public String determineThreadName(String currentThreadName,
664 String proposedThreadName) throws Exception {
665 return "AsyncHBase Timer " + name + " #" + TIMER_THREAD_ID.incrementAndGet();
666 }
667 }
668 if (config == null) {
669 return new HashedWheelTimer(Executors.defaultThreadFactory(),
670 new TimerThreadNamer(), 100, MILLISECONDS, 512);
671 }
672 return new HashedWheelTimer(Executors.defaultThreadFactory(),
673 new TimerThreadNamer(), config.getShort("hbase.timer.tick"),
674 MILLISECONDS, config.getInt("hbase.timer.ticks_per_wheel"));
675 }
676
677 /** Creates a default channel factory in case we haven't been given one.
678 * The factory will use Netty defaults and provide thread naming rules for

Callers 2

HBaseClientMethod · 0.95
defaultChannelFactoryMethod · 0.95

Calls 2

getShortMethod · 0.45
getIntMethod · 0.45

Tested by

no test coverage detected