类 CapacityManagementAspect


  • public class CapacityManagementAspect
    extends java.lang.Object
    Capacity management aspect: batch write and update but don't process it.
    作者:
    hexu.hxy
    • 方法概要

      所有方法 实例方法 具体方法 
      修饰符和类型 方法 说明
      java.lang.Object aroundDeleteConfig​(org.aspectj.lang.ProceedingJoinPoint pjp, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, java.lang.String dataId, java.lang.String group, java.lang.String tenant)
      The usage of capacity table for counting module will subtracte one whether open the limitation check of capacity management.
      java.lang.Object aroundSyncUpdateConfigAll​(org.aspectj.lang.ProceedingJoinPoint pjp, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, java.lang.String dataId, java.lang.String group, java.lang.String content, java.lang.String appName, java.lang.String srcUser, java.lang.String tenant, java.lang.String tag)
      Need to judge the size of content whether to exceed the limitation.
      private void correctUsage​(java.lang.String group, java.lang.String tenant, boolean hasTenant)  
      private java.lang.Object do4Delete​(org.aspectj.lang.ProceedingJoinPoint pjp, javax.servlet.http.HttpServletResponse response, java.lang.String group, java.lang.String tenant, ConfigInfo configInfo)
      Delete Operation.
      private java.lang.Object do4Insert​(org.aspectj.lang.ProceedingJoinPoint pjp, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, java.lang.String group, java.lang.String tenant, java.lang.String content)
      Write operation.
      private java.lang.Object do4Update​(org.aspectj.lang.ProceedingJoinPoint pjp, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, java.lang.String dataId, java.lang.String group, java.lang.String tenant, java.lang.String content)
      Update operation: open the limitation of capacity management and it will check the size of content.
      private void doResult​(CounterMode counterMode, javax.servlet.http.HttpServletResponse response, java.lang.String group, java.lang.String tenant, java.lang.Object result, boolean hasTenant)  
      private Capacity getCapacity​(java.lang.String group, java.lang.String tenant, boolean hasTenant)  
      private int getCurrentSize​(java.lang.String content)
      Get and return the byte size of encoding.
      private int getDefaultMaxSize​(boolean isAggr)  
      private CapacityManagementAspect.LimitType getGroupOrTenantLimitType​(CounterMode counterMode, java.lang.String group, java.lang.String tenant, int currentSize, boolean hasTenant)  
      private CapacityManagementAspect.LimitType getLimitType​(CounterMode counterMode, java.lang.String group, java.lang.String tenant, java.lang.String content, boolean hasTenant)  
      private java.lang.Integer getMaxSize​(boolean isAggr, Capacity capacity)  
      private java.lang.Object getResult​(org.aspectj.lang.ProceedingJoinPoint pjp, javax.servlet.http.HttpServletResponse response, java.lang.String group, java.lang.String tenant, CounterMode counterMode, boolean hasTenant)  
      private boolean hasTenant​(java.lang.String tenant)  
      private void insertCapacity​(java.lang.String group, java.lang.String tenant, boolean hasTenant)  
      private void insertOrUpdateUsage​(java.lang.String group, java.lang.String tenant, CounterMode counterMode, boolean hasTenant)
      Usage counting service: it will count whether the limitation check function will be open.
      private boolean isOverSize​(java.lang.String group, java.lang.String tenant, int currentSize, int maxSize, boolean hasTenant)  
      private boolean isSizeLimited​(java.lang.String group, java.lang.String tenant, int currentSize, boolean hasTenant, boolean isAggr, Capacity capacity)  
      private boolean isSuccess​(javax.servlet.http.HttpServletResponse response, java.lang.Object result)  
      private boolean isUpdateSuccess​(CounterMode counterMode, java.lang.String group, java.lang.String tenant, boolean hasTenant)  
      private java.lang.Object response4Limit​(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, CapacityManagementAspect.LimitType limitType)  
      private void rollback​(CounterMode counterMode, java.lang.String group, java.lang.String tenant, boolean hasTenant)  
      private void rollbackClusterUsage​(CounterMode counterMode)  
      • 从类继承的方法 java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • 字段详细资料

      • LOGGER

        private static final org.slf4j.Logger LOGGER
      • SYNC_UPDATE_CONFIG_ALL

        private static final java.lang.String SYNC_UPDATE_CONFIG_ALL
        另请参阅:
        常量字段值
      • DELETE_CONFIG

        private static final java.lang.String DELETE_CONFIG
        另请参阅:
        常量字段值
    • 构造器详细资料

      • CapacityManagementAspect

        public CapacityManagementAspect()
    • 方法详细资料

      • aroundSyncUpdateConfigAll

        public java.lang.Object aroundSyncUpdateConfigAll​(org.aspectj.lang.ProceedingJoinPoint pjp,
                                                          javax.servlet.http.HttpServletRequest request,
                                                          javax.servlet.http.HttpServletResponse response,
                                                          java.lang.String dataId,
                                                          java.lang.String group,
                                                          java.lang.String content,
                                                          java.lang.String appName,
                                                          java.lang.String srcUser,
                                                          java.lang.String tenant,
                                                          java.lang.String tag)
                                                   throws java.lang.Throwable
        Need to judge the size of content whether to exceed the limitation.
        抛出:
        java.lang.Throwable
      • do4Update

        private java.lang.Object do4Update​(org.aspectj.lang.ProceedingJoinPoint pjp,
                                           javax.servlet.http.HttpServletRequest request,
                                           javax.servlet.http.HttpServletResponse response,
                                           java.lang.String dataId,
                                           java.lang.String group,
                                           java.lang.String tenant,
                                           java.lang.String content)
                                    throws java.lang.Throwable
        Update operation: open the limitation of capacity management and it will check the size of content.
        抛出:
        java.lang.Throwable - Throws Exception when actually operate.
      • do4Insert

        private java.lang.Object do4Insert​(org.aspectj.lang.ProceedingJoinPoint pjp,
                                           javax.servlet.http.HttpServletRequest request,
                                           javax.servlet.http.HttpServletResponse response,
                                           java.lang.String group,
                                           java.lang.String tenant,
                                           java.lang.String content)
                                    throws java.lang.Throwable
        Write operation. Step 1: count whether to open the limitation checking function for capacity management; Step 2: open limitation checking capacity management and check size of content and quota;
        抛出:
        java.lang.Throwable - Exception.
      • response4Limit

        private java.lang.Object response4Limit​(javax.servlet.http.HttpServletRequest request,
                                                javax.servlet.http.HttpServletResponse response,
                                                CapacityManagementAspect.LimitType limitType)
      • hasTenant

        private boolean hasTenant​(java.lang.String tenant)
      • aroundDeleteConfig

        public java.lang.Object aroundDeleteConfig​(org.aspectj.lang.ProceedingJoinPoint pjp,
                                                   javax.servlet.http.HttpServletRequest request,
                                                   javax.servlet.http.HttpServletResponse response,
                                                   java.lang.String dataId,
                                                   java.lang.String group,
                                                   java.lang.String tenant)
                                            throws java.lang.Throwable
        The usage of capacity table for counting module will subtracte one whether open the limitation check of capacity management.
        抛出:
        java.lang.Throwable
      • do4Delete

        private java.lang.Object do4Delete​(org.aspectj.lang.ProceedingJoinPoint pjp,
                                           javax.servlet.http.HttpServletResponse response,
                                           java.lang.String group,
                                           java.lang.String tenant,
                                           ConfigInfo configInfo)
                                    throws java.lang.Throwable
        Delete Operation.
        抛出:
        java.lang.Throwable - Exception.
      • correctUsage

        private void correctUsage​(java.lang.String group,
                                  java.lang.String tenant,
                                  boolean hasTenant)
      • getResult

        private java.lang.Object getResult​(org.aspectj.lang.ProceedingJoinPoint pjp,
                                           javax.servlet.http.HttpServletResponse response,
                                           java.lang.String group,
                                           java.lang.String tenant,
                                           CounterMode counterMode,
                                           boolean hasTenant)
                                    throws java.lang.Throwable
        抛出:
        java.lang.Throwable
      • insertOrUpdateUsage

        private void insertOrUpdateUsage​(java.lang.String group,
                                         java.lang.String tenant,
                                         CounterMode counterMode,
                                         boolean hasTenant)
        Usage counting service: it will count whether the limitation check function will be open.
      • getCurrentSize

        private int getCurrentSize​(java.lang.String content)
        Get and return the byte size of encoding.
      • isUpdateSuccess

        private boolean isUpdateSuccess​(CounterMode counterMode,
                                        java.lang.String group,
                                        java.lang.String tenant,
                                        boolean hasTenant)
      • insertCapacity

        private void insertCapacity​(java.lang.String group,
                                    java.lang.String tenant,
                                    boolean hasTenant)
      • getCapacity

        private Capacity getCapacity​(java.lang.String group,
                                     java.lang.String tenant,
                                     boolean hasTenant)
      • isSizeLimited

        private boolean isSizeLimited​(java.lang.String group,
                                      java.lang.String tenant,
                                      int currentSize,
                                      boolean hasTenant,
                                      boolean isAggr,
                                      Capacity capacity)
      • getMaxSize

        private java.lang.Integer getMaxSize​(boolean isAggr,
                                             Capacity capacity)
      • getDefaultMaxSize

        private int getDefaultMaxSize​(boolean isAggr)
      • isOverSize

        private boolean isOverSize​(java.lang.String group,
                                   java.lang.String tenant,
                                   int currentSize,
                                   int maxSize,
                                   boolean hasTenant)
      • doResult

        private void doResult​(CounterMode counterMode,
                              javax.servlet.http.HttpServletResponse response,
                              java.lang.String group,
                              java.lang.String tenant,
                              java.lang.Object result,
                              boolean hasTenant)
      • isSuccess

        private boolean isSuccess​(javax.servlet.http.HttpServletResponse response,
                                  java.lang.Object result)
      • rollback

        private void rollback​(CounterMode counterMode,
                              java.lang.String group,
                              java.lang.String tenant,
                              boolean hasTenant)
      • rollbackClusterUsage

        private void rollbackClusterUsage​(CounterMode counterMode)