Java Code Examples for org.eclipse.collections.impl.map.mutable.UnifiedMap#newMap()
The following examples show how to use
org.eclipse.collections.impl.map.mutable.UnifiedMap#newMap() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: MithraCacheLoaderRuntimeConfigTestUtil.java From reladomo with Apache License 2.0 | 6 votes |
private Map<String, MithraObjectConfigurationType> getAllDefinedClasses(FileInputStream runtimeConfigFile) { final Map<String, MithraObjectConfigurationType> allDefinedClasses = UnifiedMap.newMap(); MithraRuntimeType mithraRuntimeType = new MithraConfigurationManager().parseConfiguration(runtimeConfigFile); for (ConnectionManagerType connectionManagerType : mithraRuntimeType.getConnectionManagers()) { for (SchemaType schemaType : connectionManagerType.getSchemas()) { this.addToAllDefinedClasses(allDefinedClasses, schemaType.getMithraObjectConfigurations()); } this.addToAllDefinedClasses(allDefinedClasses, connectionManagerType.getMithraObjectConfigurations()); } return allDefinedClasses; }
Example 2
Source File: MithraTestResource.java From reladomo with Apache License 2.0 | 6 votes |
private void setUpPortals() { Map<String, MithraObjectPortal> allPortals = UnifiedMap.newMap(); for (MithraRuntimeConfig config : this.mithraRuntimeList) { for (MithraObjectPortal portal : config.getObjectPortals()) { String key = portal.getFinder().getFinderClassName(); MithraObjectPortal existingPortal = allPortals.get(key); if (this.validateConnectionManagers && (existingPortal != null && !portalsHaveSameConnectionManager(portal, existingPortal))) { throw new IllegalStateException(key + " must use same connection managers in all configurations"); } allPortals.put(key, portal); } } this.portals = FastList.newList(allPortals.values()); }
Example 3
Source File: MithraObjectGraphExtractor.java From reladomo with Apache License 2.0 | 6 votes |
private void writeToFiles(ExecutorService executor, Map<Pair<RelatedFinder, Object>, List<MithraDataObject>> extract) { UnifiedMap<File, UnifiedMap<RelatedFinder, List<MithraDataObject>>> dataByFile = UnifiedMap.newMap(); for (Pair<RelatedFinder, Object> key : extract.keySet()) { File outputFile = this.outputStrategy.getOutputFile(key.getOne(), key.getTwo()); if (outputFile != null) { dataByFile.getIfAbsentPut(outputFile, UnifiedMap.<RelatedFinder, List<MithraDataObject>>newMap()).put(key.getOne(), extract.get(key)); } } for (File file : dataByFile.keySet()) { executor.submit(new FileWriterTask(file, dataByFile.get(file))); } }
Example 4
Source File: DbExtractor.java From reladomo with Apache License 2.0 | 6 votes |
private Map<RelatedFinder, NonUniqueIndex> getExistingData() { if (!this.overwrite) { if (this.saveMergedDataInMemory) { LOGGER.info("Loading merged data from memory. Size size of the list is " + this.mergedData.size()); return this.loadData(this.mergedData); } else if (new File(this.fileName).exists()) { LOGGER.info("Loading existing data from " + this.fileName); return this.loadDataFromFile(this.fileName); } } return UnifiedMap.newMap(); }
Example 5
Source File: ExtractResult.java From reladomo with Apache License 2.0 | 6 votes |
public Map<Pair<RelatedFinder, Object>, List<MithraDataObject>> getDataObjectsByFinderAndSource() { UnifiedMap<Pair<RelatedFinder, Object>, List<MithraDataObject>> result = UnifiedMap.newMap(this.dataObjectsByFinder.size()); for (MithraObject key : this.dataObjectsByFinder.keySet()) { FullUniqueIndex mithraObjects = this.dataObjectsByFinder.get(key); RelatedFinder finder = finder(key); Object source = source(key); List<MithraDataObject> mithraDataObjects = FastList.newList(mithraObjects.size()); for (Object mithraObject : mithraObjects.getAll()) { mithraDataObjects.add(((MithraObject) mithraObject).zGetCurrentData()); } result.put(Pair.of(finder, source), mithraDataObjects); } return result; }
Example 6
Source File: OffHeapFreeThread.java From reladomo with Apache License 2.0 | 6 votes |
private Map<Thread, StackTraceElement[]> getStackTracesForRelevantThreads() { UnifiedMap<Thread, StackTraceElement[]> result = UnifiedMap.newMap(); for (int i = 0; i < toFree.size(); i++) { OffHeapThreadSnapShot snapShot = toFree.get(i); for (Iterator<Thread> it = snapShot.activeThreads.keySet().iterator(); it.hasNext(); ) { Thread thread = it.next(); if (!thread.getState().equals(State.RUNNABLE)) { it.remove(); } else if (!result.containsKey(thread)) { result.put(thread, thread.getStackTrace()); } } } return result; }
Example 7
Source File: OffHeapFreeThread.java From reladomo with Apache License 2.0 | 6 votes |
public void queue(long base) { Map<Thread, StackTraceElement[]> allStackTraces = UnifiedMap.newMap(Thread.getAllStackTraces()); allStackTraces.remove(Thread.currentThread()); for (Iterator<Thread> it = allStackTraces.keySet().iterator(); it.hasNext(); ) { Thread thread = it.next(); if (!isBusy(thread, allStackTraces.get(thread))) { it.remove(); } } logger.debug("Queuing "+base+" to free later"); synchronized (newToFree) { newToFree.add(new OffHeapThreadSnapShot(base, allStackTraces)); } }
Example 8
Source File: OutgoingAsyncTopicTest.java From reladomo with Apache License 2.0 | 5 votes |
@Test public void testSendSetsProperties() throws NamingException, JMSException, RollbackException, RestartTopicException, XAException { mithraTransaction = topicResourcesWithTransactionXid.startTransaction(); UnifiedMap<String, Object> msgProperties = UnifiedMap.<String, Object>newMap(); msgProperties.put("Hello", "World"); Future<Void> voidFuture = outTopic.asyncSendMessages(FastList.newListWith("msg1".getBytes()), msgProperties); topicResourcesWithTransactionXid.commit(mithraTransaction, FastList.<Future>newListWith(voidFuture), FastList.<JmsTopic>newList()); Message messageRecvd = incomingTopic.receive(100); assertEquals("msg1", JmsUtil.getMessageBodyAsString(messageRecvd)); assertEquals("World", messageRecvd.getStringProperty("Hello")); }
Example 9
Source File: OutgoingAsyncTopicTest.java From reladomo with Apache License 2.0 | 5 votes |
@Test public void testSendSetsPropertiesAsync() throws NamingException, JMSException, RollbackException, RestartTopicException, XAException { mithraTransaction = topicResourcesWithTransactionXid.startTransaction(); UnifiedMap<String, Object> msgProperties = UnifiedMap.<String, Object>newMap(); msgProperties.put("Hello", "World"); Future<Void> voidFuture = asyncOutTopic.asyncSendMessages(FastList.newListWith("msg1".getBytes()), msgProperties); topicResourcesWithTransactionXid.commit(mithraTransaction, FastList.<Future>newListWith(voidFuture), FastList.<JmsTopic>newList()); Message messageRecvd = incomingTopic.receive(100); assertEquals("msg1", JmsUtil.getMessageBodyAsString(messageRecvd)); assertEquals("World", messageRecvd.getStringProperty("Hello")); }
Example 10
Source File: ReladomoDeserializer.java From reladomo with Apache License 2.0 | 5 votes |
protected void storeRelated(RelatedFinder relatedFinder, Object related) { if (this.partialRelationships == EMPTY_MAP) { this.partialRelationships = UnifiedMap.newMap(); } this.partialRelationships.put(((AbstractRelatedFinder)relatedFinder).getRelationshipName(), related); }
Example 11
Source File: SqlQuery.java From reladomo with Apache License 2.0 | 5 votes |
public void addDerivedColumnSubstitution(String fullyQualifiedColumn, String derivedColumnName, WhereClause whereClause) { if (this.derivedColumnSubstitutionMap == null) { this.derivedColumnSubstitutionMap = UnifiedMap.newMap(); } if (!this.derivedColumnSubstitutionMap.containsKey(fullyQualifiedColumn)) { this.derivedColumnSubstitutionMap.put(fullyQualifiedColumn, derivedColumnName); } whereClause.addReachableColumn(fullyQualifiedColumn); }
Example 12
Source File: SimpleToOneDeepFetchStrategy.java From reladomo with Apache License 2.0 | 5 votes |
protected List populateQueryCache(List immediateParentList, List resultList, CachedQueryPair baseQuery) { HashMap<Operation, List> opToListMap = new HashMap<Operation, List>(); UnifiedMap<Operation, Object> opToParentMap = UnifiedMap.newMap(); populateOpToListMapWithEmptyList(immediateParentList, opToListMap, opToParentMap); int doNotCacheCount = associateResultsWithOps(resultList, opToListMap, 1, opToParentMap); clearLeftOverObjectCache(opToParentMap); return cacheResults(opToListMap, doNotCacheCount, baseQuery); }
Example 13
Source File: MithraNotificationEventManagerImpl.java From reladomo with Apache License 2.0 | 5 votes |
public synchronized Map<String, List<MithraNotificationEvent>> getNotificationsToSend() { Map<String, List<MithraNotificationEvent>> result = mithraNoTxNotificationEvents; if (result.isEmpty()) { result = Collections.EMPTY_MAP; } else { mithraNoTxNotificationEvents = UnifiedMap.newMap(); } return result; }
Example 14
Source File: IterateThroughHashMapTest.java From java_in_examples with Apache License 2.0 | 5 votes |
@TearDown(Level.Iteration) public void tearDown() { map = new HashMap<>(size); iterableMap = new HashedMap<>(size); mutableMap = UnifiedMap.newMap(size); for (int i = 0; i < size; i++) { map.put(i, i); mutableMap.put(i, i); iterableMap.put(i, i); } }
Example 15
Source File: DbExtractor.java From reladomo with Apache License 2.0 | 4 votes |
public void addClassAndRelatedToFile(RelatedFinder finder, Operation op, List<DeepRelationshipAttribute> deepFetchAttributes) throws IOException { Map<RelatedFinder, List<MithraDataObject>> map = UnifiedMap.newMap(); this.addClassAndRelatedToMap(finder, op, deepFetchAttributes, map); this.addDataByFinder(map); }
Example 16
Source File: FastListMultimap2.java From alibaba-rsocket-broker with Apache License 2.0 | 4 votes |
@Override protected MutableMap<K, MutableList<V>> createMap() { return UnifiedMap.newMap(); }
Example 17
Source File: FeatureVectorsPartition.java From oryx with Apache License 2.0 | 4 votes |
public FeatureVectorsPartition() { vectors = UnifiedMap.newMap(); recentIDs = UnifiedSet.newSet(); lock = new AutoReadWriteLock(); }
Example 18
Source File: AsOfEqualityChecker.java From reladomo with Apache License 2.0 | 4 votes |
public UnifiedMap<MapperStackImpl, MapperStackImpl> getMsiPool() { if (msiPool == null) msiPool = UnifiedMap.newMap(); return msiPool; }
Example 19
Source File: AsOfEqualityChecker.java From reladomo with Apache License 2.0 | 4 votes |
private UnifiedMap<ObjectWithMapperStack<? extends TemporalAttribute>, ObjectWithMapperStack<AsOfOperation>> getAsOfOperationMap() { if (asOfOperationMap == null) asOfOperationMap = UnifiedMap.newMap(3); return asOfOperationMap; }
Example 20
Source File: AsOfEqualityChecker.java From reladomo with Apache License 2.0 | 4 votes |
private UnifiedMap<ObjectWithMapperStack<? extends TemporalAttribute>, InternalList> getEqualityAsOfOperationMap() { if (equalityAsOfOperationMap == null) equalityAsOfOperationMap = UnifiedMap.newMap(3); return equalityAsOfOperationMap; }