com.atlassian.confluence.importexport
Class ImportMutex

java.lang.Object
  extended by com.atlassian.confluence.importexport.ImportMutex

public class ImportMutex
extends Object

A very simple locking mutex that is designed to prevent two import tasks from running at the same time.

Since:
5.6

Field Summary
static ImportMutex INSTANCE
           
 
Method Summary
 boolean isLocked()
          Queries the current state of the mutex
 void lockMutex(Object client)
          Obtain the lock on the mutex.
 void unlockMutex(Object client)
          Releases the lock
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

INSTANCE

public static final ImportMutex INSTANCE
Method Detail

lockMutex

public void lockMutex(Object client)
Obtain the lock on the mutex.

Parameters:
client - The object that wants to "own" the mutex. Typically is the calling object.
Throws:
IllegalStateException - if the mutex is currently held by the same or another object.

unlockMutex

public void unlockMutex(Object client)
Releases the lock

Parameters:
client - the object that currently "owns" the mutex. Must be the same object that was previously passed to lockMutex(Object)
Throws:
IllegalStateException - if the mutex is not currently held by the given object.

isLocked

public boolean isLocked()
Queries the current state of the mutex

Returns:
true if the mutex is currently held, false otherwise.


Copyright © 2003–2015 Atlassian. All rights reserved.