Class CacheUsageInterceptor

All Implemented Interfaces:
Visitor, AsyncInterceptor

@MBean(objectName="CacheUsageStatistics", description="Keeps tracks of the accessed keys") public class CacheUsageInterceptor extends BaseCustomAsyncInterceptor
Intercepts the VisitableCommands to calculate the corresponding top-key values.
Since:
6.0
Author:
Pedro Ruivo
  • Field Details

  • Constructor Details

    • CacheUsageInterceptor

      public CacheUsageInterceptor()
  • Method Details

    • visitGetKeyValueCommand

      public Object visitGetKeyValueCommand(InvocationContext ctx, org.infinispan.commands.read.GetKeyValueCommand command)
      Specified by:
      visitGetKeyValueCommand in interface Visitor
      Overrides:
      visitGetKeyValueCommand in class DDAsyncInterceptor
    • visitGetAllCommand

      public Object visitGetAllCommand(InvocationContext ctx, org.infinispan.commands.read.GetAllCommand command)
      Specified by:
      visitGetAllCommand in interface Visitor
      Overrides:
      visitGetAllCommand in class DDAsyncInterceptor
    • visitPutKeyValueCommand

      public Object visitPutKeyValueCommand(InvocationContext ctx, org.infinispan.commands.write.PutKeyValueCommand command)
      Specified by:
      visitPutKeyValueCommand in interface Visitor
      Overrides:
      visitPutKeyValueCommand in class DDAsyncInterceptor
    • visitPrepareCommand

      public Object visitPrepareCommand(TxInvocationContext ctx, org.infinispan.commands.tx.PrepareCommand command)
      Specified by:
      visitPrepareCommand in interface Visitor
      Overrides:
      visitPrepareCommand in class DDAsyncInterceptor
    • resetStatistics

      @ManagedOperation(description="Resets statistics gathered by this component", displayName="Reset Statistics (Statistics)") public void resetStatistics()
    • setTopKValue

      @ManagedOperation(description="Set K for the top-K values", displayName="Set capacity") public void setTopKValue(@Parameter(name="n",description="the n-th top key to collect") int n)
    • getCapacity

      @ManagedAttribute(description="Shows the current capacity for top-K values", displayName="getCapacity") public int getCapacity()
    • getRemoteTopGets

      @ManagedAttribute(description="Show the top 10 keys most read remotely by this instance", displayName="Top Remote Read Keys") public Map<String,Long> getRemoteTopGets()
    • getNRemoteTopGets

      @ManagedOperation(description="Show the top n keys most read remotely by this instance", displayName="Nth Top Remote Read Keys") public Map<String,Long> getNRemoteTopGets(@Parameter(name="n",description="the n-th top key to return") int n)
    • getLocalTopGets

      @ManagedAttribute(description="Show the top 10 keys most read locally by this instance", displayName="Top Local Read Keys") public Map<String,Long> getLocalTopGets()
    • getNLocalTopGets

      @ManagedOperation(description="Show the top n keys most read locally by this instance", displayName="Nth Top Local Read Keys") public Map<String,Long> getNLocalTopGets(@Parameter(name="n",description="the n-th top key to return") int n)
    • getRemoteTopPuts

      @ManagedAttribute(description="Show the top 10 keys most write remotely by this instance", displayName="Top Remote Write Keys") public Map<String,Long> getRemoteTopPuts()
    • getNRemoteTopPuts

      @ManagedOperation(description="Show the top n keys most write remotely by this instance", displayName="Nth Top Remote Write Keys") public Map<String,Long> getNRemoteTopPuts(@Parameter(name="n",description="the n-th top key to return") int n)
    • getLocalTopPuts

      @ManagedAttribute(description="Show the top 10 keys most write locally by this instance", displayName="Top Local Write Keys") public Map<String,Long> getLocalTopPuts()
    • getNLocalTopPuts

      @ManagedOperation(description="Show the top n keys most write locally by this instance", displayName="Nth Top Local Write Keys") public Map<String,Long> getNLocalTopPuts(@Parameter(name="n",description="the n-th top key to return") int n)
    • getTopLockedKeys

      @ManagedAttribute(description="Show the top 10 keys most locked", displayName="Top Locked Keys") public Map<String,Long> getTopLockedKeys()
    • getNTopLockedKeys

      @ManagedOperation(description="Show the top n keys most locked", displayName="Nth Top Locked Keys") public Map<String,Long> getNTopLockedKeys(@Parameter(name="n",description="the n-th top key to return") int n)
    • getTopContendedKeys

      @ManagedAttribute(description="Show the top 10 keys most contended", displayName="Top Contended Keys") public Map<String,Long> getTopContendedKeys()
    • getNTopContendedKeys

      @ManagedOperation(description="Show the top n keys most contended", displayName="Nth Top Contended Keys") public Map<String,Long> getNTopContendedKeys(@Parameter(name="n",description="the n-th top key to return") int n)
    • getTopLockFailedKeys

      @ManagedAttribute(description="Show the top 10 keys whose lock acquisition failed by timeout", displayName="Top Keys whose Lock Acquisition Failed by Timeout") public Map<String,Long> getTopLockFailedKeys()
    • getNTopLockFailedKeys

      @ManagedOperation(description="Show the top n keys whose lock acquisition failed ", displayName="Nth Top Keys whose Lock Acquisition Failed by Timeout") public Map<String,Long> getNTopLockFailedKeys(@Parameter(name="n",description="the n-th top key to return") int n)
    • getTopWriteSkewFailedKeys

      @ManagedAttribute(description="Show the top 10 keys whose write skew check was failed", displayName="Top Keys whose Write Skew Check was failed") public Map<String,Long> getTopWriteSkewFailedKeys()
    • getNTopWriteSkewFailedKeys

      @ManagedOperation(description="Show the top n keys whose write skew check was failed", displayName="Nth Top Keys whose Write Skew Check was failed") public Map<String,Long> getNTopWriteSkewFailedKeys(@Parameter(name="n",description="the n-th top key to return") int n)
    • setStatisticsEnabled

      @ManagedOperation(description="Show the top n keys whose write skew check was failed", displayName="Top Keys whose Write Skew Check was failed") public void setStatisticsEnabled(@Parameter(name="enabled",description="true to enable the top-k collection") boolean enabled)
    • start

      protected void start()
      Overrides:
      start in class BaseCustomAsyncInterceptor
    • stop

      protected void stop()
      Overrides:
      stop in class BaseCustomAsyncInterceptor