Package org.apache.stratos.usage.agent.beans

Examples of org.apache.stratos.usage.agent.beans.BandwidthUsage


     * @param size value of the incoming bandwidth
     */

    public static void storeIncomingBandwidth(int tenantId, long size) {
        if ((MultitenantConstants.SUPER_TENANT_ID!=tenantId) && (size > 0)) {
            BandwidthUsage usage = new BandwidthUsage(
                    tenantId, UsageConstants.REGISTRY_INCOMING_BW, size);
            Util.addToPersistingControllerQueue(usage);
        }
    }
View Full Code Here


    }
    //=============================================================

    public static void storeAddContent(int tenantId, long size) {
        if ((MultitenantConstants.SUPER_TENANT_ID!=tenantId) && (size > 0)) {
            BandwidthUsage usage = new BandwidthUsage(
                    tenantId, "ContentBandwidth-In", size);
            Util.addToPersistingControllerQueue(usage);
        }
    }
View Full Code Here

            Util.addToPersistingControllerQueue(usage);
        }
    }
    public static void storeDeleteContent(int tenantId, long size) {
        if ((MultitenantConstants.SUPER_TENANT_ID!=tenantId) && (size > 0)) {
            BandwidthUsage usage = new BandwidthUsage(
                    tenantId, "ContentBandwidth-Out", size);
            Util.addToPersistingControllerQueue(usage);
        }
    }
View Full Code Here

     * @param tenantId tenant id
     * @param size value of the outgoing bandwidth
     */
    public static void storeOutgoingBandwidth(int tenantId, long size) {
        if ((MultitenantConstants.SUPER_TENANT_ID!=tenantId) && (size > 0)) {
            BandwidthUsage usage = new BandwidthUsage(
                    tenantId, UsageConstants.REGISTRY_OUTGOING_BW, size);
            Util.addToPersistingControllerQueue(usage);
        }
    }
View Full Code Here

        // if the jobQueue is not empty
        for (int i = 0; i < configuration.getUsageTasksNumberOfRecordsPerExecution() && !jobQueue.isEmpty(); i++) {

            // get the first element from the queue, which is a BandwidthUsage object
            BandwidthUsage usage = jobQueue.poll();

            // get the tenant id
            int tenantId = usage.getTenantId();

            //get the Summarizer object corresponds to the tenant id
            Summarizer summarizer = summarizerMap.get(tenantId);

            // when tenant invoke service for the first time, no corresponding summarizer object in
View Full Code Here

        public void accumulate(BandwidthUsage usage) {
            // get the measurement name of usage entry
            String key = usage.getMeasurement();

            // get the existing value of measurement
            BandwidthUsage existingUsage = usageMap.get(key);

            // if this measurement is metered earlier add the new value to the existing value
            if (existingUsage != null) {
                existingUsage.setValue(existingUsage.getValue() + usage.getValue());
            } else {
                // if this measurement is not metered previously we need to add it to the usageMap
                usageMap.put(key, usage);
            }
        }
View Full Code Here

                    if(tenantId<0){
                        return;
                    }
                    if (inferMeasurement(entry).equals(UsageConstants.SERVICE_BANDWIDTH)) {
                        if (entry.getRequestSize() > 0) {
                            Util.addToPersistingControllerQueue(new BandwidthUsage(getTenantID(entry.getTenantName()), UsageConstants.SERVICE_INCOMING_BW, entry.getRequestSize()));
                        }
                        if (entry.getResponseSize() > 0) {
                            Util.addToPersistingControllerQueue(new BandwidthUsage(getTenantID(entry.getTenantName()), UsageConstants.SERVICE_OUTGOING_BW, entry.getResponseSize()));
                        }
                    } else if (inferMeasurement(entry).equals(UsageConstants.WEBAPP_BANDWIDTH)) {
                        if (entry.getRequestSize() > 0) {
                            Util.addToPersistingControllerQueue(new BandwidthUsage(getTenantID(entry.getTenantName()), UsageConstants.WEBAPP_INCOMING_BW, entry.getRequestSize()));
                        }
                        if (entry.getResponseSize() > 0) {
                            Util.addToPersistingControllerQueue(new BandwidthUsage(getTenantID(entry.getTenantName()), UsageConstants.WEBAPP_OUTGOING_BW, entry.getResponseSize()));
                        }
                    }
                } catch (UserStoreException e) {
                    log.error("Error persisting bandwidth usage statistics.", e);
                }
View Full Code Here

        if(log.isTraceEnabled()){
            log.trace("Persisting service bandwidth usage for tenant " + tenantId + " in size: " + inDataSize + " out size: " + outDataSize);
        }
        // add the job to queue
        if (inDataSize > 0) {
            BandwidthUsage usage = new BandwidthUsage(tenantId,
                    UsageConstants.SERVICE_INCOMING_BW, inDataSize);
            Util.addToPersistingControllerQueue(usage);
        }
        if (outDataSize > 0) {
            BandwidthUsage usage = new BandwidthUsage(tenantId,
                    UsageConstants.SERVICE_OUTGOING_BW, outDataSize);
            Util.addToPersistingControllerQueue(usage);
        }
    }
View Full Code Here

     * @param size value of the incoming bandwidth
     */

    public static void storeIncomingBandwidth(int tenantId, long size) {
        if ((MultitenantConstants.SUPER_TENANT_ID!=tenantId) && (size > 0)) {
            BandwidthUsage usage = new BandwidthUsage(
                    tenantId, UsageConstants.REGISTRY_INCOMING_BW, size);
            Util.addToPersistingControllerQueue(usage);
        }
    }
View Full Code Here

     * @param tenantId tenant id
     * @param size value of the outgoing bandwidth
     */
    public static void storeOutgoingBandwidth(int tenantId, long size) {
        if ((MultitenantConstants.SUPER_TENANT_ID!=tenantId) && (size > 0)) {
            BandwidthUsage usage = new BandwidthUsage(
                    tenantId, UsageConstants.REGISTRY_OUTGOING_BW, size);
            Util.addToPersistingControllerQueue(usage);
        }
    }
View Full Code Here

TOP

Related Classes of org.apache.stratos.usage.agent.beans.BandwidthUsage

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.