Plugin v2.3.2
IntelliJ IDEA 2018.3.5
Build #IU-183.5912.10, built on February 19, 2019
JRE: 1.8.0_152-release-1343-b28 amd64
JVM: OpenJDK 64-Bit Server VM by JetBrains s.r.o
OS: Linux 4.20.11-arch1-1-ARCH
cn.yiiguxing.plugin.translate.trans.TranslateException: Google Translate > Translation failed: Unknown error
at cn.yiiguxing.plugin.translate.trans.AbstractTranslator.translate(AbstractTranslator.kt:49)
at cn.yiiguxing.plugin.translate.trans.TranslateService$translate$$inlined$executeOnPooledThread$1.run(Applications.kt:169)
at com.intellij.openapi.application.impl.ApplicationImpl$1.run(ApplicationImpl.java:314)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
Caused by: com.intellij.util.io.HttpRequests$HttpStatusException: Request failed with status code 413. Status=413, Url=https://translate.google.com/translate_a/single?client=gtx&dt=t&dt=bd&dt=rm&dj=1&ie=UTF-8&oe=UTF-8&sl=auto&tl=zh-CN&hl=en&tk=445671.24126&q=%2F*%0A+++++*+Overview%3A%0A+++++*%0A+++++*+The+primary+design+goal+of+this+hash+table+is+to+maintain%0A+++++*+concurrent+readability+%28typically+method+get%28%29%2C+but+also%0A+++++*+iterators+and+related+methods%29+while+minimizing+update%0A+++++*+contention.+Secondary+goals+are+to+keep+space+consumption+about%0A+++++*+the+same+or+better+than+java.util.HashMap%2C+and+to+support+high%0A+++++*+initial+insertion+rates+on+an+empty+table+by+many+threads.%0A+++++*%0A+++++*+This+map+usually+acts+as+a+binned+%28bucketed%29+hash+table.++Each%0A+++++*+key-value+mapping+is+held+in+a+Node.++Most+nodes+are+instances%0A+++++*+of+the+basic+Node+class+with+hash%2C+key%2C+value%2C+and+next%0A+++++*+fields.+However%2C+various+subclasses+exist%3A+TreeNodes+are%0A+++++*+arranged+in+balanced+trees%2C+not+lists.++TreeBins+hold+the+roots%0A+++++*+of+sets+of+TreeNodes.+ForwardingNodes+are+placed+at+the+heads%0A+++++*+of+bins+during+resizing.+ReservationNodes+are+used+as%0A+++++*+placeholders+while+establishing+values+in+computeIfAbsent+and%0A+++++*+related+methods.++The+types+TreeBin%2C+ForwardingNode%2C+and%0A+++++*+ReservationNode+do+not+hold+normal+user+keys%2C+values%2C+or%0A+++++*+hashes%2C+and+are+readily+distinguishable+during+search+etc%0A+++++*+because+they+have+negative+hash+fields+and+null+key+and+value%0A+++++*+fields.+%28These+special+nodes+are+either+uncommon+or+transient%2C%0A+++++*+so+the+impact+of+carrying+around+some+unused+fields+is%0A+++++*+insignificant.%29%0A+++++*%0A+++++*+The+table+is+lazily+initialized+to+a+power-of-two+size+upon+the%0A+++++*+first+insertion.++Each+bin+in+the+table+normally+contains+a%0A+++++*+list+of+Nodes+%28most+often%2C+the+list+has+only+zero+or+one+Node%29.%0A+++++*+Table+accesses+require+volatile%2Fatomic+reads%2C+writes%2C+and%0A+++++*+CASes.++Because+there+is+no+other+way+to+arrange+this+without%0A+++++*+adding+further+indirections%2C+we+use+intrinsics%0A+++++*+%28sun.misc.Unsafe%29+operations.%0A+++++*%0A+++++*+We+use+the+top+%28sign%29+bit+of+Node+hash+fields+for+control%0A+++++*+purposes+--+it+is+available+anyway+because+of+addressing%0A+++++*+constraints.++Nodes+with+negative+hash+fields+are+specially%0A+++++*+handled+or+ignored+in+map+methods.%0A+++++*%0A+++++*+Insertion+%28via+put+or+its+variants%29+of+the+first+node+in+an%0A+++++*+empty+bin+is+performed+by+just+CASing+it+to+the+bin.++This+is%0A+++++*+by+far+the+most+common+case+for+put+operations+under+most%0A+++++*+key%2Fhash+distributions.++Other+update+operations+%28insert%2C%0A+++++*+delete%2C+and+replace%29+require+locks.++We+do+not+want+to+waste%0A+++++*+the+space+required+to+associate+a+distinct+lock+object+with%0A+++++*+each+bin%2C+so+instead+use+the+first+node+of+a+bin+list+itself+as%0A+++++*+a+lock.+Locking+support+for+these+locks+relies+on+builtin%0A+++++*+%22synchronized%22+monitors.%0A+++++*%0A+++++*+Using+the+first+node+of+a+list+as+a+lock+does+not+by+itself%0A+++++*+suffice+though%3A+When+a+node+is+locked%2C+any+update+must+first%0A+++++*+validate+that+it+is+still+the+first+node+after+locking+it%2C+and%0A+++++*+retry+if+not.+Because+new+nodes+are+always+appended+to+lists%2C%0A+++++*+once+a+node+is+first+in+a+bin%2C+it+remains+first+until+deleted%0A+++++*+or+the+bin+becomes+invalidated+%28upon+resizing%29.%0A+++++*%0A+++++*+The+main+disadvantage+of+per-bin+locks+is+that+other+update%0A+++++*+operations+on+other+nodes+in+a+bin+list+protected+by+the+same%0A+++++*+lock+can+stall%2C+for+example+when+user+equals%28%29+or+mapping%0A+++++*+functions+take+a+long+time.++However%2C+statistically%2C+under%0A+++++*+random+hash+codes%2C+this+is+not+a+common+problem.++Ideally%2C+the%0A+++++*+frequency+of+nodes+in+bins+follows+a+Poisson+distribution%0A+++++*+%28http%3A%2F%2Fen.wikipedia.org%2Fwiki%2FPoisson_distribution%29+with+a%0A+++++*+parameter+of+about+0.5+on+average%2C+given+the+resizing+threshold%0A+++++*+of+0.75%2C+although+with+a+large+variance+because+of+resizing%0A+++++*+granularity.+Ignoring+variance%2C+the+expected+occurrences+of%0A+++++*+list+size+k+are+%28exp%28-0.5%29+*+pow%280.5%2C+k%29+%2F+factorial%28k%29%29.+The%0A+++++*+first+values+are%3A%0A+++++*%0A+++++*+0%3A++++0.60653066%0A+++++*+1%3A++++0.30326533%0A+++++*+2%3A++++0.07581633%0A+++++*+3%3A++++0.01263606%0A+++++*+4%3A++++0.00157952%0A+++++*+5%3A++++0.00015795%0A+++++*+6%3A++++0.00001316%0A+++++*+7%3A++++0.00000094%0A+++++*+8%3A++++0.00000006%0A+++++*+more%3A+less+than+1+in+ten+million%0A+++++*%0A+++++*+Lock+contention+probability+for+two+threads+accessing+distinct%0A+++++*+elements+is+roughly+1+%2F+%288+*+%23elements%29+under+random+hashes.%0A+++++*%0A+++++*+Actual+hash+code+distributions+encountered+in+practice%0A+++++*+sometimes+deviate+significantly+from+uniform+randomness.++This%0A+++++*+includes+the+case+when+N+%3E+%281%3C%3C30%29%2C+so+some+keys+MUST+collide.%0A+++++*+Similarly+for+dumb+or+hostile+usages+in+which+multiple+keys+are%0A+++++*+designed+to+have+identical+hash+codes+or+ones+that+differs+only%0A+++++*+in+masked-out+high+bits.+So+we+use+a+secondary+strategy+that%0A+++++*+applies+when+the+number+of+nodes+in+a+bin+exceeds+a%0A+++++*+threshold.+These+TreeBins+use+a+balanced+tree+to+hold+nodes+%28a%0A+++++*+specialized+form+of+red-black+trees%29%2C+bounding+search+time+to%0A+++++*+O%28log+N%29.++Each+search+step+in+a+TreeBin+is+at+least+twice+as%0A+++++*+slow+as+in+a+regular+list%2C+but+given+that+N+cannot+exceed%0A+++++*+%281%3C%3C64%29+%28before+running+out+of+addresses%29+this+bounds+search%0A+++++*+steps%2C+lock+hold+times%2C+etc%2C+to+reasonable+constants+%28roughly%0A+++++*+100+nodes+inspected+per+operation+worst+case%29+so+long+as+keys%0A+++++*+are+Comparable+%28which+is+very+common+--+String%2C+Long%2C+etc%29.%0A+++++*+TreeBin+nodes+%28TreeNodes%29+also+maintain+the+same+%22next%22%0A+++++*+traversal+pointers+as+regular+nodes%2C+so+can+be+traversed+in%0A+++++*+iterators+in+the+same+way.%0A+++++*%0A+++++*+The+table+is+resized+when+occupancy+exceeds+a+percentage%0A+++++*+threshold+%28nominally%2C+0.75%2C+but+see+below%29.++Any+thread%0A+++++*+noticing+an+overfull+bin+may+assist+in+resizing+after+the%0A+++++*+initiating+thread+allocates+and+sets+up+the+replacement+array.%0A+++++*+However%2C+rather+than+stalling%2C+these+other+threads+may+proceed%0A+++++*+with+insertions+etc.++The+use+of+TreeBins+shields+us+from+the%0A+++++*+worst+case+effects+of+overfilling+while+resizes+are+in%0A+++++*+progress.++Resizing+proceeds+by+transferring+bins%2C+one+by+one%2C%0A+++++*+from+the+table+to+the+next+table.+However%2C+threads+claim+small%0A+++++*+blocks+of+indices+to+transfer+%28via+field+transferIndex%29+before%0A+++++*+doing+so%2C+reducing+contention.++A+generation+stamp+in+field%0A+++++*+sizeCtl+ensures+that+resizings+do+not+overlap.+Because+we+are%0A+++++*+using+power-of-two+expansion%2C+the+elements+from+each+bin+must%0A+++++*+either+stay+at+same+index%2C+or+move+with+a+power+of+two%0A+++++*+offset.+We+eliminate+unnecessary+node+creation+by+catching%0A+++++*+cases+where+old+nodes+can+be+reused+because+their+next+fields%0A+++++*+won%27t+change.++On+average%2C+only+about+one-sixth+of+them+need%0A+++++*+cloning+when+a+table+doubles.+The+nodes+they+replace+will+be%0A+++++*+garbage+collectable+as+soon+as+they+are+no+longer+referenced+by%0A+++++*+any+reader+thread+that+may+be+in+the+midst+of+concurrently%0A+++++*+traversing+table.++Upon+transfer%2C+the+old+table+bin+contains%0A+++++*+only+a+special+forwarding+node+%28with+hash+field+%22MOVED%22%29+that%0A+++++*+contains+the+next+table+as+its+key.+On+encountering+a%0A+++++*+forwarding+node%2C+access+and+update+operations+restart%2C+using%0A+++++*+the+new+table.%0A+++++*%0A+++++*+Each+bin+transfer+requires+its+bin+lock%2C+which+can+stall%0A+++++*+waiting+for+locks+while+resizing.+However%2C+because+other%0A+++++*+threads+can+join+in+and+help+resize+rather+than+contend+for%0A+++++*+locks%2C+average+aggregate+waits+become+shorter+as+resizing%0A+++++*+progresses.++The+transfer+operation+must+also+ensure+that+all%0A+++++*+accessible+bins+in+both+the+old+and+new+table+are+usable+by+any%0A+++++*+traversal.++This+is+arranged+in+part+by+proceeding+from+the%0A+++++*+last+bin+%28table.length+-+1%29+up+towards+the+first.++Upon+seeing%0A+++++*+a+forwarding+node%2C+traversals+%28see+class+Traverser%29+arrange+to%0A+++++*+move+to+the+new+table+without+revisiting+nodes.++To+ensure+that%0A+++++*+no+intervening+nodes+are+skipped+even+when+moved+out+of+order%2C%0A+++++*+a+stack+%28see+class+TableStack%29+is+created+on+first+encounter+of%0A+++++*+a+forwarding+node+during+a+traversal%2C+to+maintain+its+place+if%0A+++++*+later+processing+the+current+table.+The+need+for+these%0A+++++*+save%2Frestore+mechanics+is+relatively+rare%2C+but+when+one%0A+++++*+forwarding+node+is+encountered%2C+typically+many+more+will+be.%0A+++++*+So+Traversers+use+a+simple+caching+scheme+to+avoid+creating+so%0A+++++*+many+new+TableStack+nodes.+%28Thanks+to+Peter+Levart+for%0A+++++*+suggesting+use+of+a+stack+here.%29%0A+++++*%0A+++++*+The+traversal+scheme+also+applies+to+partial+traversals+of%0A+++++*+ranges+of+bins+%28via+an+alternate+Traverser+constructor%29%0A+++++*+to+support+partitioned+aggregate+operations.++Also%2C+read-only%0A+++++*+operations+give+up+if+ever+forwarded+to+a+null+table%2C+which%0A+++++*+provides+support+for+shutdown-style+clearing%2C+which+is+also+not%0A+++++*+currently+implemented.%0A+++++*%0A+++++*+Lazy+table+initialization+minimizes+footprint+until+first+use%2C%0A+++++*+and+also+avoids+resizings+when+the+first+operation+is+from+a%0A+++++*+putAll%2C+constructor+with+map+argument%2C+or+deserialization.%0A+++++*+These+cases+attempt+to+override+the+initial+capacity+settings%2C%0A+++++*+but+harmlessly+fail+to+take+effect+in+cases+of+races.%0A+++++*%0A+++++*+The+element+count+is+maintained+using+a+specialization+of%0A+++++*+LongAdder.+We+need+to+incorporate+a+specialization+rather+than%0A+++++*+just+use+a+LongAdder+in+order+to+access+implicit%0A+++++*+contention-sensing+that+leads+to+creation+of+multiple%0A+++++*+CounterCells.++The+counter+mechanics+avoid+contention+on%0A+++++*+updates+but+can+encounter+cache+thrashing+if+read+too%0A+++++*+frequently+during+concurrent+access.+To+avoid+reading+so+often%2C%0A+++++*+resizing+under+contention+is+attempted+only+upon+adding+to+a%0A+++++*+bin+already+holding+two+or+more+nodes.+Under+uniform+hash%0A+++++*+distributions%2C+the+probability+of+this+occurring+at+threshold%0A+++++*+is+around+13%25%2C+meaning+that+only+about+1+in+8+puts+check%0A+++++*+threshold+%28and+after+resizing%2C+many+fewer+do+so%29.%0A+++++*%0A+++++*+TreeBins+use+a+special+form+of+comparison+for+search+and%0A+++++*+related+operations+%28which+is+the+main+reason+we+cannot+use%0A+++++*+existing+collections+such+as+TreeMaps%29.+TreeBins+contain%0A+++++*+Comparable+elements%2C+but+may+contain+others%2C+as+well+as%0A+++++*+elements+that+are+Comparable+but+not+necessarily+Comparable+for%0A+++++*+the+same+T%2C+so+we+cannot+invoke+compareTo+among+them.+To+handle%0A+++++*+this%2C+the+tree+is+ordered+primarily+by+hash+value%2C+then+by%0A+++++*+Comparable.compareTo+order+if+applicable.++On+lookup+at+a+node%2C%0A+++++*+if+elements+are+not+comparable+or+compare+as+0+then+both+left%0A+++++*+and+right+children+may+need+to+be+searched+in+the+case+of+tied%0A+++++*+hash+values.+%28This+corresponds+to+the+full+list+search+that%0A+++++*+would+be+necessary+if+all+elements+were+non-Comparable+and+had%0A+++++*+tied+hashes.%29+On+insertion%2C+to+keep+a+total+ordering+%28or+as%0A+++++*+close+as+is+required+here%29+across+rebalancings%2C+we+compare%0A+++++*+classes+and+identityHashCodes+as+tie-breakers.+The+red-black%0A+++++*+balancing+code+is+updated+from+pre-jdk-collections%0A+++++*+%28http%3A%2F%2Fgee.cs.oswego.edu%2Fdl%2Fclasses%2Fcollections%2FRBCell.java%29%0A+++++*+based+in+turn+on+Cormen%2C+Leiserson%2C+and+Rivest+%22Introduction+to%0A+++++*+Algorithms%22+%28CLR%29.%0A+++++*%0A+++++*+TreeBins+also+require+an+additional+locking+mechanism.++While%0A+++++*+list+traversal+is+always+possible+by+readers+even+during%0A+++++*+updates%2C+tree+traversal+is+not%2C+mainly+because+of+tree-rotations%0A+++++*+that+may+change+the+root+node+and%2For+its+linkages.++TreeBins%0A+++++*+include+a+simple+read-write+lock+mechanism+parasitic+on+the%0A+++++*+main+bin-synchronization+strategy%3A+Structural+adjustments%0A+++++*+associated+with+an+insertion+or+removal+are+already+bin-locked%0A+++++*+%28and+so+cannot+conflict+with+other+writers%29+but+must+wait+for%0A+++++*+ongoing+readers+to+finish.+Since+there+can+be+only+one+such%0A+++++*+waiter%2C+we+use+a+simple+scheme+using+a+single+%22waiter%22+field+to%0A+++++*+block+writers.++However%2C+readers+need+never+block.++If+the+root%0A+++++*+lock+is+held%2C+they+proceed+along+the+slow+traversal+path+%28via%0A+++++*+next-pointers%29+until+the+lock+becomes+available+or+the+list+is%0A+++++*+exhausted%2C+whichever+comes+first.+These+cases+are+not+fast%2C+but%0A+++++*+maximize+aggregate+expected+throughput.%0A+++++*%0A+++++*+Maintaining+API+and+serialization+compatibility+with+previous%0A+++++*+versions+of+this+class+introduces+several+oddities.+Mainly%3A+We%0A+++++*+leave+untouched+but+unused+constructor+arguments+refering+to%0A+++++*+concurrencyLevel.+We+accept+a+loadFactor+constructor+argument%2C%0A+++++*+but+apply+it+only+to+initial+table+capacity+%28which+is+the+only%0A+++++*+time+that+we+can+guarantee+to+honor+it.%29+We+also+declare+an%0A+++++*+unused+%22Segment%22+class+that+is+instantiated+in+minimal+form%0A+++++*+only+when+serializing.%0A+++++*%0A+++++*+Also%2C+solely+for+compatibility+with+previous+versions+of+this%0A+++++*+class%2C+it+extends+AbstractMap%2C+even+though+all+of+its+methods%0A+++++*+are+overridden%2C+so+it+is+just+useless+baggage.%0A+++++*%0A+++++*+This+file+is+organized+to+make+things+a+little+easier+to+follow%0A+++++*+while+reading+than+they+might+otherwise%3A+First+the+main+static%0A+++++*+declarations+and+utilities%2C+then+fields%2C+then+main+public%0A+++++*+methods+%28with+a+few+factorings+of+multiple+public+methods+into%0A+++++*+internal+ones%29%2C+then+sizing+methods%2C+trees%2C+traversers%2C+and%0A+++++*+bulk+operations.%0A+++++*%2F
at com.intellij.util.io.HttpRequests.throwHttpStatusError(HttpRequests.java:643)
at com.intellij.util.io.HttpRequests.openConnection(HttpRequests.java:624)
at com.intellij.util.io.HttpRequests.access$300(HttpRequests.java:59)
at com.intellij.util.io.HttpRequests$RequestImpl.getConnection(HttpRequests.java:378)
at com.intellij.util.io.HttpRequests$RequestImpl.getInputStream(HttpRequests.java:387)
at com.intellij.util.io.HttpRequests$RequestImpl.readString(HttpRequests.java:442)
at cn.yiiguxing.plugin.translate.trans.AbstractTranslator$translate$2.process(AbstractTranslator.kt:45)
at cn.yiiguxing.plugin.translate.trans.AbstractTranslator$translate$2.process(AbstractTranslator.kt:16)
at com.intellij.util.io.HttpRequests.doProcess(HttpRequests.java:523)
at com.intellij.util.io.HttpRequests.process(HttpRequests.java:499)
at com.intellij.util.io.HttpRequests.access$100(HttpRequests.java:59)
at com.intellij.util.io.HttpRequests$RequestBuilderImpl.connect(HttpRequests.java:352)
at cn.yiiguxing.plugin.translate.trans.AbstractTranslator.translate(AbstractTranslator.kt:44)
... 7 more