Interface Protectable
- All Known Implementing Classes:
AsyncHandler, ConsoleHandler, ExtHandler, FileHandler, LogContext, NullHandler, OutputStreamHandler, PeriodicRotatingFileHandler, PeriodicSizeRotatingFileHandler, QueueHandler, SizeRotatingFileHandler, SyslogHandler, WriterHandler
public interface Protectable
Allows objects to be locked for modification.
When an object is
protected, modifications to the object are not allowed. To allow
modifications for the object, the enableAccess(Object) or the unprotect(Object) methods must be
invoked.
To protect the object after enabling access, invoke the disableAccess()
access.
Note that enabling or disabling access only applies to the
current thread.-
Method Summary
Modifier and TypeMethodDescriptionvoidDisable previous access to the object for modifications on the current thread.voidenableAccess(Object protectKey) Enable access to the object for modifications on the current thread.voidProtect this object from modifications.voidAllows the object to be modified if theprotectionKeymatches the key used toprotectthe object.
-
Method Details
-
protect
Protect this object from modifications.- Parameters:
protectionKey- the key used to protect the object.- Throws:
SecurityException- if the object is already protected.
-
unprotect
Allows the object to be modified if theprotectionKeymatches the key used toprotectthe object.- Parameters:
protectionKey- the key used to protect the object.- Throws:
SecurityException- if the object is protected and the key doesn't match.
-
enableAccess
-
disableAccess
void disableAccess()Disable previous access to the object for modifications on the current thread.
-