use of com.google.common.annotations.VisibleForTesting in project hbase by apache.
the class FSTableDescriptors method updateTableDescriptor.
/**
* Update table descriptor on the file system
* @throws IOException Thrown if failed update.
* @throws NotImplementedException if in read only mode
*/
@VisibleForTesting
Path updateTableDescriptor(HTableDescriptor td) throws IOException {
if (fsreadonly) {
throw new NotImplementedException("Cannot update a table descriptor - in read only mode");
}
TableName tableName = td.getTableName();
Path tableDir = getTableDir(tableName);
Path p = writeTableDescriptor(fs, td, tableDir, getTableInfoPath(tableDir));
if (p == null)
throw new IOException("Failed update");
LOG.info("Updated tableinfo=" + p);
if (usecache) {
this.cache.put(td.getTableName(), td);
}
return p;
}
use of com.google.common.annotations.VisibleForTesting in project hbase by apache.
the class FSTableDescriptors method getTableInfoSequenceId.
/**
* @param p Path to a <code>.tableinfo</code> file.
* @return The current editid or 0 if none found.
*/
@VisibleForTesting
static int getTableInfoSequenceId(final Path p) {
if (p == null)
return 0;
Matcher m = TABLEINFO_FILE_REGEX.matcher(p.getName());
if (!m.matches())
throw new IllegalArgumentException(p.toString());
String suffix = m.group(2);
if (suffix == null || suffix.length() <= 0)
return 0;
return Integer.parseInt(m.group(2));
}
use of com.google.common.annotations.VisibleForTesting in project hbase by apache.
the class IdReadWriteLock method waitForWaiters.
@VisibleForTesting
public void waitForWaiters(long id, int numWaiters) throws InterruptedException {
for (ReentrantReadWriteLock readWriteLock; ; ) {
readWriteLock = lockPool.get(id);
if (readWriteLock != null) {
synchronized (readWriteLock) {
if (readWriteLock.getQueueLength() >= numWaiters) {
return;
}
}
}
Thread.sleep(50);
}
}
use of com.google.common.annotations.VisibleForTesting in project hive by apache.
the class StringAppender method addToLogger.
@VisibleForTesting
public void addToLogger(String loggerName, Level level) {
LoggerConfig loggerConfig = configuration.getLoggerConfig(loggerName);
loggerConfig.addAppender(this, level, null);
context.updateLoggers();
}
use of com.google.common.annotations.VisibleForTesting in project hive by apache.
the class Rpc method createEmbedded.
@VisibleForTesting
static Rpc createEmbedded(RpcDispatcher dispatcher) {
EmbeddedChannel c = new EmbeddedChannel(new LoggingHandler(Rpc.class), new KryoMessageCodec(0, MessageHeader.class, NullMessage.class), dispatcher);
Rpc rpc = new Rpc(new RpcConfiguration(Collections.<String, String>emptyMap()), c, ImmediateEventExecutor.INSTANCE);
rpc.dispatcher = dispatcher;
return rpc;
}
Aggregations