java - Writing a synchronized thread-safety wrapper for NavigableMap -


Presently provide the following utility methods to create a synchronize wrapper for various archive interfaces:

  • Conformity In, it also has 6 unmodifiedXXX overloads.

    Here are the utility methods for clear defaults. It is true that it extends indexed map , but this does increase the sort set , And sets the archive extension , and archive sorted sets and set dedicated utility methods. Probably naviglame is a useful abstraction, or it does not happen in the first place, and yet there are no utility methods for it.

    Then there are questions:

    • Do not provide utility methods for archive naviglame ?
    • How do you synchronize write for wrapper?
      • It seems that this is just a "mechanical" process
        • is it true that in general you can add the synchronize thread-safety feature like this Are you
        • If it is such a mechanical process, can it be automated? (Eclipse plug-ins, etc.)
        • Is this code repetition required, or can a different OOP design pattern be avoided?

    There was an inspection. Josh writes:

    "They are definitely there, their absence is unknowingly.
    We should keep them as soon as possible."

    I agree, even though any of us are looking forward to all the psychic forwarding methods that are writing (and testing) any of the engineers. Date of post: 2006-08-21 00: 50: 41.0

    This takes time.

    Update : To apply it manually, you may consider hijacking the java.util package because you Fixed class synchronized startmap & lt; K, V> , the package has been declared private, otherwise it is going to copy many code. Here's a kickoff:

      package java.util; Import java.util.Collections.SynchronizedSortedMap; Public Square Neculation {Public Stabilized & lt; K, V> NavigableMap & lt; K, V> Synchronized map (naviglame & lt; K, V & gt; m) {new synchronized naviglame & lt; K, V> (M); } Fixed class synchronized newborns & lt; K, V> Synchronized Started Map & lt; K, V> NavigableMap & lt; K, V> Applies {Private Final Navigational Map & lt; K, V> SM; Synchronized Navigation Map (naviglalm & lt; K, V & gt; m) {super (m); Sm = m; } Synchronized Navigation Map (naviglame & lt; K, V & gt; m, object mutes) {super (M, mutes); Sm = m; }}  

    Automatically automate the unformed methods of IDE itself to naviglame and configure them as code in the same way as synchronizes Here is an example:

      @ Override public key roof (key) {synchronize (mute x) {return sm.ceilingKey (key); }}  

    Note that for example sets , you will also need to wrap it in SynchronizedSet again, Synchronized map and synchronized sourcemaps view the sources of insights):

    I do not expect that this is a mechanical process, it includes many factors .


    Comments