Class SystemStateResource
- java.lang.Object
-
- com.zfabrik.resources.provider.Resource
-
- com.zfabrik.impl.components.states.SystemStateResource
-
- All Implemented Interfaces:
com.zfabrik.components.IDependencyComponent,com.zfabrik.states.ISystemState,java.lang.Runnable
public class SystemStateResource extends com.zfabrik.resources.provider.Resource implements com.zfabrik.components.IDependencyComponent, java.lang.Runnable, com.zfabrik.states.ISystemStateSeeISystemState.- Author:
- hb
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interfaceSystemStateResource.SystemStateMBeanJMX supportclassSystemStateResource.SystemStateMBeanImpl
-
Constructor Summary
Constructors Constructor Description SystemStateResource(java.lang.String name)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description <T> Tas(java.lang.Class<T> clz)Retrieve a typed representation of the resource.voidinvalidate()This method gets called whenever a dependency resource has been invalidated or this resource needs to be invalidated.voidprepare()Prepare for use.voidrun()
-
-
-
Method Detail
-
as
public <T> T as(java.lang.Class<T> clz)
Description copied from class:com.zfabrik.resources.provider.ResourceRetrieve a typed representation of the resource.- Overrides:
asin classcom.zfabrik.resources.provider.Resource- Parameters:
clz- expected return type- Returns:
- the expected return type instance represented by the resource or
nullif the type facade is not supported.
-
run
public void run()
- Specified by:
runin interfacejava.lang.Runnable
-
prepare
public void prepare()
Description copied from interface:com.zfabrik.components.IDependencyComponentPrepare for use.- Specified by:
preparein interfacecom.zfabrik.components.IDependencyComponent
-
invalidate
public void invalidate() throws com.zfabrik.resources.ResourceBusyExceptionDescription copied from class:com.zfabrik.resources.provider.ResourceThis method gets called whenever a dependency resource has been invalidated or this resource needs to be invalidated.This code should be executed in a life cycle code block of this resource instance, i.e. where dependencies are effectively managed, so that race conditions can be avoided.
State changing methods of a resource should always be synchronized (e.g. on this). This is in particular true for cross-resource dependencies. In order to assure consistency under race conditions, a dependent resource should first declare its dependency and then retrieve the resource implementation. In case of failures, resources should clean up by calling
handle().invalidate(true);- Overrides:
invalidatein classcom.zfabrik.resources.provider.Resource- Throws:
com.zfabrik.resources.ResourceBusyException
-
-