Java – signal / slot mechanism

For people with relatively new Java ecosystems, is there a fairly lightweight way to perform the processing of their signaling / receiver systems by frameworks such as QT and Django, where components can say "I'm doing something", while other components can handle it in a fairly loosely coupled manner?

If this question does not pass the "single objective answer" test, I will apologize in advance

Edit: to add more context, this is related to the database - driven application layer of Web services When some resources are persisted, audit records containing additional context information need to be saved In Django, I do this through signaling mechanism, or use one of several existing libraries For Scala programs, I use callback functions to make my own Hacky things, but it's easier to use the first kind of functions I have no doubt that frameworks like swing provide facilities for such things, but I (may be unreasonable) add this dependency to today's fairly common applications (not that Django itself is not a huge dependency on Vanilla Python!)

Solution

In Java, at least on the UI side, this is usually done using the listener approach: you register a listener method that is called when a particular event occurs It may be loosely coupled than QT signal / slot mechanism... Another method you may consider is Java message service, which is specially used for loosely coupled communication in client / server systems based on Java EE standard

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>