|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
public interface SyncContext
A synchronization context used to coordinate concurrent access to artifacts or metadatas. The typical usage of a synchronization context looks like this:
SyncContext syncContext = repositorySystem.newSyncContext( ... );
syncContext.acquire( artifacts, metadatas );
try {
// work with the artifacts and metadatas
} finally {
syncContext.release();
}
Within one thread, synchronization contexts may be nested which can naturally happen in a hierarchy of method calls.
The nested synchronization contexts may also acquire overlapping sets of artifacts/metadatas as long as the following
conditions are met. If the outer-most context holding a particular resource is exclusive, that resource can be
reacquired in any nested context. If however the outer-most context is shared, the resource may only be reacquired by
nested contexts if these are also shared.
A synchronization context is meant to be utilized by only one thread and as such is not thread-safe.
Note that the level of actual synchronization is subject to the implementation and might range from OS-wide to none.
| Method Summary | |
|---|---|
void |
acquire(Collection<? extends Artifact> artifacts,
Collection<? extends Metadata> metadatas)
Acquires synchronized access to the specified artifacts and metadatas. |
void |
release()
Releases all previously acquired artifacts/metadatas. |
| Method Detail |
|---|
void acquire(Collection<? extends Artifact> artifacts,
Collection<? extends Metadata> metadatas)
artifacts - The artifacts to acquire, may be null or empty if none.metadatas - The metadatas to acquire, may be null or empty if none.void release()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||