Package org.gephi.graph.api
Interface GraphLock
-
public interface GraphLock
Wrapper aroundReentrantReadWriteLock
that controls multi-thread access to the graph structure.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description int
getReadHoldCount()
Queries the number of reentrant read holds on this lock by the current thread.int
getWriteHoldCount()
Queries the number of reentrant write holds on this lock by the current thread.void
readLock()
Acquires the read lock.void
readUnlock()
Attempts to release this lock.void
readUnlockAll()
Release this lock by releasing all current read locks.void
writeLock()
Acquires the write lock.void
writeUnlock()
Attempts to release this lock.
-
-
-
Method Detail
-
readLock
void readLock()
Acquires the read lock. Acquires the read lock if the write lock is not held by another thread and returns immediately.
-
readUnlock
void readUnlock()
Attempts to release this lock. If the number of readers is now zero then the lock is made available for write lock attempts. If the current thread does not hold this lock then IllegalMonitorStateException is thrown.- Throws:
IllegalMonitorStateException
- if the current thread does not hold this lock
-
readUnlockAll
void readUnlockAll()
Release this lock by releasing all current read locks.
-
writeLock
void writeLock()
Acquires the write lock. Acquires the write lock if neither the read nor write lock are held by another thread and returns immediately, setting the write lock hold count to one.- Throws:
IllegalMonitorStateException
- if the current thread holds a read lock already
-
writeUnlock
void writeUnlock()
Attempts to release this lock. If the current thread is the holder of this lock then the hold count is decremented. If the hold count is now zero then the lock is released. If the current thread is not the holder of this lock then IllegalMonitorStateException is thrown.throws @IllegalMonitorStateException if the current thread does not hold this lock
-
getReadHoldCount
int getReadHoldCount()
Queries the number of reentrant read holds on this lock by the current thread. A reader thread has a hold on a lock for each lock action that is not matched by an unlock action.- Returns:
- the number of holds on the read lock by the current thread, or zero if the read lock is not held by the current thread
-
getWriteHoldCount
int getWriteHoldCount()
Queries the number of reentrant write holds on this lock by the current thread. A writer thread has a hold on a lock for each lock action that is not matched by an unlock action.- Returns:
- the number of holds on the write lock by the current thread, or zero if the write lock is not held by the current thread
-
-