[infinispan-commits] Infinispan SVN: r981 - trunk/lucene-directory/src/main/java/org/infinispan/lucene.
infinispan-commits at lists.jboss.org
infinispan-commits at lists.jboss.org
Tue Oct 20 17:29:54 EDT 2009
Author: sannegrinovero
Date: 2009-10-20 17:29:54 -0400 (Tue, 20 Oct 2009)
New Revision: 981
Modified:
trunk/lucene-directory/src/main/java/org/infinispan/lucene/CacheKey.java
trunk/lucene-directory/src/main/java/org/infinispan/lucene/ChunkCacheKey.java
trunk/lucene-directory/src/main/java/org/infinispan/lucene/FileCacheKey.java
trunk/lucene-directory/src/main/java/org/infinispan/lucene/FileListCacheKey.java
trunk/lucene-directory/src/main/java/org/infinispan/lucene/FileMetadata.java
trunk/lucene-directory/src/main/java/org/infinispan/lucene/InfinispanCacheEntryListener.java
trunk/lucene-directory/src/main/java/org/infinispan/lucene/InfinispanDirectory.java
trunk/lucene-directory/src/main/java/org/infinispan/lucene/InfinispanIndexIO.java
trunk/lucene-directory/src/main/java/org/infinispan/lucene/InfinispanLockFactory.java
Log:
[ISPN-218] (Create a distributed Lucene Directory based on Infinispan) : code cleaning: fix logging messages, javadoc broken links, equals/hashcode improvements, improved key implementations.
Modified: trunk/lucene-directory/src/main/java/org/infinispan/lucene/CacheKey.java
===================================================================
--- trunk/lucene-directory/src/main/java/org/infinispan/lucene/CacheKey.java 2009-10-20 19:00:04 UTC (rev 980)
+++ trunk/lucene-directory/src/main/java/org/infinispan/lucene/CacheKey.java 2009-10-20 21:29:54 UTC (rev 981)
@@ -21,70 +21,23 @@
*/
package org.infinispan.lucene;
-import java.io.Serializable;
-
/**
- * Abstract class used as a key for Infinispan cache to distinct its values. Connection of fields:
- * indexName and fileName is unique, even if we share one cache between all DirectoryProvider's
+ * Interface for objects used as a key for Infinispan cache.
+ * Anything we put in the index store has to be scoped to one index,
+ * we tell two indexes apart by giving them unique names, so the keys are
+ * scoped to these index names.
*
- * @author Lukasz Moren
+ * @author Sanne Grinovero
* @since 4.0
- * @see org.hibernate.search.store.infinispan.InfinispanDirectory#cache
+ * @see org.infinispan.lucene.InfinispanDirectory#cache
*/
-public abstract class CacheKey implements Serializable {
+public interface CacheKey {
- protected final String indexName;
- protected final String fileName;
+ /**
+ * Get the name of the index to which this key is scoped to.
+ *
+ * @return the indexName
+ */
+ public String getIndexName();
- protected int hashCode;
-
- protected CacheKey(String indexName, String fileName) {
- this.indexName = indexName;
- this.fileName = fileName;
- }
-
- @Override
- public boolean equals(Object o) {
- if (this == o) {
- return true;
- }
- if (o == null || getClass() != o.getClass()) {
- return false;
- }
-
- CacheKey that = (CacheKey) o;
-
- if (fileName != null ? !fileName.equals(that.fileName) : that.fileName != null) {
- return false;
- }
- if (indexName != null ? !indexName.equals(that.indexName) : that.indexName != null) {
- return false;
- }
-
- return true;
- }
-
- @Override
- public int hashCode() {
- if (hashCode == 0) {
- hashCode = indexName != null ? indexName.hashCode() : 0;
- hashCode = 31 * hashCode + (fileName != null ? fileName.hashCode() : 0);
- hashCode = 31 * hashCode + (this.getClass().getName() != null ? this.getClass().getName().hashCode() : 0);
- }
- return hashCode;
- }
-
- @Override
- public String toString() {
- return "CacheKey{" + "fileName='" + fileName + '\'' + ", indexName='" + indexName + '\'' + '}';
- }
-
- public final String getIndexName() {
- return indexName;
- }
-
- public final String getFileName() {
- return fileName;
- }
-
}
Modified: trunk/lucene-directory/src/main/java/org/infinispan/lucene/ChunkCacheKey.java
===================================================================
--- trunk/lucene-directory/src/main/java/org/infinispan/lucene/ChunkCacheKey.java 2009-10-20 19:00:04 UTC (rev 980)
+++ trunk/lucene-directory/src/main/java/org/infinispan/lucene/ChunkCacheKey.java 2009-10-20 21:29:54 UTC (rev 981)
@@ -26,60 +26,95 @@
/**
* Used as a key to distinguish file chunk in cache.
*
+ * @since 4.0
* @author Lukasz Moren
+ * @author Sanne Grinovero
*/
-public class ChunkCacheKey extends CacheKey implements Serializable {
+final class ChunkCacheKey implements Serializable, CacheKey {
- protected final Integer chunkId;
+ /** The serialVersionUID */
+ private static final long serialVersionUID = 4429712073623290126L;
+
+ private final int chunkId;
+ private final String indexName;
+ private final String fileName;
+ private final int hashCode;
- public ChunkCacheKey(String indexName, String fileName, Integer chunkId) {
- super(indexName, fileName);
+ public ChunkCacheKey(String indexName, String fileName, int chunkId) {
+ this.indexName = indexName;
+ this.fileName = fileName;
this.chunkId = chunkId;
+ this.hashCode = generatedHashCode();
}
- public Integer getChunkId() {
- return Integer.valueOf(chunkId);
+ /**
+ * Get the chunkId.
+ *
+ * @return the chunkId.
+ */
+ public int getChunkId() {
+ return chunkId;
}
+ /**
+ * Get the indexName.
+ *
+ * @return the indexName.
+ */
+ public String getIndexName() {
+ return indexName;
+ }
+
+ /**
+ * Get the fileName.
+ *
+ * @return the fileName.
+ */
+ public String getFileName() {
+ return fileName;
+ }
+
@Override
- public boolean equals(Object o) {
- if (this == o) {
+ public int hashCode() {
+ return hashCode;
+ }
+
+ private int generatedHashCode() {
+ final int prime = 31;
+ int result = 1;
+ result = prime * result + chunkId;
+ result = prime * result + ((fileName == null) ? 0 : fileName.hashCode());
+ result = prime * result + ((indexName == null) ? 0 : indexName.hashCode());
+ return result;
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj)
return true;
- }
- if (o == null || getClass() != o.getClass()) {
+ if (obj == null)
return false;
- }
- if (!super.equals(o)) {
+ if (ChunkCacheKey.class != obj.getClass())
return false;
- }
-
- ChunkCacheKey that = (ChunkCacheKey) o;
-
- if (fileName != null ? !fileName.equals(that.fileName) : that.fileName != null) {
+ ChunkCacheKey other = (ChunkCacheKey) obj;
+ if (chunkId != other.chunkId)
return false;
- }
- if (indexName != null ? !indexName.equals(that.indexName) : that.indexName != null) {
+ if (fileName == null) {
+ if (other.fileName != null)
+ return false;
+ } else if (!fileName.equals(other.fileName))
return false;
- }
-
- if (chunkId != null ? !chunkId.equals(that.chunkId) : that.chunkId != null) {
+ if (indexName == null) {
+ if (other.indexName != null)
+ return false;
+ } else if (!indexName.equals(other.indexName))
return false;
- }
-
return true;
}
@Override
- public int hashCode() {
- if (hashCode == 0) {
- hashCode = super.hashCode();
- hashCode = 31 * hashCode + (chunkId != null ? chunkId.hashCode() : 0);
- }
- return hashCode;
- }
-
- @Override
public String toString() {
- return "ChunkCacheKey{" + "chunkId=" + chunkId + "} " + super.toString();
+ return "ChunkCacheKey{chunkId=" + chunkId + ", fileName=" + fileName + ", indexName=" + indexName + "} ";
}
+
}
Modified: trunk/lucene-directory/src/main/java/org/infinispan/lucene/FileCacheKey.java
===================================================================
--- trunk/lucene-directory/src/main/java/org/infinispan/lucene/FileCacheKey.java 2009-10-20 19:00:04 UTC (rev 980)
+++ trunk/lucene-directory/src/main/java/org/infinispan/lucene/FileCacheKey.java 2009-10-20 21:29:54 UTC (rev 981)
@@ -26,61 +26,99 @@
/**
* Used as a key for file headers in a cache
*
+ * @since 4.0
* @author Lukasz Moren
+ * @author Sanne Grinovero
*/
-public class FileCacheKey extends CacheKey implements Serializable {
+final class FileCacheKey implements Serializable, CacheKey {
- protected final boolean isLockKey;
+ /** The serialVersionUID */
+ private static final long serialVersionUID = -228474937509042691L;
+
+ private final boolean isLockKey;
+ private final String indexName;
+ private final String fileName;
+ private final int hashCode;
public FileCacheKey(String indexName, String fileName) {
this(indexName, fileName, false);
}
public FileCacheKey(String indexName, String fileName, boolean isLockKey) {
- super(indexName, fileName);
+ this.indexName = indexName;
+ this.fileName = fileName;
this.isLockKey = isLockKey;
+ this.hashCode = generatedHashCode();
}
+
+ /**
+ * Get the isLockKey.
+ *
+ * @return the isLockKey.
+ */
+ public boolean isLockKey() {
+ return isLockKey;
+ }
+ /**
+ * Get the indexName.
+ *
+ * @return the indexName.
+ */
+ public String getIndexName() {
+ return indexName;
+ }
+
+ /**
+ * Get the fileName.
+ *
+ * @return the fileName.
+ */
+ public String getFileName() {
+ return fileName;
+ }
+
@Override
- public boolean equals(Object o) {
- if (this == o) {
+ public int hashCode() {
+ return hashCode;
+ }
+
+ private int generatedHashCode() {
+ final int prime = 31;
+ int result = 1;
+ result = prime * result + ((fileName == null) ? 0 : fileName.hashCode());
+ result = prime * result + ((indexName == null) ? 0 : indexName.hashCode());
+ result = prime * result + (isLockKey ? 1231 : 1237);
+ return result;
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj)
return true;
- }
- if (o == null || getClass() != o.getClass()) {
+ if (obj == null)
return false;
- }
- if (!super.equals(o)) {
+ if (FileCacheKey.class != obj.getClass())
return false;
- }
-
- FileCacheKey that = (FileCacheKey) o;
-
- if (fileName != null ? !fileName.equals(that.fileName) : that.fileName != null) {
+ FileCacheKey other = (FileCacheKey) obj;
+ if (fileName == null) {
+ if (other.fileName != null)
+ return false;
+ } else if (!fileName.equals(other.fileName))
return false;
- }
- if (indexName != null ? !indexName.equals(that.indexName) : that.indexName != null) {
+ if (indexName == null) {
+ if (other.indexName != null)
+ return false;
+ } else if (!indexName.equals(other.indexName))
return false;
- }
-
- if (isLockKey != that.isLockKey) {
+ if (isLockKey != other.isLockKey)
return false;
- }
-
return true;
}
-
+
@Override
- public int hashCode() {
- if (hashCode == 0) {
- hashCode = super.hashCode();
- hashCode = 31 * hashCode + (isLockKey ? 1 : 0);
- }
- return hashCode;
+ public String toString() {
+ return "FileCacheKey{fileName='" + fileName + "', indexName='" + indexName + "', isLockKey=" + isLockKey + '}';
}
- @Override
- public String toString() {
- return "CacheKey{" + "fileName='" + getFileName() + '\'' + "indexName='" + getIndexName() + '\'' + "isLockKey='"
- + isLockKey + '\'' + '}';
- }
}
Modified: trunk/lucene-directory/src/main/java/org/infinispan/lucene/FileListCacheKey.java
===================================================================
--- trunk/lucene-directory/src/main/java/org/infinispan/lucene/FileListCacheKey.java 2009-10-20 19:00:04 UTC (rev 980)
+++ trunk/lucene-directory/src/main/java/org/infinispan/lucene/FileListCacheKey.java 2009-10-20 21:29:54 UTC (rev 981)
@@ -21,15 +21,69 @@
*/
package org.infinispan.lucene;
+import java.io.Serializable;
+
/**
* Cache key for a list with current files in cache
*
+ * @since 4.0
* @author Lukasz Moren
+ * @author Sanne Grinovero
*/
-public class FileListCacheKey extends CacheKey {
+final class FileListCacheKey implements Serializable, CacheKey {
+ /** The serialVersionUID */
+ private static final long serialVersionUID = 8965108175527988255L;
+
+ private final String indexName;
+ private final int hashCode;
+
public FileListCacheKey(String indexName) {
- super(indexName, "");
+ this.indexName = indexName;
+ this.hashCode = generatedHashCode();
}
+ /**
+ * Get the indexName.
+ *
+ * @return the indexName.
+ */
+ public String getIndexName() {
+ return indexName;
+ }
+
+ @Override
+ public int hashCode() {
+ return hashCode;
+ }
+
+ private int generatedHashCode() {
+ final int prime = 31;
+ int result = 1;
+ result = prime * result + ((indexName == null) ? 0 : indexName.hashCode());
+ return result;
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj)
+ return true;
+ if (obj == null)
+ return false;
+ if (FileListCacheKey.class != obj.getClass())
+ return false;
+ FileListCacheKey other = (FileListCacheKey) obj;
+ if (indexName == null) {
+ if (other.indexName != null)
+ return false;
+ } else if (!indexName.equals(other.indexName))
+ return false;
+ return true;
+ }
+
+ @Override
+ public String toString() {
+ return "FileListCacheKey{indexName='" + indexName + '}';
+ }
+
}
Modified: trunk/lucene-directory/src/main/java/org/infinispan/lucene/FileMetadata.java
===================================================================
--- trunk/lucene-directory/src/main/java/org/infinispan/lucene/FileMetadata.java 2009-10-20 19:00:04 UTC (rev 980)
+++ trunk/lucene-directory/src/main/java/org/infinispan/lucene/FileMetadata.java 2009-10-20 21:29:54 UTC (rev 981)
@@ -25,13 +25,17 @@
/**
* Header for Lucene files. Store only basic info about file. File data is divided into byte[]
- * chunks and stored under {@link org.hibernate.search.store.infinispan.ChunkCacheKey}
+ * chunks and stored under {@link org.infinispan.lucene.ChunkCacheKey}
*
+ * @since 4.0
* @author Lukasz Moren
- * @see org.hibernate.search.store.infinispan.FileCacheKey
+ * @see org.infinispan.lucene.FileCacheKey
*/
public class FileMetadata implements Serializable {
+ /** The serialVersionUID */
+ private static final long serialVersionUID = -2605615719808221213L;
+
private long lastModified;
private long size = 0;
@@ -39,7 +43,7 @@
touch();
}
- private void touch() {
+ public void touch() {
setLastModified(System.currentTimeMillis());
}
@@ -67,11 +71,8 @@
if (o == null || getClass() != o.getClass()) {
return false;
}
-
FileMetadata metadata = (FileMetadata) o;
-
return lastModified == metadata.lastModified && size == metadata.size;
-
}
@Override
Modified: trunk/lucene-directory/src/main/java/org/infinispan/lucene/InfinispanCacheEntryListener.java
===================================================================
--- trunk/lucene-directory/src/main/java/org/infinispan/lucene/InfinispanCacheEntryListener.java 2009-10-20 19:00:04 UTC (rev 980)
+++ trunk/lucene-directory/src/main/java/org/infinispan/lucene/InfinispanCacheEntryListener.java 2009-10-20 21:29:54 UTC (rev 981)
@@ -33,6 +33,7 @@
/**
* Infinispan cache listener
*
+ * @since 4.0
* @author Lukasz Moren
*/
@Listener
@@ -58,7 +59,7 @@
if (ob instanceof FileCacheKey && event.isOriginLocal()) {
FileCacheKey key = (FileCacheKey) ob;
- if (key.getIndexName().equals(indexName) && !key.isLockKey) {
+ if (key.getIndexName().equals(indexName) && !key.isLockKey()) {
FileListCacheKey fileListKey = new FileListCacheKey(key.getIndexName());
Cache<CacheKey, Object> cache = event.getCache();
Map<String, String> fileList = (Map<String, String>) cache.get(fileListKey);
Modified: trunk/lucene-directory/src/main/java/org/infinispan/lucene/InfinispanDirectory.java
===================================================================
--- trunk/lucene-directory/src/main/java/org/infinispan/lucene/InfinispanDirectory.java 2009-10-20 19:00:04 UTC (rev 980)
+++ trunk/lucene-directory/src/main/java/org/infinispan/lucene/InfinispanDirectory.java 2009-10-20 21:29:54 UTC (rev 981)
@@ -37,14 +37,15 @@
import org.infinispan.util.logging.LogFactory;
/**
- * Implementation that uses Infinispan to store Lucene indices
- * <p/>
+ * Implementation that uses Infinispan to store Lucene indices.
+ *
* Directory locking is assured with
- * {@link org.hibernate.search.store.infinispan.InfinispanLockFactory.InfinispanLock}
+ * {@link org.infinispan.lucene.InfinispanLockFactory.InfinispanLock}
*
+ * @since 4.0
* @author Lukasz Moren
* @author Sanne Grinovero
- * @see org.hibernate.search.store.infinispan.InfinispanLockFactory
+ * @see org.infinispan.lucene.InfinispanLockFactory
*/
// todo add support for ConcurrentMergeSheduler
public class InfinispanDirectory extends Directory {
@@ -132,7 +133,7 @@
if (file == null) {
throw new FileNotFoundException(name);
}
- file.setLastModified(System.currentTimeMillis());
+ file.touch();
}
/**
@@ -140,7 +141,7 @@
*/
public void deleteFile(String name) throws IOException {
checkIsOpen();
- CacheKey key = new FileCacheKey(indexName, name);
+ FileCacheKey key = new FileCacheKey(indexName, name);
// remove main file
cache.remove(key);
// and all of its chunks
@@ -152,7 +153,7 @@
chunkKey = new ChunkCacheKey(indexName, name, ++i);
} while (removed != null);
if (log.isDebugEnabled()) {
- log.debug("Removed file: {} from index: {}", new Object[] { key.getFileName(), indexName });
+ log.debug("Removed file: {0} from index: {1}", key.getFileName(), indexName);
}
}
@@ -178,7 +179,7 @@
cache.put(chunkKey, ob);
} while (true);
if (log.isTraceEnabled()) {
- log.trace("Renamed file from: {} to: {} in index {}", new Object[] { from, to, indexName });
+ log.trace("Renamed file from: {0} to: {1} in index {2}",from, to, indexName);
}
}
@@ -198,7 +199,7 @@
* {@inheritDoc}
*/
public synchronized IndexOutput createOutput(String name) throws IOException {
- final CacheKey key = new FileCacheKey(indexName, name);
+ final FileCacheKey key = new FileCacheKey(indexName, name);
if (!fileExists(name)) {
cache.put(key, new FileMetadata());
}
Modified: trunk/lucene-directory/src/main/java/org/infinispan/lucene/InfinispanIndexIO.java
===================================================================
--- trunk/lucene-directory/src/main/java/org/infinispan/lucene/InfinispanIndexIO.java 2009-10-20 19:00:04 UTC (rev 980)
+++ trunk/lucene-directory/src/main/java/org/infinispan/lucene/InfinispanIndexIO.java 2009-10-20 21:29:54 UTC (rev 981)
@@ -34,6 +34,7 @@
/**
* Deal with input-output operations on Infinispan based Directory
*
+ * @since 4.0
* @author Lukasz Moren
* @see org.apache.lucene.store.Directory
* @see org.apache.lucene.store.IndexInput
@@ -45,7 +46,7 @@
// each Lucene index is splitted into parts with default size defined here
public final static int DEFAULT_BUFFER_SIZE = 16 * 1024;
- private static byte[] getChunkFromPosition(Map<CacheKey, Object> cache, CacheKey fileKey, int pos, int bufferSize) {
+ private static byte[] getChunkFromPosition(Map<CacheKey, Object> cache, FileCacheKey fileKey, int pos, int bufferSize) {
CacheKey key = new ChunkCacheKey(fileKey.getIndexName(), fileKey.getFileName(), getChunkNumberFromPosition(pos,
bufferSize));
return (byte[]) cache.get(key);
@@ -71,16 +72,16 @@
private Cache<CacheKey, Object> cache;
private ConcurrentHashMap<CacheKey, Object> localCache = new ConcurrentHashMap<CacheKey, Object>();
private FileMetadata file;
- private CacheKey fileKey;
+ private FileCacheKey fileKey;
private byte[] buffer;
private int bufferPosition = 0;
private int filePosition = 0;
- public InfinispanIndexInput(Cache<CacheKey, Object> cache, CacheKey fileKey) throws IOException {
+ public InfinispanIndexInput(Cache<CacheKey, Object> cache, FileCacheKey fileKey) throws IOException {
this(cache, fileKey, InfinispanIndexIO.DEFAULT_BUFFER_SIZE);
}
- public InfinispanIndexInput(Cache<CacheKey, Object> cache, CacheKey fileKey, int bufferSize) throws IOException {
+ public InfinispanIndexInput(Cache<CacheKey, Object> cache, FileCacheKey fileKey, int bufferSize) throws IOException {
this.cache = cache;
this.fileKey = fileKey;
this.bufferSize = bufferSize;
@@ -104,11 +105,11 @@
}
if (log.isDebugEnabled()) {
- log.debug("Opened new IndexInput for file:{} in index: {}", fileKey.getFileName(), fileKey.getIndexName());
+ log.debug("Opened new IndexInput for file:{0} in index: {1}", fileKey.getFileName(), fileKey.getIndexName());
}
}
- private byte[] getChunkFromPosition(Cache<CacheKey, Object> cache, CacheKey fileKey, int pos, int bufferSize) {
+ private byte[] getChunkFromPosition(Cache<CacheKey, Object> cache, FileCacheKey fileKey, int pos, int bufferSize) {
Object object = InfinispanIndexIO.getChunkFromPosition(cache, fileKey, pos, bufferSize);
if (object == null) {
object = InfinispanIndexIO.getChunkFromPosition(localCache, fileKey, pos, bufferSize);
@@ -175,7 +176,7 @@
buffer = null;
localCache = null;
if (log.isDebugEnabled()) {
- log.debug("Closed IndexInput for file:{} in index: {}", fileKey.getFileName(), fileKey.getIndexName());
+ log.debug("Closed IndexInput for file:{0} in index: {1}", fileKey.getFileName(), fileKey.getIndexName());
}
}
@@ -203,18 +204,18 @@
private Cache<CacheKey, Object> cache;
private FileMetadata file;
- private CacheKey fileKey;
+ private FileCacheKey fileKey;
private byte[] buffer;
private int bufferPosition = 0;
private int filePosition = 0;
private int chunkNumber;
- public InfinispanIndexOutput(Cache<CacheKey, Object> cache, CacheKey fileKey) throws IOException {
+ public InfinispanIndexOutput(Cache<CacheKey, Object> cache, FileCacheKey fileKey) throws IOException {
this(cache, fileKey, InfinispanIndexIO.DEFAULT_BUFFER_SIZE);
}
- public InfinispanIndexOutput(Cache<CacheKey, Object> cache, CacheKey fileKey, int bufferSize) throws IOException {
+ public InfinispanIndexOutput(Cache<CacheKey, Object> cache, FileCacheKey fileKey, int bufferSize) throws IOException {
this.cache = cache;
this.fileKey = fileKey;
this.bufferSize = bufferSize;
@@ -223,7 +224,7 @@
this.file = (FileMetadata) cache.get(fileKey);
if (log.isDebugEnabled()) {
- log.debug("Opened new IndexOutput for file:{} in index: {}", fileKey.getFileName(), fileKey.getIndexName());
+ log.debug("Opened new IndexOutput for file:{0} in index: {1}", fileKey.getFileName(), fileKey.getIndexName());
}
}
@@ -283,7 +284,7 @@
filePosition = 0;
buffer = null;
if (log.isDebugEnabled()) {
- log.debug("Closed IndexOutput for file:{} in index: {}", fileKey.getFileName(), fileKey.getIndexName());
+ log.debug("Closed IndexOutput for file:{0} in index: {1}", fileKey.getFileName(), fileKey.getIndexName());
}
}
@@ -308,7 +309,7 @@
}
protected void setFileLength() {
- file.setLastModified(System.currentTimeMillis());
+ file.touch();
if (file.getSize() < filePosition) {
file.setSize(filePosition);
}
Modified: trunk/lucene-directory/src/main/java/org/infinispan/lucene/InfinispanLockFactory.java
===================================================================
--- trunk/lucene-directory/src/main/java/org/infinispan/lucene/InfinispanLockFactory.java 2009-10-20 19:00:04 UTC (rev 980)
+++ trunk/lucene-directory/src/main/java/org/infinispan/lucene/InfinispanLockFactory.java 2009-10-20 21:29:54 UTC (rev 981)
@@ -36,9 +36,10 @@
/**
* Factory for locks obtained in <code>InfinispanDirectory</code>
*
+ * @since 4.0
* @author Lukasz Moren
- * @see org.hibernate.search.store.infinispan.InfinispanDirectory
- * @see org.hibernate.search.store.infinispan.InfinispanLockFactory.InfinispanLock
+ * @see org.infinispan.lucene.InfinispanDirectory
+ * @see org.infinispan.lucene.InfinispanLockFactory.InfinispanLock
*/
public class InfinispanLockFactory extends LockFactory {
@@ -60,7 +61,7 @@
return new InfinispanLock(cache, indexName, lockName);
} finally {
if (log.isTraceEnabled()) {
- log.trace("Created new lock: {} for index {}", lockName, indexName);
+ log.trace("Created new lock: {0} for index {1}", lockName, indexName);
}
}
}
@@ -73,7 +74,7 @@
cache.remove(new FileCacheKey(indexName, lockName, true));
} finally {
if (log.isTraceEnabled()) {
- log.trace("Removed lock: {} for index {}", lockName, indexName);
+ log.trace("Removed lock: {0} for index {1}", lockName, indexName);
}
}
}
@@ -129,7 +130,7 @@
if (acquired) {
tm.commit();
if (log.isTraceEnabled()) {
- log.trace("Lock: {} acquired for index: {} ", new Object[] { lockName, indexName });
+ log.trace("Lock: {0} acquired for index: {1} ", lockName, indexName);
}
} else {
tm.rollback();
@@ -148,7 +149,7 @@
// begin new transaction to batch all changes, tx commited when lock is released.
tm.begin();
if (log.isTraceEnabled()) {
- log.trace("Batch transaction started for index: {}", indexName);
+ log.trace("Batch transaction started for index: {0}", indexName);
}
} catch (Exception e) {
log.error("Unable to start transaction", e);
@@ -169,7 +170,7 @@
// commit changes in batch, transaction was started when lock was acquired
tm.commit();
if (log.isTraceEnabled()) {
- log.trace("Batch transaction commited for index: {}", indexName);
+ log.trace("Batch transaction commited for index: {0}", indexName);
}
tm.begin();
@@ -181,7 +182,7 @@
if (removed) {
tm.commit();
if (log.isTraceEnabled()) {
- log.trace("Lock: {} removed for index: {} ", new Object[] { lockName, indexName });
+ log.trace("Lock: {0} removed for index: {1} ", lockName, indexName);
}
} else {
tm.rollback();
More information about the infinispan-commits
mailing list