We are independent & ad-supported. We may earn a commission for purchases made through our links.
Advertiser Disclosure
Our website is an independent, advertising-supported platform. We provide our content free of charge to our readers, and to keep it that way, we rely on revenue generated through advertisements and affiliate partnerships. This means that when you click on certain links on our site and make a purchase, we may earn a commission. Learn more.
How We Make Money
We sustain our operations through affiliate commissions and advertising. If you click on an affiliate link and make a purchase, we may receive a commission from the merchant at no additional cost to you. We also display advertisements on our website, which help generate revenue to support our work and keep our content free for readers. Our editorial team operates independently of our advertising and affiliate partnerships to ensure that our content remains unbiased and focused on providing you with the best information and recommendations based on thorough research and honest evaluations. To remain transparent, we’ve provided a list of our current affiliate partners here.
Software

Our Promise to you

Founded in 2002, our company has been a trusted resource for readers seeking informative and engaging content. Our dedication to quality remains unwavering—and will never change. We follow a strict editorial policy, ensuring that our content is authored by highly qualified professionals and edited by subject matter experts. This guarantees that everything we publish is objective, accurate, and trustworthy.

Over the years, we've refined our approach to cover a wide range of topics, providing readers with reliable and practical advice to enhance their knowledge and skills. That's why millions of readers turn to us each year. Join us in celebrating the joy of learning, guided by standards you can trust.

What Is an Active Object?

By Eugene P.
Updated: May 16, 2024
Views: 7,975
References
Share

In computer programming and engineering, an active object is a type of design pattern that can be used to help ensure that some service is always available in a multi-threaded or concurrent system. An active object is an object that implements a mechanism so it can receive and process input from external objects without forcing the external objects to wait for execution to complete. This mechanism also allows many objects that might all be running concurrently to use active objects without the possibility for long blocking times in which the concurrent processes must stop and wait for access. This most often is achieved by wrapping the active objects in a publicly accessible interface, called a proxy, and then implementing a type of queue system inside the objects so messages are stored for later processing. This creates a design pattern in which objects send messages to active objects and then continue their processing until the active object processes the message and later informs the calling objects of the results so they can update their states accordingly.

Outside an active object design pattern, a normal object might be called a passive object. In a simple program example, a passive object might be acting as a chat server relay, in which remote objects contact the passive object to transmit a message to everyone else on the server. Whenever the passive server object receives a chat message from a remote object, it must handle the request immediately and then immediately send output, all while the remote object halts its own execution until the process is done, an effect known as blocking. Creating different threads within the program can solve the problem of execution blocking but then initiates problems with synchronization.

In an active object design pattern, the same server object in the above example would be running in its own thread separate from the other objects. It also would be wrapped in some type of interface known as a proxy that also is running in a separate thread, sometimes the main program execution thread. When a remote object wants to have the server object send out a chat message, it contacts the proxy object, passes to it all of the information required, and then returns to its normal execution state instead of waiting.

The proxy interface then converts the information from the remote object into a message that it passes to a queue for the active object to process. At this point, both the proxy interface and the remote object are free to continue executing and are not blocked. Meanwhile, the active object works to keep the queue empty, processing each incoming message. If the calling object requires some information to be returned by the active object, then a callback structure can be used to inform the remote object of any changes in state.

Share
EasyTechJunkie is dedicated to providing accurate and trustworthy information. We carefully select reputable sources and employ a rigorous fact-checking process to maintain the highest standards. To learn more about our commitment to accuracy, read our editorial process.
Link to Sources
Discussion Comments
Share
https://www.easytechjunkie.com/what-is-an-active-object.htm
Copy this link
EasyTechJunkie, in your inbox

Our latest articles, guides, and more, delivered daily.

EasyTechJunkie, in your inbox

Our latest articles, guides, and more, delivered daily.