In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-03-28 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/02 Report--
This article mainly explains "what are the categories of java meta-sharing model". Interested friends may wish to have a look at it. The method introduced in this paper is simple, fast and practical. Next let the editor to take you to learn "what are the categories of java meta-model"!
First, about the sharing meta-model
The shared meta-pattern is somewhat similar to the singleton pattern, in which only one object is generated and shared. The main purpose of sharing meta-pattern is to share multiple objects, reduce unnecessary memory consumption, centralize multiple access to the same object, and do not have to create a separate object for each visitor, so as to reduce memory consumption.
Second, enjoy the meta-pattern structure diagram
Because the structure of the shared meta pattern is more complex, it is generally used in conjunction with the factory pattern, and a shared meta factory class is included in its structure diagram.
The following roles are included in the shared meta-schema structure diagram:
Flyweight (Abstract sharing Metaclass): usually an interface or abstract class that declares the public methods of the concrete sharing metaclass in the abstract sharing metaclass, which can provide the internal data (internal state) of the shared meta-object to the outside world, and can also be used to set external data (external state).
ConcreteFlyweight (concrete sharing metaclass): it implements abstract shared meta-classes, whose instances are called shared meta-objects; provides storage space for internal states in concrete shared meta-classes. Usually, we can combine the singleton pattern to design specific shared meta-classes, providing a unique shared meta-object for each specific shared meta-class.
UnsharedConcreteFlyweight (non-shared concrete sharing metaclass): not all subclasses of abstract sharing metaclass need to be shared, and subclasses that cannot be shared can be designed as non-shared concrete sharing metaclass; when an object that does not share concrete sharing metaclass is needed, it can be created directly by instantiation.
FlyweightFactory (shared meta-factory class): the shared meta-factory class is used to create and manage shared meta-objects. It is programmed against abstract shared meta-classes and stores various types of concrete shared meta-objects in a shared meta-pool. The shared meta-pool is generally designed as a collection of "key-value pairs" (which can also be other types of collections), which can be designed in combination with factory patterns. When a user requests a specific share meta object, the share meta factory provides an instance that has been created in the share meta pool or creates a new instance (if it does not exist), returns the newly created instance and stores it in the share meta pool.
Third, the realization of the sharing meta-model.
The shared meta factory class is introduced into the shared meta mode. The function of the shared meta factory class is to provide a shared meta pool for storing shared meta objects. When a user needs an object, it is first obtained from the shared meta pool. If it does not exist in the shared meta pool, a new shared meta object is created and returned to the user, and the newly added object is saved in the shared meta pool. Next, implement a login meta-mode.
At this point, I believe you have a deeper understanding of "what are the categories of java meta-sharing mode?" you might as well do it in practice. Here is the website, more related content can enter the relevant channels to inquire, follow us, continue to learn!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.