List of usage examples for java.util SortedMap size
int size();
From source file:net.sourceforge.msscodefactory.cfasterisk.v2_0.CFAstXMsgClient.CFAstXMsgClientTSecGroupMemberTable.java
public CFAstTSecGroupMemberBuff[] readDerivedByGroupIdx(CFAstAuthorization Authorization, long argTenantId, int argTSecGroupId) { final String S_ProcName = "readDerivedByGroupIdx"; String rqst = CFAstXMsgSchemaMessageFormatter.formatRqstXmlPreamble() + "\n" + "\t" + CFAstXMsgTSecGroupMemberMessageFormatter.formatTSecGroupMemberRqstReadByGroupIdx("\n\t\t\t", argTenantId, argTSecGroupId) + "\n" + CFAstXMsgSchemaMessageFormatter.formatRqstXmlPostamble(); String rspn = schema.sendReceive(Authorization, rqst); if ((rspn == null) || (rspn.length() <= 0)) { throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0, "rspn"); }/*from ww w . java2 s .co m*/ CFAstXMsgRspnHandler responseHandler = schema.getResponseHandler(); responseHandler.parseStringContents(rspn); CFLibRuntimeException exceptionRaised = responseHandler.getExceptionRaised(); if (exceptionRaised != null) { throw exceptionRaised; } Object sortedMapObj = responseHandler.getSortedMapOfObjects(); if (sortedMapObj == null) { throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0, "responseHandler.getSortedMapOfObjects"); } SortedMap<CFAstTSecGroupMemberPKey, ICFAstTSecGroupMemberObj> sortedMap = (SortedMap<CFAstTSecGroupMemberPKey, ICFAstTSecGroupMemberObj>) sortedMapObj; int sz = sortedMap.size(); CFAstTSecGroupMemberBuff arr[] = new CFAstTSecGroupMemberBuff[sz]; Iterator<ICFAstTSecGroupMemberObj> iter = sortedMap.values().iterator(); ICFAstTSecGroupMemberObj cur; for (int idx = 0; idx < sz; idx++) { cur = (ICFAstTSecGroupMemberObj) iter.next(); arr[idx] = cur.getTSecGroupMemberBuff(); } return (arr); }
From source file:net.sourceforge.msscodefactory.cfacc.v2_0.CFAccRam.CFAccRamMemoTagTable.java
public CFAccMemoTagBuff[] readDerivedByMemoIdx(CFAccAuthorization Authorization, long TenantId, long MemoId) { final String S_ProcName = "CFAccRamMemoTag.readDerivedByMemoIdx() "; CFAccMemoTagByMemoIdxKey key = schema.getFactoryMemoTag().newMemoIdxKey(); key.setRequiredTenantId(TenantId);//from w w w . java 2 s . c o m key.setRequiredMemoId(MemoId); CFAccMemoTagBuff[] recArray; if (dictByMemoIdx.containsKey(key)) { SortedMap<CFAccMemoTagPKey, CFAccMemoTagBuff> subdictMemoIdx = dictByMemoIdx.get(key); recArray = new CFAccMemoTagBuff[subdictMemoIdx.size()]; Iterator<CFAccMemoTagBuff> iter = subdictMemoIdx.values().iterator(); int idx = 0; while (iter.hasNext()) { recArray[idx++] = iter.next(); } } else { recArray = new CFAccMemoTagBuff[0]; } return (recArray); }
From source file:com.jlhood.metrics.CloudWatchReporter.java
/** * Reports the given metrics to CloudWatch. * * @param gauges gauge metrics.//from ww w . j av a 2s . com * @param counters counter metrics. * @param histograms histogram metrics. * @param meters meter metrics. * @param timers timer metrics. */ void report(SortedMap<String, Gauge> gauges, SortedMap<String, Counter> counters, SortedMap<String, Histogram> histograms, SortedMap<String, Meter> meters, SortedMap<String, Timer> timers) { // Just an estimate to reduce resizing. List<MetricDatum> data = new ArrayList<MetricDatum>( gauges.size() + counters.size() + meters.size() + 2 * histograms.size() + 2 * timers.size()); // Translate various metric classes to MetricDatum for (Map.Entry<String, Gauge> gaugeEntry : gauges.entrySet()) { reportGauge(gaugeEntry, typeDimValGauge, data); } for (Map.Entry<String, Counter> counterEntry : counters.entrySet()) { reportCounter(counterEntry, typeDimValCounterCount, data); } for (Map.Entry<String, Meter> meterEntry : meters.entrySet()) { reportCounter(meterEntry, typeDimValMeterCount, data); } for (Map.Entry<String, Histogram> histogramEntry : histograms.entrySet()) { reportCounter(histogramEntry, typeDimValHistoSamples, data); reportSampling(histogramEntry, typeDimValHistoStats, 1.0, data); } for (Map.Entry<String, Timer> timerEntry : timers.entrySet()) { reportCounter(timerEntry, typeDimValTimerSamples, data); reportSampling(timerEntry, typeDimValTimerStats, 0.000001, data); // nanos -> millis } // Filter out unreportable entries. Collection<MetricDatum> nonEmptyData = Collections2.filter(data, new Predicate<MetricDatum>() { @Override public boolean apply(MetricDatum input) { if (input == null) { return false; } else if (input.getStatisticValues() != null) { // CloudWatch rejects any Statistic Sets with sample count == 0, which it probably should reject. return input.getStatisticValues().getSampleCount() > 0; } return true; } }); // Whether to use local "now" (true, new Date()) or cloudwatch service "now" (false, leave null). if (timestampLocal) { Date now = new Date(); for (MetricDatum datum : nonEmptyData) { datum.withTimestamp(now); } } // Finally, apply any user-level filter. Collection<MetricDatum> filtered = Collections2.filter(nonEmptyData, reporterFilter); // Each CloudWatch API request may contain at maximum 20 datums. Break into partitions of 20. Iterable<List<MetricDatum>> dataPartitions = Iterables.partition(filtered, 20); List<Future<?>> cloudWatchFutures = Lists.newArrayListWithExpectedSize(filtered.size()); // Submit asynchronously with threads. for (List<MetricDatum> dataSubset : dataPartitions) { cloudWatchFutures.add(cloudWatch.putMetricDataAsync( new PutMetricDataRequest().withNamespace(metricNamespace).withMetricData(dataSubset))); } // Wait for CloudWatch putMetricData futures to be fulfilled. for (Future<?> cloudWatchFuture : cloudWatchFutures) { try { cloudWatchFuture.get(); } catch (Exception e) { LOG.error( "Exception reporting metrics to CloudWatch. Some or all of the data in this CloudWatch API request " + "may have been discarded, did not make it to CloudWatch.", e); } } LOG.debug("Sent {} metric data to CloudWatch. namespace: {}", filtered.size(), metricNamespace); }
From source file:net.sourceforge.msscodefactory.cfacc.v2_0.CFAccXMsgClient.CFAccXMsgClientSecGroupIncludeTable.java
public CFAccSecGroupIncludeBuff[] readAllDerived(CFAccAuthorization Authorization) { final String S_ProcName = "readAllDerived"; String rqst = CFAccXMsgSchemaMessageFormatter.formatRqstXmlPreamble() + "\n" + "\t" + CFAccXMsgSecGroupIncludeMessageFormatter.formatSecGroupIncludeRqstReadAll("\n\t\t\t") + "\n" + CFAccXMsgSchemaMessageFormatter.formatRqstXmlPostamble(); String rspn = schema.sendReceive(Authorization, rqst); if ((rspn == null) || (rspn.length() <= 0)) { throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0, "rspn"); }/*from w w w.j a va 2 s. c o m*/ CFAccXMsgRspnHandler responseHandler = schema.getResponseHandler(); responseHandler.parseStringContents(rspn); CFLibRuntimeException exceptionRaised = responseHandler.getExceptionRaised(); if (exceptionRaised != null) { throw exceptionRaised; } Object sortedMapObj = responseHandler.getSortedMapOfObjects(); if (sortedMapObj == null) { throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0, "responseHandler.getSortedMapOfObjects"); } SortedMap<CFAccSecGroupIncludePKey, ICFAccSecGroupIncludeObj> sortedMap = (SortedMap<CFAccSecGroupIncludePKey, ICFAccSecGroupIncludeObj>) sortedMapObj; int sz = sortedMap.size(); CFAccSecGroupIncludeBuff arr[] = new CFAccSecGroupIncludeBuff[sz]; Iterator<ICFAccSecGroupIncludeObj> iter = sortedMap.values().iterator(); ICFAccSecGroupIncludeObj cur; for (int idx = 0; idx < sz; idx++) { cur = (ICFAccSecGroupIncludeObj) iter.next(); arr[idx] = cur.getSecGroupIncludeBuff(); } return (arr); }
From source file:net.sourceforge.msscodefactory.cfasterisk.v2_0.CFAstXMsgClient.CFAstXMsgClientSecGroupIncludeTable.java
public CFAstSecGroupIncludeBuff[] readAllDerived(CFAstAuthorization Authorization) { final String S_ProcName = "readAllDerived"; String rqst = CFAstXMsgSchemaMessageFormatter.formatRqstXmlPreamble() + "\n" + "\t" + CFAstXMsgSecGroupIncludeMessageFormatter.formatSecGroupIncludeRqstReadAll("\n\t\t\t") + "\n" + CFAstXMsgSchemaMessageFormatter.formatRqstXmlPostamble(); String rspn = schema.sendReceive(Authorization, rqst); if ((rspn == null) || (rspn.length() <= 0)) { throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0, "rspn"); }/*www .jav a 2 s. c o m*/ CFAstXMsgRspnHandler responseHandler = schema.getResponseHandler(); responseHandler.parseStringContents(rspn); CFLibRuntimeException exceptionRaised = responseHandler.getExceptionRaised(); if (exceptionRaised != null) { throw exceptionRaised; } Object sortedMapObj = responseHandler.getSortedMapOfObjects(); if (sortedMapObj == null) { throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0, "responseHandler.getSortedMapOfObjects"); } SortedMap<CFAstSecGroupIncludePKey, ICFAstSecGroupIncludeObj> sortedMap = (SortedMap<CFAstSecGroupIncludePKey, ICFAstSecGroupIncludeObj>) sortedMapObj; int sz = sortedMap.size(); CFAstSecGroupIncludeBuff arr[] = new CFAstSecGroupIncludeBuff[sz]; Iterator<ICFAstSecGroupIncludeObj> iter = sortedMap.values().iterator(); ICFAstSecGroupIncludeObj cur; for (int idx = 0; idx < sz; idx++) { cur = (ICFAstSecGroupIncludeObj) iter.next(); arr[idx] = cur.getSecGroupIncludeBuff(); } return (arr); }
From source file:net.sourceforge.msscodefactory.cfacc.v2_0.CFAccRam.CFAccRamPhoneTagTable.java
public CFAccPhoneTagBuff[] readDerivedByTagIdx(CFAccAuthorization Authorization, long TenantId, long TagId) { final String S_ProcName = "CFAccRamPhoneTag.readDerivedByTagIdx() "; CFAccPhoneTagByTagIdxKey key = schema.getFactoryPhoneTag().newTagIdxKey(); key.setRequiredTenantId(TenantId);/*w w w .jav a 2 s . c o m*/ key.setRequiredTagId(TagId); CFAccPhoneTagBuff[] recArray; if (dictByTagIdx.containsKey(key)) { SortedMap<CFAccPhoneTagPKey, CFAccPhoneTagBuff> subdictTagIdx = dictByTagIdx.get(key); recArray = new CFAccPhoneTagBuff[subdictTagIdx.size()]; Iterator<CFAccPhoneTagBuff> iter = subdictTagIdx.values().iterator(); int idx = 0; while (iter.hasNext()) { recArray[idx++] = iter.next(); } } else { recArray = new CFAccPhoneTagBuff[0]; } return (recArray); }
From source file:net.sourceforge.msscodefactory.cfacc.v2_0.CFAccXMsgClient.CFAccXMsgClientSecGroupIncludeTable.java
public CFAccSecGroupIncludeBuff[] readDerivedByClusterIdx(CFAccAuthorization Authorization, long argClusterId) { final String S_ProcName = "readDerivedByClusterIdx"; String rqst = CFAccXMsgSchemaMessageFormatter.formatRqstXmlPreamble() + "\n" + "\t" + CFAccXMsgSecGroupIncludeMessageFormatter.formatSecGroupIncludeRqstReadByClusterIdx("\n\t\t\t", argClusterId)//w w w .j av a 2 s. c o m + "\n" + CFAccXMsgSchemaMessageFormatter.formatRqstXmlPostamble(); String rspn = schema.sendReceive(Authorization, rqst); if ((rspn == null) || (rspn.length() <= 0)) { throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0, "rspn"); } CFAccXMsgRspnHandler responseHandler = schema.getResponseHandler(); responseHandler.parseStringContents(rspn); CFLibRuntimeException exceptionRaised = responseHandler.getExceptionRaised(); if (exceptionRaised != null) { throw exceptionRaised; } Object sortedMapObj = responseHandler.getSortedMapOfObjects(); if (sortedMapObj == null) { throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0, "responseHandler.getSortedMapOfObjects"); } SortedMap<CFAccSecGroupIncludePKey, ICFAccSecGroupIncludeObj> sortedMap = (SortedMap<CFAccSecGroupIncludePKey, ICFAccSecGroupIncludeObj>) sortedMapObj; int sz = sortedMap.size(); CFAccSecGroupIncludeBuff arr[] = new CFAccSecGroupIncludeBuff[sz]; Iterator<ICFAccSecGroupIncludeObj> iter = sortedMap.values().iterator(); ICFAccSecGroupIncludeObj cur; for (int idx = 0; idx < sz; idx++) { cur = (ICFAccSecGroupIncludeObj) iter.next(); arr[idx] = cur.getSecGroupIncludeBuff(); } return (arr); }
From source file:net.sourceforge.msscodefactory.cfasterisk.v2_0.CFAstXMsgClient.CFAstXMsgClientSecGroupIncludeTable.java
public CFAstSecGroupIncludeBuff[] readDerivedByClusterIdx(CFAstAuthorization Authorization, long argClusterId) { final String S_ProcName = "readDerivedByClusterIdx"; String rqst = CFAstXMsgSchemaMessageFormatter.formatRqstXmlPreamble() + "\n" + "\t" + CFAstXMsgSecGroupIncludeMessageFormatter.formatSecGroupIncludeRqstReadByClusterIdx("\n\t\t\t", argClusterId)// www .ja v a2 s . co m + "\n" + CFAstXMsgSchemaMessageFormatter.formatRqstXmlPostamble(); String rspn = schema.sendReceive(Authorization, rqst); if ((rspn == null) || (rspn.length() <= 0)) { throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0, "rspn"); } CFAstXMsgRspnHandler responseHandler = schema.getResponseHandler(); responseHandler.parseStringContents(rspn); CFLibRuntimeException exceptionRaised = responseHandler.getExceptionRaised(); if (exceptionRaised != null) { throw exceptionRaised; } Object sortedMapObj = responseHandler.getSortedMapOfObjects(); if (sortedMapObj == null) { throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0, "responseHandler.getSortedMapOfObjects"); } SortedMap<CFAstSecGroupIncludePKey, ICFAstSecGroupIncludeObj> sortedMap = (SortedMap<CFAstSecGroupIncludePKey, ICFAstSecGroupIncludeObj>) sortedMapObj; int sz = sortedMap.size(); CFAstSecGroupIncludeBuff arr[] = new CFAstSecGroupIncludeBuff[sz]; Iterator<ICFAstSecGroupIncludeObj> iter = sortedMap.values().iterator(); ICFAstSecGroupIncludeObj cur; for (int idx = 0; idx < sz; idx++) { cur = (ICFAstSecGroupIncludeObj) iter.next(); arr[idx] = cur.getSecGroupIncludeBuff(); } return (arr); }
From source file:net.sourceforge.msscodefactory.cfacc.v2_0.CFAccRam.CFAccRamMemoTagTable.java
public CFAccMemoTagBuff[] readDerivedByTenantIdx(CFAccAuthorization Authorization, long TenantId) { final String S_ProcName = "CFAccRamMemoTag.readDerivedByTenantIdx() "; CFAccMemoTagByTenantIdxKey key = schema.getFactoryMemoTag().newTenantIdxKey(); key.setRequiredTenantId(TenantId);/*from w ww.ja va 2 s .co m*/ CFAccMemoTagBuff[] recArray; if (dictByTenantIdx.containsKey(key)) { SortedMap<CFAccMemoTagPKey, CFAccMemoTagBuff> subdictTenantIdx = dictByTenantIdx.get(key); recArray = new CFAccMemoTagBuff[subdictTenantIdx.size()]; Iterator<CFAccMemoTagBuff> iter = subdictTenantIdx.values().iterator(); int idx = 0; while (iter.hasNext()) { recArray[idx++] = iter.next(); } } else { recArray = new CFAccMemoTagBuff[0]; } return (recArray); }
From source file:net.sourceforge.msscodefactory.cfacc.v2_0.CFAccXMsgClient.CFAccXMsgClientSecGroupIncludeTable.java
public CFAccSecGroupIncludeBuff[] readDerivedByGroupIdx(CFAccAuthorization Authorization, long argClusterId, int argSecGroupId) { final String S_ProcName = "readDerivedByGroupIdx"; String rqst = CFAccXMsgSchemaMessageFormatter.formatRqstXmlPreamble() + "\n" + "\t" + CFAccXMsgSecGroupIncludeMessageFormatter.formatSecGroupIncludeRqstReadByGroupIdx("\n\t\t\t", argClusterId, argSecGroupId) + "\n" + CFAccXMsgSchemaMessageFormatter.formatRqstXmlPostamble(); String rspn = schema.sendReceive(Authorization, rqst); if ((rspn == null) || (rspn.length() <= 0)) { throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0, "rspn"); }//from w w w.j a va2 s. c o m CFAccXMsgRspnHandler responseHandler = schema.getResponseHandler(); responseHandler.parseStringContents(rspn); CFLibRuntimeException exceptionRaised = responseHandler.getExceptionRaised(); if (exceptionRaised != null) { throw exceptionRaised; } Object sortedMapObj = responseHandler.getSortedMapOfObjects(); if (sortedMapObj == null) { throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 0, "responseHandler.getSortedMapOfObjects"); } SortedMap<CFAccSecGroupIncludePKey, ICFAccSecGroupIncludeObj> sortedMap = (SortedMap<CFAccSecGroupIncludePKey, ICFAccSecGroupIncludeObj>) sortedMapObj; int sz = sortedMap.size(); CFAccSecGroupIncludeBuff arr[] = new CFAccSecGroupIncludeBuff[sz]; Iterator<ICFAccSecGroupIncludeObj> iter = sortedMap.values().iterator(); ICFAccSecGroupIncludeObj cur; for (int idx = 0; idx < sz; idx++) { cur = (ICFAccSecGroupIncludeObj) iter.next(); arr[idx] = cur.getSecGroupIncludeBuff(); } return (arr); }