de.schlichtherle.truezip.fs
Class FsConcurrentController
java.lang.Object
de.schlichtherle.truezip.fs.FsController<M>
de.schlichtherle.truezip.fs.FsDecoratingController<FsConcurrentModel,FsController<? extends FsConcurrentModel>>
de.schlichtherle.truezip.fs.FsConcurrentController
@ThreadSafe
public final class FsConcurrentController
- extends FsDecoratingController<FsConcurrentModel,FsController<? extends FsConcurrentModel>>
Supports multiple concurrent reader threads.
- Author:
- Christian Schlichtherle
- See Also:
FsConcurrentModel
|
Method Summary |
private void |
assertNotReadLockedByCurrentThread(FsNotWriteLockedException ex)
|
Icon |
getClosedIcon()
|
FsEntry |
getEntry(FsEntryName name)
|
InputSocket<?> |
getInputSocket(FsEntryName name,
BitField<FsInputOption> options)
Returns an input socket for reading the contents of the entry addressed
by the given name from the file system. |
Icon |
getOpenIcon()
|
OutputSocket<?> |
getOutputSocket(FsEntryName name,
BitField<FsOutputOption> options,
Entry template)
Returns an output socket for writing the contents of the entry addressed
by the given name to the file system. |
boolean |
isReadable(FsEntryName name)
|
boolean |
isReadOnly()
|
boolean |
isWritable(FsEntryName name)
|
void |
mknod(FsEntryName name,
Entry.Type type,
BitField<FsOutputOption> options,
Entry template)
Creates or replaces and finally links a chain of one or more entries
for the given entry name into the file system. |
private ReentrantReadWriteLock.ReadLock |
readLock()
|
void |
setReadOnly(FsEntryName name)
|
boolean |
setTime(FsEntryName name,
BitField<Entry.Access> types,
long value)
|
|
sync(BitField<FsSyncOption> options,
ExceptionHandler<? super FsSyncException,X> handler)
Commits all unsynchronized changes to the contents of this file system
to its parent file system. |
void |
unlink(FsEntryName name)
|
private ReentrantReadWriteLock.WriteLock |
writeLock()
|
readLock
private volatile ReentrantReadWriteLock.ReadLock readLock
writeLock
private volatile ReentrantReadWriteLock.WriteLock writeLock
FsConcurrentController
public FsConcurrentController(@NonNull
FsController<? extends FsConcurrentModel> controller)
- Constructs a new concurrent file system controller.
- Parameters:
controller - the decorated file system controller.
readLock
private ReentrantReadWriteLock.ReadLock readLock()
writeLock
private ReentrantReadWriteLock.WriteLock writeLock()
assertNotReadLockedByCurrentThread
private void assertNotReadLockedByCurrentThread(FsNotWriteLockedException ex)
throws FsNotWriteLockedException
- Throws:
FsNotWriteLockedException
getOpenIcon
public Icon getOpenIcon()
throws IOException
- Overrides:
getOpenIcon in class FsDecoratingController<FsConcurrentModel,FsController<? extends FsConcurrentModel>>
- Throws:
IOException
getClosedIcon
public Icon getClosedIcon()
throws IOException
- Overrides:
getClosedIcon in class FsDecoratingController<FsConcurrentModel,FsController<? extends FsConcurrentModel>>
- Throws:
IOException
isReadOnly
public boolean isReadOnly()
throws IOException
- Overrides:
isReadOnly in class FsDecoratingController<FsConcurrentModel,FsController<? extends FsConcurrentModel>>
- Throws:
IOException
getEntry
public FsEntry getEntry(FsEntryName name)
throws IOException
- Overrides:
getEntry in class FsDecoratingController<FsConcurrentModel,FsController<? extends FsConcurrentModel>>
- Throws:
IOException
isReadable
public boolean isReadable(FsEntryName name)
throws IOException
- Overrides:
isReadable in class FsDecoratingController<FsConcurrentModel,FsController<? extends FsConcurrentModel>>
- Throws:
IOException
isWritable
public boolean isWritable(FsEntryName name)
throws IOException
- Overrides:
isWritable in class FsDecoratingController<FsConcurrentModel,FsController<? extends FsConcurrentModel>>
- Throws:
IOException
setReadOnly
public void setReadOnly(FsEntryName name)
throws IOException
- Overrides:
setReadOnly in class FsDecoratingController<FsConcurrentModel,FsController<? extends FsConcurrentModel>>
- Throws:
IOException
setTime
public boolean setTime(FsEntryName name,
BitField<Entry.Access> types,
long value)
throws IOException
- Overrides:
setTime in class FsDecoratingController<FsConcurrentModel,FsController<? extends FsConcurrentModel>>
- Throws:
IOException
getInputSocket
public InputSocket<?> getInputSocket(FsEntryName name,
BitField<FsInputOption> options)
- Description copied from class:
FsController
- Returns an input socket for reading the contents of the entry addressed
by the given name from the file system.
- Overrides:
getInputSocket in class FsDecoratingController<FsConcurrentModel,FsController<? extends FsConcurrentModel>>
- Parameters:
name - a file system entry name.
- Returns:
- An
InputSocket.
getOutputSocket
public OutputSocket<?> getOutputSocket(FsEntryName name,
BitField<FsOutputOption> options,
Entry template)
- Description copied from class:
FsController
- Returns an output socket for writing the contents of the entry addressed
by the given name to the file system.
If
template is not null, then the output entry shall
have as many of its properties copied as reasonable, e.g. the last
modification time.
- Overrides:
getOutputSocket in class FsDecoratingController<FsConcurrentModel,FsController<? extends FsConcurrentModel>>
- Parameters:
name - a file system entry name.template - a nullable template for the properties of the output
entry.
- Returns:
- An
OutputSocket.
mknod
public void mknod(@NonNull
FsEntryName name,
@NonNull
Entry.Type type,
@NonNull
BitField<FsOutputOption> options,
@CheckForNull
Entry template)
throws IOException
- Description copied from class:
FsController
- Creates or replaces and finally links a chain of one or more entries
for the given entry
name into the file system.
- Overrides:
mknod in class FsDecoratingController<FsConcurrentModel,FsController<? extends FsConcurrentModel>>
- Parameters:
name - the file system entry name.type - the file system entry type.options - the file system output options.
If CREATE_PARENTS is set, any missing parent directories
will be created and linked into this file system with its last
modification time set to the system's current time.template - if not null, then the file system entry
at the end of the chain shall inherit as much properties from
this entry as possible - with the exception of its name and type.
- Throws:
IOException - for some other I/O related reason, including but
not exclusively upon one or more of the following conditions:
- The file system is read only.
name contains characters which are not
supported by the file system.
- The entry already exists and either the option
FsOutputOption.EXCLUSIVE is set or the entry is a
directory.
- The entry exists as a different type.
- A parent entry exists but is not a directory.
- A parent entry is missing and
createParents is
false.
unlink
public void unlink(FsEntryName name)
throws IOException
- Overrides:
unlink in class FsDecoratingController<FsConcurrentModel,FsController<? extends FsConcurrentModel>>
- Throws:
IOException
sync
public <X extends IOException> void sync(@NonNull
BitField<FsSyncOption> options,
@NonNull
ExceptionHandler<? super FsSyncException,X> handler)
throws X extends IOException
- Description copied from class:
FsController
- Commits all unsynchronized changes to the contents of this file system
to its parent file system.
If this is not a federated file system, i.e. if its not a member of a
parent file system, then nothing happens.
Otherwise, the state of this file system controller is reset.
- Overrides:
sync in class FsDecoratingController<FsConcurrentModel,FsController<? extends FsConcurrentModel>>
- Type Parameters:
X - the type of the IOException to throw at the
discretion of the exception handler.- Parameters:
options - the synchronization options.handler - the exception handling strategy for dealing with one or
more input FsSyncExceptions which may trigger an X.
- Throws:
X extends IOException
Copyright © 2005-2011 Schlichtherle IT Services. All Rights Reserved.