apache / linkis

Apache Linkis builds a computation middleware layer to facilitate connection, governance and orchestration between the upper applications and the underlying data engines.
https://linkis.apache.org/
Apache License 2.0
3.3k stars 1.17k forks source link

Lock with object vs empty byte array? #525

Closed pengisgood closed 3 years ago

pengisgood commented 3 years ago

Just curious about the lock with the empty byte array, what's the benefit of an empty byte array compare to Object?

https://github.com/WeBankFinTech/Linkis/blob/4ac1a51f25d5ea451d90e59294d0c6227c124147/core/scheduler/src/main/scala/com/webank/wedatasphere/linkis/scheduler/queue/LoopArrayQueue.scala#L27

I also found a post on StackOverflow which is relevant. Mostly discussed from the byte code and serialization perspective.

Does it really matter with performance?

Any ideas from the author(probably is @enjoyyin) of this line of code?

peacewong commented 3 years ago

Hello, this is just a habit of using locks, it has no special meaning