Map in map syncronization

Hi guys! I'm new to threads so sorry if my question is dumb.
So here it goes: I was wondering if read/writes from something like this: ConcurrentHashMap<String,ConcurrentHashMap<Integer,ConcurrentHashMap<String,Object>>> are thread safe?
ConcurrentHashMap offers thread safety without locking wich is preatty cool but i don't think that combining more of them keeps is right. What do you think?
Thank you!
Cristian

cvrabie wrote:
ConcurrentHashMap offers thread safety without locking wich is preatty cool but i don't think that combining more of them keeps is right. What do you think?
Thank you!
CristianWell, it seems not quite true: there is locking in case of concurrent collection classes, but it is implemented in a different way that the one in case of synchronized collection classes. Here is an excerpt from Brian Goetz "Java Concurrency in Practice " book (section "5.2.1. ConcurrentHashMap"):
"...ConcurrentHashMap is a hash-based Map like HashMap, but it uses an *entirely different locking strategy* that offers better concurrency and scalability. *Instead of synchronizing every method on a common lock*, restricting access to a single thread at a time, *it uses a finer-grained locking mechanism called lock striping* (see Section 11.4.3) to allow a greater degree of shared access..."
And, btw, this is the reason why concurrent collections are not only "don't throw ConcurrentModificationException", but "not even able" to throw them.

Similar Messages

  • What is the diffrence between  map and map.entry in core java

    what is the diffrence between map and map.entry in core java . where it will be use ful. any one give one example plz.

    A Map contains Map.Entry's
    e.g.
            Map map = new LinkedHashMap(8);
            map.put(new Integer(1), "one");
            map.put(new Integer(2), "two");
            final Iterator iterator = map.entrySet().iterator();
            while (iterator.hasNext()) {
                Map.Entry entry = (Map.Entry) iterator.next();
                System.out.println("key=" + entry.getKey() + ", value=" + entry.getValue());
            }

  • XSLT MAPPING/JAVA MAPPING

    Hi All,
       After faceing so much of problem, i found that it would be better if i can go for an XSLT/java mapping:
    1. It is adding an extra <b>ns0</b> to header line & end line which i dont want to be generated in the output xml file.
    2. Namespace problem that basically sticking to 60 but i want 72 characters in my target xml file.
    3. No carriage return at the end of each line which is not geting generated through graphical mapping.
    Now i have an XSD provided by the client. So how can i use that and which mapping should best suits to solve all these problem.
    Should i go for a java mapping or an XSLT/JAVA mapping.
    I dont have any idea on both of them, So can you people send me the details for it.
    Many Thanks & Best Regards,
    JGD.

    Hi,
    Based on the requirement and size we can choose the mapping.
    If java is suitable to our requirement then we go for java.
    If XSLT is suitable to our requirement then we go for XSLT.
    Performance wise(high --> low) :
    If data is less then
    Graphical mapping -
    > Java(sax parser)mapping -
    > Java(dom parser)mapping -
    > XSLT mapping -
    > ABAP mapping.
    If data is high then
    XSLT mapping -
    > Java(sax parser)mapping -
    > Graphical mapping(internally it uses SAX)----> Java(dom parser)mapping -
    > ABAP mapping.
    If you choose XSLT then you can select Altova Map Force tool then no need to  write the XSLT code here, it will automatically generates the code.
    N:1  XSLT Mapping
    https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/30ac53f2-21d7-2a10-afa2-ce1a0577ca18
    XSLT mapping https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/006aa890-0201-0010-1eb1-afc5cbae3f15

  • How do I display a map in map view?

    How do I display a "map" in map view?

    You can't.  The mapping was provided by Yahoo!, which discontinued the service.
    Ken

  • How to import a Google Map API Map in Adobe Muse

    Hello,
    I'm trying to import on Adobe Muse a Google Maps custom map that I have created with the API google maps... But I have problems with writing the HTML code...
    I tried to import that one for exemple:
    https://developers.google.com/maps/documentation/javascript/examples/map-simple?hl=fr
    But nothing happens in Adobe Muse... just a blue square with "html" written on the left top of the square...
    Thanks for the help!

    Hi!
    You have to create to go to "insert html code" in the Muse menu.
    Then follow the steps in these websites, some are in french...sorry about that! but It's not difficult to understand, or use google translate.
    http://www.html5-css3.fr/html5/tutoriel-api-google-maps-geolocalisation-html5
    https://developers.google.com/maps/documentation/javascript/examples/map-simple?hl=fr
    http://gmaps-samples-v3.googlecode.com/svn/trunk/styledmaps/wizard/index.html ==> for creating the customized map
    http://www.code-web.org/post/2010/03/04/Google-Map-API-V3-%3A-Placer-un-marker-sur-la-cart e ==> for customized markers
    https://developers.google.com/maps/documentation/javascript/examples/map-geolocation?hl=fr &csw=1
    https://developers.google.com/maps/documentation/javascript/tutorial?hl=fr
    http://www.lafermeduweb.net/tutorial/mettre-en-place-la-google-maps-personnalisee-sur-ses- pages-web-p105.html
    Hope this will help!

  • Help me please : Serious problems with collection-mapping, list-mapping and map-mappi

    Hi everybody;
    I have serious problems with list-mapping, collection-mapping and map-mapping.
    Acording to specifications and requirements in a system I am working on it is needed to
    get a "list" of values or an indivudual value.I am working with ORACLE 9i Database,
    ORACLE 9i AS and ORACLE 9i JDEVELOPER.
    I tried to map a master-detail relationship in an entity-bean, using list-mapping.
    And this was very useful in order to get a "list" of details, ...but, when I wanted
    to get a single value I have some problems with persistence, something about "saving a state"
    despite I just want to get the value of a single detail.
    I decided to change it to map-mapping and the problem related with a single detail
    worked successfully, but I can get access to the whole bunch of details.
    May anyone of you help me with that?
    I am very confused I do not know what to do.
    Have any of you a solution for that problem?
    Thank you very much.

    Have you tried a restore in iTunes?

  • Value mapping, interface mapping, standard funtions and user defined functi

    I like have more information abt live scenario's use of value mapping, interface mapping, standard funtions and user defined functions.
    How to create user defined funtions and how to use it in XI?
    thanks in advance
    shiva

    Hi,
    Interface mappings register your mapping program for an interface pair in the Integration Repository. If you require a mapping at runtime, it is sufficient to select the interface mapping for the interface pair at configuration time .The Integration Server uses the interface mapping to identify associated mapping programs for request messages, response messages, fault messages, or all three.
    Features
    Executing Multiple Mapping Programs for One DirectionBy using an interface mapping you can execute multiple mapping programs consecutively for the transformation of a request or response message. In such cases, an interface mapping comprises multiple steps for which the following applies:
    &#9679;     The steps are executed in the sequence specified (from top to bottom). The result of the mapping program from the previous step is forwarded to the mapping program of the subsequent step.
    &#9679;     Each step can reference a mapping program that executes a 1:1, 1:n, n:1, or an m:n transformation. In the case of multi-mappings (1:n, n:1, or m:n), the previous step must create the same number of messages that the subsequent step expects.
    &#9679;     Multi-mappings use one envelope to put all messages in one structure. If one of the steps references a multi-mapping program, all subsequent steps must use the same envelope.
    The mapping for a request message comprises two message mapping programs: one 1:1 transformation and one 1:n transformation. Since the latter message mapping uses the multi-mapping envelope for both the target message and the source message, the message mapping for the 1:1 transformation must also create a transformation result with a multi-mapping envelope.
    You do not strictly need to divide up one direction of the whole mapping into different steps. However, this enables all the message formats in one system landscape to be mapped to a central message format, for example. This results in less mapping programs being required because you no longer need to be able to map all the different message formats to each other
    Activities
           1.      Create a message mapping on the design maintenance screen of the Integration Builder (see also: Creating an Object).
    You can also create multiple interface mappings for the same interface pair.
           2.      Enter the source and target interfaces that require a mapping of the request message, the response message, the fault message, or all three, in the table of the same name. The following restrictions apply:
    &#9675;     If you want to use the interface mapping in a transformation step in an integration process, you must only specify abstract message interfaces. Furthermore, all objects (integration process, interface mapping, and all objects that reference the interface mapping) must be in the same software component version. If you want to reference objects from underlying software component versions, you must access the objects from the Basis Objects branch (in the navigation tree or using an input help).
    &#9675;     If you want to map multiple messages to each other by using a multi-mapping, you can only specify asynchronous interfaces (for further restrictions, see: Multi-Mappings). If any message interfaces are missing, you can also create them by using the function Create New Object ().
    If the interface cannot be imported or cannot be created in the Integration Repository (in the case of an external adapter, for example), you must enter the interface names manually. However, it is not possible to check the technical name in this case.
           3.      To import the properties of the interfaces, choose Read Interfaces. The table in the lower area displays tab pages for the request message, response message, and if available, for the fault message, for each mode of the interfaces (either synchronous or asynchronous).
           4.      To develop an external mapping program, export the XSD schema of the respective request or response message as a zip file after you have imported the interfaces. The zip file can contain multiple schema files that reference each other, for example in a multi-mapping. In this case, the schema with the global message element has the name MainSchema.
           5.      To reference a mapping program for the respective message, you have the following options:
    &#9675;     Select an existing mapping program from the Integration Repository by using the input help (). If this is a message mapping, the default setting of the input help only displays those message mappings that are found using the source and target message in the Integration Repository (in multi-mappings, the first source and target messages are used as the search criteria). However, you can also display any number of message mappings, for example, because you are constructing a mapping from several mapping programs with intermediate instances which have no message types.
    &#9675;     You can create message mappings directly from the interface mapping. To do this, select the mapping type Message Mapping in the Type column. Position the cursor in the Name column and choose the function Create New Message Mapping () in the Mapping Program frame. The Integration Builder copies the specifications of the messages and their occurrence directly from the interface mapping.
    An interface mapping can only reference mapping programs that belong to the same or an underlying software component version of the interface mapping. This ensures that the mapping program can be shipped together with the interface mapping (see: Software Logistics).
           6.      If it is not a mapping for a fault message, you can execute multiple mapping programs in succession for request and response messages:
    &#9675;     To insert an additional line for a mapping program, choose .
    &#9675;     To delete the registration for a mapping program, choose .
    At runtime, the mapping programs are executed from top to bottom.
           7.      Save the interface mapping.
    Regards
    Aashish Sinha
    PS : reward points if helpful

  • I have a question - Does Oracle BI in cloud has visualisation like Heat map, tree map , spatial map ? In general what are the additional visualisation as compared to OBIEE if any , thanks

    I have a question - Does Oracle BI in cloud has visualisation like Heat map, tree map , spatial map ? In general what are the additional visualisation as compared to OBIEE if any , thanks

    I have a question - Does Oracle BI in cloud has visualisation like Heat map, tree map , spatial map ? In general what are the additional visualisation as compared to OBIEE if any , thanks

  • How to define map of maps?

    Hello,
    i want to do something like that in pl/sql:
    TYPE map_type
       IS
          TABLE OF NUMBER
             INDEX BY VARCHAR2 (1);
       --    map: 1 -> 'a'
       --         2 -> 'b'
       --         11 -> 'A'
       --         22 -> 'B'
       TYPE map_of_map_type
       IS
          TABLE OF map_type%TYPE
             INDEX BY VARCHAR (15);
       --          map: 'onedigit' -> { {1 -> 'a'}, {2 -> 'b'} }
       --               'twodigit' -> { {11 -> 'A'}, {22 -> 'B'} } Is something like that possible?
    Thanks!

    And to illustrate how you work with two dimensional associative array:
    SET SERVEROUTPUT ON FORMAT WRAPPED
    DECLARE
        TYPE map_type
          IS
            TABLE OF NUMBER
              INDEX BY VARCHAR2(1);
        TYPE map_of_map_type
          IS
            TABLE OF map_type
              INDEX BY VARCHAR(15);
        v_map1 map_type;
        v_map2 map_type;
        v_map_of_maps map_of_map_type;
        v_idx1 varchar2(10);
        v_idx2 varchar2(1);
    BEGIN
        v_map1('a') := 1;
        v_map1('b') := 2;
        v_map2('A') := 11;
        v_map2('B') := 22;
        v_map_of_maps('onedigit') := v_map1;
        v_map_of_maps('twodigit') := v_map2;
        v_idx1 := v_map_of_maps.FIRST;
        FOR i IN 1..v_map_of_maps.COUNT LOOP
          DBMS_OUTPUT.PUT_LINE('Map of maps: ' || v_idx1);
          v_idx2 := v_map_of_maps(v_idx1).FIRST;
          FOR j IN 1..v_map_of_maps(v_idx1).COUNT LOOP
            DBMS_OUTPUT.PUT_LINE('     Map: ' || v_idx2 || ' = ' || v_map_of_maps(v_idx1)(v_idx2));
            v_idx2 := v_map_of_maps(v_idx1).NEXT(v_idx2);
          END LOOP;
          v_idx1 := v_map_of_maps.NEXT(v_idx1);
        END LOOP;
    END;
    Map of maps: onedigit
         Map: a = 1
         Map: b = 2
    Map of maps: twodigit
         Map: A = 11
         Map: B = 22
    PL/SQL procedure successfully completed.
    SQL> SY.

  • JPA2 Question: Is it possible to map a Map(enum, List String ) in JPA2?

    Is it possible to map a Map(enum, List<String>) in JPA2? Or do I have to create a separate Entity class that maps each List<String> collections for each possible value in the enum?
    Edited by: user7976113 on Jan 22, 2010 7:51 PM
    Edited by: user7976113 on Jan 22, 2010 7:51 PM

    No, JPA does not support this or any nested collection type of mappings directly.
    The best solution is to create an Entity or Embeddable to contain the collection data.
    See,
    http://en.wikibooks.org/wiki/Java_Persistence/Relationships#Nested_Collections.2C_Maps_and_Matrices
    James : http://www.eclipselink.org

  • Clearing memory map of maps?

    Hi I have the following Class:
    public class TestClass{
    Map<String, Map<String, String>> aMap = new TreeMap<String, Map<String, String>>();
    public void addStuff () {
    //this adds things to aMap
    public void clearMap() {
    aMap = new TreeMap<String, Map<String, String>>();
    Does my clearMap method make all memory used by this map ava. for garbage collection? What is the proper way to clear all memory to reset the aMap variable? Thanks.

    user12374594 wrote:
    What is the proper way to clear all memory to reset the aMap variable?There is no one proper way to clear it. You can do what you're doing, or you can simply call aMap.clear(). The only significant difference is whatever it means in terms of your class's semantics whether you have a completely new map or the original map with nothing in it.
    However, one doesn't generally think in terms of "clearing memory" in Java. You hang on to a reference as long as you need to use it for your code to do its job, and when you no longer need it, you let the reference go. GC takes care of the rest, and it's not often that you have to even think about it.

  • Using APEX to create a navigation application using Oracle Maps/Google Maps

    Hi Guys,
    Does anyone know if there are any tutorials out there which would show me the basis to create a navigation application with Oracle Maps/Google Maps in APEX?
    I have found tutorials that show me how to get the map onto APEX and to view it but I cant find anything else that would give me a more in-depth tutorial
    Thanks in advance for your help
    -Mark

    Hi,
    I hope that this link might help
    http://www.oracle.com/technetwork/developer-tools/apex/integration-086636.html#GOOGLE
    Br,Jari

  • Use of Orders05 Interface mapping & XSLT mapping file for Orders03 IDOC

    Hello Experts,
    In a scenario we are sending Purchase orders and Purhase Order change from SAP to SNC through XI.
    Currently Orders03 IDoc is used and standard mapping for Orders03 XSLT is used.
    Now the requirement is to use the same IDOC (Orders03) but
    - XSLT mapping (OrdersOrders05_ReplenishmentOrderNotification) and
    - Interface Mapping (OrdersOrders05_ReplenishmentOrderNotification_01) of Orders05.
    What changes would be necessary
    - On SAP side,
    - in the XSLT mapping, and
    - On XI side.
    Thanks in advance,
    Suraj

    Hi Suraj,
    First compare ORDERS03 IDOC and ORDERS05 IDoc structures,if both structures are same then u no ned to chnage the XSL it will work fine.
    If any chnages in ORDERS05 Idoc then u have to adjust XSLT as per ORDERS05 IDOC.
    test interface mapping first and let me know if any error.
    Regards,
    Raj

  • Java Mapping, XSLT Mapping, ABAP Mapping

    Hi Experts,
                     Could any one explain what is the main features of the following Mapping. How to pick the mapping?
    Java Mapping - When to use and what is the advantage.
    ABAP Mapping - When to use and what is the advantage.
    XSLT Mapping - When to use and what is the advantage.
    Graphical Mapping - When to use and what is the advantage.
    cheers,
    Sunee

    There are 4 types of mapping in XI
    1. Graphical Mapping
    2. XSLT Mapping
    3. JAVA Mapping
    4. ABAP Mapping
    When to use Message mapping
    1 When the logic for your mapping is simple and straight forward, you can use
    Advantages of message mapping
    1)Easy to use.
    2) has GUI drag and drop.
    3) used for simple mapping cases
    4) it does not involve any complex logic
    Disadvantages of message mapping
    1)has limitation in terms of complex hierarchy
    When to use Java mapping
    1) Java mapping are used when graphical mapping cannot help you.
    Advantages of Java Mapping
    1)you can use Java APIs and Classes in it.
    2) file look up or a DB lookup is possible
    3) DOM is easier to use with lots of classes to help you create nodes and elements.
    Disadvantages of Java mapping
    1)SAX parser is not easy to develop
    2)DOM parser is intensive
    3) Java knowledge is required
    4) bit complexer
    XSLT Mapping - When to use
    1)When the required output is other than XML like Text, Html or XHTML (html displayed as XML )
    2)When default namespace coming from graphical mapping is not required or is to be changed as per requirements.
    3)When data is to be filtered based on certain fields (considering File as source)
    4)When data is to be sorted based on certain field (considering File as source)
    5)When data is to be grouped based on certain field (considering File as source)
    Advantages of using XSLT mapping
    1)XSLT program itself defines its own target structure.
    2)XSLT programs can be imported into SAP XI. Message mapping step can be avoided. One can directly go for interface mapping once message interfaces are created and mapping is imported.
    3)XSLT provides use of number of standard XPath functions that can replaces graphical mapping involving user defined java functions easily.
    4)File content conversion at receiver side can be avoided in case of text or html output.
    5)Multiple occurrences of node within tree (source XML) can be handled easily.
    6)XSLT can be used in combination with graphical mapping.
    7)Multi-mapping is also possible using xslt.
    8)XSLT can be used with ABAP and JAVA Extensions
    Disadvantages of using XSLT mapping
    1)Resultant XML payload can not be viewed in SXMB_MONI if not in XML format (for service packs < SP14).
    2)Interface mapping testing does not show proper error description. So errors in XSLT programs are difficult to trace in XI but can be easily identified outside XI using browser.
    3)XSLT mapping requires more memory than mapping classes generated in Java.
    4)XSLT program become lengthier as source structure fields grows in numbers.
    5)XSLT program sometimes become complex to meet desired functionality.
    6)Some XSL functions are dependent on version of browser.
    Advantages of Abap Mapping
    1) A person comfortable with OOABAP can go for ABAP mapping instead.
    Disadvantages of Abap Mapping
    1) Abap knowledge is required
    2) bit compexer
    For further info on each of the mapping, refer to these links,
    Graphical Mapping,
    http://help.sap.com/saphelp_nw04/helpdata/en/6d/aadd3e6ecb1f39e10000000a114084/content.htm
    http://help.sap.com/saphelp_nw04/helpdata/en/43/c4cdfc334824478090739c04c4a249/content.htm
    XSLT Mapping
    http://help.sap.com/saphelp_nw04/helpdata/en/73/f61eea1741453eb8f794e150067930/content.htm
    http://www.w3.org/TR/xslt20/
    Java Mapping
    http://help.sap.com/saphelp_nw04/helpdata/en/e2/e13fcd80fe47768df001a558ed10b6/content.htm
    DOM parser API
    http://java.sun.com/j2se/1.4.2/docs/api/org/w3c/dom/package-frame.html
    Check this blog on Mapping:
    /people/ravikumar.allampallam/blog/2005/02/10/different-types-of-mapping-in-xi
    Also, check this thread for more info,
    Different types of Mapping in XI

  • Any way to work with multiple layers once map is mapped to a sphere?

    I'm working on a history documentary about World War II and I have a map of the world divided into colonial empires. Each empire is a separate layer. I know how to take the world map and apply it to a sphere in Photoshop CS4 Extended.
    The problem is that after this all my layers disappear and I'm left with a single layer.
    I want to fade in the empires' opacity levels as the globe revolves.
    How can I do this if putting the map on the sphere collapses all the layers into one?
    Also, how do you turn off the shadow on the sphere? I want it the same level of brightness everywhere on the planet.
    Thank you very much in advance for any helpful suggestions.
    - Nick

    Hi Nick,
    I think you have figured out that if you want a texture map to contain layers, you need to either group the layers (and select the group), or just select all of them before selecting the 'New Shape From Layer>' command. The result difusse map will have a single name, but if you open it you will see that it has layers intact.
    Fading opacity or any other keyframe attribute of a texture while the 3d model is also being animated, is a new feature to CS4. You need to open the texture and animate it so you have an animated texture applied to an animated object. I have added a quick lo-fi 4 sec. sample of what I think you're trying to accomplish. I'll attach the source PSD, so you can take a look at how I set it up.
    Basically, I took your flat png file an added some layers for the country selections so I could fade them in/out. Then I animated them to fade using the layer opacity (100% keyframe at start, 0% keyframe at finish, or vied versa). I then selected all the layers and 3D> New Shape from Layer> Sphere. Now I went about animating the revolving of the sphere using 3D object position for keyframing (I went from z: -180, to 0, to +180, but you can play around with that. I'm not expert with the animation to know what works best for smooth transitions and looping if desired). The animation from the texture should 'play' at the same time as the animation of the sphere, you just need to sync the timelines when setting keyframes.
    For even lighting on the sphere, you can approach it a few ways. Your best bet in this case is to go to 3D> Render Settings... and select 'Unlit' Texture' from the Face Style pop up menu. You can also remove all the lights using the 3D panel (select a light in the top half and then click the trash can icon at the bottom), and then change the Global Ambient color to White (found in 3D panel with 'Scene' selected). You could also try adding infinite lights at all the six camera views.
    Cheers,
    steve
    joric wrote:
    The problem is that after this all my layers disappear and I'm left with a single layer.
    I want to fade in the empires' opacity levels as the globe revolves.
    How can I do this if putting the map on the sphere collapses all the layers into one?
    Also, how do you turn off the shadow on the sphere? I want it the same level of brightness everywhere on the planet.
    Thank you very much in advance for any helpful suggestions.
    - Nick

Maybe you are looking for