I am expanding the library to do some work for me. Here is the code:
public static synchronized String decompile(String source, int flags,UintMap properties,Map<String,String> namesMap) { Decompiler.namesMap=namesMap; String decompiled=decompile(source,flags,properties); Decompiler.namesMap=null; return decompiled; }
The problem is that it namesMapis a static variable. Is this thread safe or not? Because if this code is executed with confidence, the namesMap variable may change. What can I do for this?
namesMap
decompile ( ), - , , namesMap, , : , decompile, , , decompile, .: -)
decompile
java.util.concurrent (, ConcurrentHashMap), , - , .
java.util.concurrent
ConcurrentHashMap
( .) namesMap decompile, - ( ..), . , , , , .
, namesMap, decompile(String, int, UintMap, Map), , , .
decompile(String, int, UintMap, Map)
Decompiler.namesMap= new HashMap<String, String>(namesMap);
, , , , , decompile() namesMap .
decompile()
In fact, Decompiler.namesMap=namesMap; this is the only place to install namesMap
Decompiler.namesMap=namesMap;
But nowhere in the code does changeMap change. Just read ...
I want to
String decompiled=decompile(source,flags,properties);
will use the same Map names.
There will be only one name map, so you don’t have to worry if it will use the same Map names. It would be.
Source: https://habr.com/ru/post/1741965/More articles:how to create a one-dimensional dynamic array in c #? - arraysУзнайте, сколько хранения занимает строка в базе данных - sql-server-2008Extract external query string / javascript binding value: file.js # foo = bar - javascripthow to work in the background - javaflexible support for REST methods - flexIs Rails 3 a "_method = PUT" that should still work? - flexSecrets of delivering large sizes to large sizes? - .netFlash Player 9 против Flash Player 10 с FLEX 3,? _method = PUT/DELETE не работает? - restAndroid: How would you press the Button buttons for a period? - androidA call to DataSource.getConnection does not return the expected connection - javaAll Articles