本文整理汇总了Java中org.apache.lucene.store.LockFactory类的典型用法代码示例。如果您正苦于以下问题:Java LockFactory类的具体用法?Java LockFactory怎么用?Java LockFactory使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
LockFactory类属于org.apache.lucene.store包,在下文中一共展示了LockFactory类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createFSDirectory
import org.apache.lucene.store.LockFactory; //导入依赖的package包/类
private static FSDirectory createFSDirectory (
final File indexFolder,
final LockFactory lockFactory) throws IOException {
assert indexFolder != null;
assert lockFactory != null;
final FSDirectory directory;
final String dirType = System.getProperty(PROP_DIR_TYPE);
if(DIR_TYPE_MMAP.equals(dirType)) {
directory = new MMapDirectory(indexFolder, lockFactory);
} else if (DIR_TYPE_NIO.equals(dirType)) {
directory = new NIOFSDirectory(indexFolder, lockFactory);
} else if (DIR_TYPE_IO.equals(dirType)) {
directory = new SimpleFSDirectory(indexFolder, lockFactory);
} else {
directory = FSDirectory.open(indexFolder, lockFactory);
}
return directory;
}
示例2: setPreload
import org.apache.lucene.store.LockFactory; //导入依赖的package包/类
private static Directory setPreload(Directory directory, Path location, LockFactory lockFactory,
Set<String> preLoadExtensions) throws IOException {
if (preLoadExtensions.isEmpty() == false
&& directory instanceof MMapDirectory
&& ((MMapDirectory) directory).getPreload() == false) {
if (preLoadExtensions.contains("*")) {
((MMapDirectory) directory).setPreload(true);
return directory;
}
MMapDirectory primary = new MMapDirectory(location, lockFactory);
primary.setPreload(true);
return new FileSwitchDirectory(preLoadExtensions, primary, directory, true) {
@Override
public String[] listAll() throws IOException {
// avoid listing twice
return primary.listAll();
}
};
}
return directory;
}
示例3: annotateException
import org.apache.lucene.store.LockFactory; //导入依赖的package包/类
private static <T extends Exception> T annotateException(
@NonNull final T e,
@NullAllowed File indexDir,
@NullAllowed Map<Thread,StackTraceElement[]> threads,
@NullAllowed LockFactory lockFactory) {
final StringBuilder message = new StringBuilder();
if (indexDir != null) {
final File[] children = indexDir.listFiles();
if (children == null) {
message.append("Non existing index folder"); //NOI18N
} else {
for (File c : children) {
message.append(c.getName()).append(" f: ").append(c.isFile()).
append(" r: ").append(c.canRead()).
append(" w: ").append(c.canWrite()).append("\n"); //NOI18N
}
}
}
if (threads != null) {
final Thread ct = Thread.currentThread();
message.append("current thread: ").append(ct).append('(').append(ct.getId()).append(')'); //NOI18N
message.append("threads: \n"); //NOI18N //NOI18N
stackTraces(threads, message);
}
if (lockFactory != null) {
message.append("lockFactory: ").append(lockFactory); //NOI18N
}
return Exceptions.attachMessage(e, message.toString());
}
示例4: newDirectory
import org.apache.lucene.store.LockFactory; //导入依赖的package包/类
@Override
public Directory newDirectory() throws IOException {
final Path location = path.resolveIndex();
final LockFactory lockFactory = indexSettings.getValue(INDEX_LOCK_FACTOR_SETTING);
Files.createDirectories(location);
Directory wrapped = newFSDirectory(location, lockFactory);
Set<String> preLoadExtensions = new HashSet<>(
indexSettings.getValue(IndexModule.INDEX_STORE_PRE_LOAD_SETTING));
wrapped = setPreload(wrapped, location, lockFactory, preLoadExtensions);
if (indexSettings.isOnSharedFilesystem()) {
wrapped = new SleepingLockWrapper(wrapped, 5000);
}
return wrapped;
}
示例5: newFSDirectory
import org.apache.lucene.store.LockFactory; //导入依赖的package包/类
protected Directory newFSDirectory(Path location, LockFactory lockFactory) throws IOException {
final String storeType = indexSettings.getSettings().get(IndexModule.INDEX_STORE_TYPE_SETTING.getKey(),
IndexModule.Type.FS.getSettingsKey());
if (IndexModule.Type.FS.match(storeType)) {
return FSDirectory.open(location, lockFactory); // use lucene defaults
} else if (IndexModule.Type.SIMPLEFS.match(storeType)) {
return new SimpleFSDirectory(location, lockFactory);
} else if (IndexModule.Type.NIOFS.match(storeType)) {
return new NIOFSDirectory(location, lockFactory);
} else if (IndexModule.Type.MMAPFS.match(storeType)) {
return new MMapDirectory(location, lockFactory);
}
throw new IllegalArgumentException("No directory found for type [" + storeType + "]");
}
示例6: newFSDirectory
import org.apache.lucene.store.LockFactory; //导入依赖的package包/类
@Override
protected synchronized Directory newFSDirectory(Path location, LockFactory lockFactory) throws IOException {
throw new UnsupportedOperationException();
}
示例7: newFSDirectory
import org.apache.lucene.store.LockFactory; //导入依赖的package包/类
@Override
protected Directory newFSDirectory(Path location, LockFactory lockFactory) throws IOException {
logger.debug("wrapping SimpleFSDirectory for SMB");
return new SmbDirectoryWrapper(new SimpleFSDirectory(location, lockFactory));
}
示例8: newFSDirectory
import org.apache.lucene.store.LockFactory; //导入依赖的package包/类
@Override
protected Directory newFSDirectory(Path location, LockFactory lockFactory) throws IOException {
logger.debug("wrapping MMapDirectory for SMB");
return new SmbDirectoryWrapper(new MMapDirectory(location, indexSettings.getValue(INDEX_LOCK_FACTOR_SETTING)));
}
示例9: getLockFactory
import org.apache.lucene.store.LockFactory; //导入依赖的package包/类
@Override public LockFactory getLockFactory() {
return null;
}
示例10: newFSDirectory
import org.apache.lucene.store.LockFactory; //导入依赖的package包/类
/** Returns a new FSDirectory instance over the given file, which must be a folder. */
public static BaseDirectoryWrapper newFSDirectory(File f, LockFactory lf) {
return newFSDirectory(f, lf, rarely());
}
示例11: getLockFactory
import org.apache.lucene.store.LockFactory; //导入依赖的package包/类
public LockFactory getLockFactory() {
return directory.getLockFactory();
}
示例12: setLockFactory
import org.apache.lucene.store.LockFactory; //导入依赖的package包/类
public void setLockFactory(LockFactory lockFactory) throws IOException {
directory.setLockFactory(lockFactory);
}
示例13: getLockFactory
import org.apache.lucene.store.LockFactory; //导入依赖的package包/类
@Override
public LockFactory getLockFactory() {
return wrapped.getLockFactory();
}
示例14: setLockFactory
import org.apache.lucene.store.LockFactory; //导入依赖的package包/类
@Override
public void setLockFactory(LockFactory lockFactory) {
wrapped.setLockFactory(lockFactory);
}
示例15: DistributedDirectory
import org.apache.lucene.store.LockFactory; //导入依赖的package包/类
public DistributedDirectory(NosqlDirectory nosqlDirectory, LockFactory lockFactory) throws IOException {
super(lockFactory);
this.nosqlDirectory = nosqlDirectory;
}