hashmap « Development « Java Thread Q&A

Home
Java Thread Q&A
1.concurrency
2.Development
3.Exception
4.Notify
5.Operation
6.Socket
7.State
8.synchronize
9.Thread Safe
10.ThreadPool
Java Thread Q&A » Development » hashmap 

1. Is there a parallel processing implementation of HashMap available to Java? Is it even possible?    stackoverflow.com

Searching for the magic ParallelHashMap class

More succinctly, can you use multiple threads to speed up HashMap lookups? Are there any implementations out there that do this already? In my project, we need ...

2. concurrentmodificationexception hashmap in java    stackoverflow.com

I write following code but when this run it generate concurrentmodificationexception

if( attendancePolicy.getType().equals( AttendanceConstants.EMPLOYEE_ATTENDANCE_POLICY ) ) {
    synchronized( attendancePolicy.getListEmployee() ) {
        for( ...

3. Java: multi-threaded maps: how do the implementations compare?    stackoverflow.com

I'm looking for a good hash map implementation. Specifically, one that's good for creating a large number of maps, most of them small. So memory is an issue. It should be ...

4. Need help with hashMap with expiry time constraints    stackoverflow.com

I need a thread-safe Map with a time limited expiry policy. I tried looking for an existing library, but could not find one. Jboss cache is going to be a heavy ...

5. Hashtable vs HashMap performance in single threaded app    stackoverflow.com

I know that Hashtable is synchronized so it is safe to be used in multithread app and HashMap is not. I am wondering if there is any ...

6. Getting ConcurrentModificationException while modifying a HashMap in a thread class    stackoverflow.com

Hi I am running a thread service, the job of this thread is to check the age of a list items in a HashMap. When an item is older than ...

7. Scalability issue with HashMap in Multithreaded Multicore system    stackoverflow.com

I am facing scalability issue while reading data from hashmap. My machine has 32 core with 2 hyper thread per core (so total 64 cpus) and 64 GB RAM. When ...

8. Hashtable vs. HashMap    coderanch.com

I have a caching structure in a servlet currently implemented with a Hashtable and I'm wondering if I can convert it to a HashMap for efficiency. The hash contains string arrays and corresponds to data in my database. I preload the hash in the servlet init() method and I have a background thread that updates the cache every six hours -- ...

9. Hashtable with Vectors or HashMap with ArrayLists - please help    coderanch.com

Hi all, My application will be run under a mutilthreaded environ. I have a job queue represented as a Hashtable. Each key in hashtable contains a vector as its corresponding value. This is done to bring about one-2-many relations between key & values in the hashtable. For eg: class test { Map jobQueue; public test() { this.jobQueue = new Hashtable(); this.jobQueue.put(new ...

10. hashmap for multiple threads    coderanch.com

I'm sure this has been posted before on this list. I have an application where there is a common data structure being shared by multiple threads (say A), which are updating this data structure. Another single thread (B), which is iterating over the entries and taking an action on each entry. (Not updating the data structure). For this application, After going ...

11. Update and access HashMap    coderanch.com

public class MyData { // volatile so that threads are forced to r & w the memory copy private volatile Map data; public void update() { Map newData = new HashMap(data); // update newData with the new data // ... // now make the new data visible data = Collections.unmodifiableMap(newData); } public Map getData() { return data; } }

12. Multiple threads and HashMap    coderanch.com

You shouldn't be trying to figure out the limits of the damage, either it is thread safe or it isn't. Using a collection that is not thread safe with multiple threads because you are will to accept certain data inconsistencies is not a good idea. However, in this case, the HashMap class does document the extent that you are allowed to ...

13. Using HashMap vs Hastable    coderanch.com

14. Synchronzing a HashMap on the same HashMap object    coderanch.com

This is what the docs say about HashMaps reg synchronization If multiple threads access this map concurrently, and at least one of the threads modifies the map structurally, it must be synchronized externally. (A structural modification is any operation that adds or deletes one or more mappings; merely changing the value associated with a key that an instance already contains is ...

15. Hashtable or HashMap    coderanch.com

Your problem doesn't sound like a Hashtable vs HashMap issue. As a previous poster said if you are having performance problems it surely doesn't have to do with that choice. you need to measure your codes performance and find out where the real bottleneck is. Random Micro-tunings such as this are almost always a waste of time. Your issue is probably ...

17. Can we Serialize a HashMap object in a Thread    coderanch.com

import java.io.*; import java.util.*; public class DeSerThread implements Runnable { Map myMap; public Map getMyMap() { return myMap; } public void run(){ try { FileInputStream fi = new FileInputStream("cde.tmp"); ObjectInputStream si = new ObjectInputStream(fi); myMap = (HashMap) si.readObject(); si.close(); System.out.println("done with run"); } catch (Exception e) { e.printStackTrace(); } } } and import java.io.*; import java.util.*; public class SerThread implements Runnable ...

18. Hung threads caused by HashMap in dom4j?    coderanch.com

Hi, we are using dom4j for creating the XML request and making a http post call to external client, but since few weeks we are experiencing hung threads issue and when i got the thread dump, this is what i see and lot of them . Is this a known issue ? or am i missing something ? Any help whould ...

19. Reading and writing to a Hashmap from other threads. Not sure how syncronizing works.    coderanch.com

(PLEASE answer in "little java words" for I am learning.

20. Would writing my ownlock routines for hashmap and queue reads and writes be a better solution to syn    coderanch.com

If I were to create my own locking methods for a hashmap and queue woutl that be a safer way to handle multiple threads reading and writing to the hashmap in my main thread. example below. then I can use my calls to lock in all my hashmap reads and writes. also, I have a thread that will be walking the ...

21. accessing threads from a hashmap    forums.oracle.com

We also have a hashmap that supposed to store each writer thread so that whenever a message is sent to the server it gets outputted to each client by its writer thread(Like a chat room). The problem is I'm not to sure how to take the message given to the sever and output it through the writer threads. Heres the hashmap ...

22. ConcurrentModificationException when removing from hashmap    forums.oracle.com

Think of a Map as a set of (key, value) entries. Removing a key from a map's key set removes the entire entry from the map's set of entries. The alternative doesn't make any sense, does it: you remove the key from the map, but the value still somehow floats around inside the map?

23. Using Threads with a HashMap    forums.oracle.com

Hi I have a hashmap containing a series of objects. I need to perform calculations on these objects and write the updaste versions back into the hash map and time how long the calculations taker. Does anyone know how I can do this using threading? I would like the thread to become active every few seconds, calculate and write back to ...

24. Threads and HashMap    forums.oracle.com

This code is not thread-safe. I'm guessing this why you think notifyAll is not working. I'll break it down for you: - You have one shared HashMap - You have 5 threads - You have 5 instances of ModiMap, one for each thread - Each ModiMap only synchronizes on itself (synchronized member method) - While Thread A (and ModiMap-A) is modifying ...

25. Sharing a data Structure(HashMap) across multiple threads    forums.oracle.com

It simply finds out the last modified time of each folder(based on last modified time of any of the files within its subfolders, directory depth may vary tremendously, in some cases it exceeded Windows MAXPATH of 260 chars) and size of specific subfolders within the folder. Well do you know any technique to uniformly distribute threads across the disks in server? ...

java2s.com  | Contact Us | Privacy Policy
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.