@ Override public void execute ( OperationContext context , ModelNode operation ) throws OperationFailedException { final PathAddress address = PathAddress . pathAddress ( operation . require ( OP_ADDR ) ) ; ListIterator < PathElement > iterator = address . iterator ( ) ; PathElement element = iterator . next ( ) ; while ( ! element . getValue ( ) . equals ( InfinispanSubsystem . SUBSYSTEM_NAME ) ) { element = iterator . next ( ) ; } final String cacheContainerName = iterator . next ( ) . getValue ( ) ; final String cacheName = iterator . next ( ) . getValue ( ) ; if ( context . isNormalServer ( ) ) { final ServiceController < ? > controller = context . getServiceRegistry ( false ) . getService ( CacheServiceName . CACHE . getServiceName ( cacheContainerName , cacheName ) ) ; Cache < ? , ? > cache = ( Cache < ? , ? > ) controller . getValue ( ) ; ModelNode operationResult ; try { operationResult = invokeCommand ( cache , operation , context ) ; } catch ( Exception e ) { throw new OperationFailedException ( MESSAGES . failedToInvokeOperation ( e . getLocalizedMessage ( ) ) , e ) ; } if ( operationResult != null ) { context . getResult ( ) . set ( operationResult ) ; } } }
An attribute write handler which performs cache operations