We now check to see it org.apache.activeio.journal.active.DisableLocking system property is set to true, if so we don't attempt to do any file locking.

Used to help work around Hibernate ClassCastException.

git-svn-id: https://svn.apache.org/repos/asf/incubator/activemq/trunk@394992 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Hiram R. Chirino 2006-04-18 18:03:27 +00:00
parent b708fd32c3
commit 3ecdb62bf5
1 changed files with 7 additions and 0 deletions

View File

@ -43,7 +43,9 @@ final public class ControlFile {
private final RandomAccessFile file; private final RandomAccessFile file;
private final FileChannel channel; private final FileChannel channel;
private final ByteBufferPacket controlData; private final ByteBufferPacket controlData;
private final static boolean brokenFileLock = "true".equals(System.getProperty("java.nio.channels.FileLock.broken", "false")); private final static boolean brokenFileLock = "true".equals(System.getProperty("java.nio.channels.FileLock.broken", "false"));
private final static boolean disableLocking = "true".equals(System.getProperty("org.apache.activeio.journal.active.DisableLocking", "false"));
private long controlDataVersion=0; private long controlDataVersion=0;
private FileLock lock; private FileLock lock;
@ -65,6 +67,8 @@ final public class ControlFile {
* @throws IOException * @throws IOException
*/ */
public void lock() throws IOException { public void lock() throws IOException {
if( disableLocking )
return;
Set set = getVmLockSet(); Set set = getVmLockSet();
synchronized (set) { synchronized (set) {
if (lock == null) { if (lock == null) {
@ -89,6 +93,9 @@ final public class ControlFile {
* @throws IOException * @throws IOException
*/ */
public void unlock() throws IOException { public void unlock() throws IOException {
if( disableLocking )
return;
Set set = getVmLockSet(); Set set = getVmLockSet();
synchronized (set) { synchronized (set) {
if (lock != null) { if (lock != null) {