CN101169740B - EJB component dynamic migration method - Google Patents
EJB component dynamic migration method Download PDFInfo
- Publication number
- CN101169740B CN101169740B CN2007101200185A CN200710120018A CN101169740B CN 101169740 B CN101169740 B CN 101169740B CN 2007101200185 A CN2007101200185 A CN 2007101200185A CN 200710120018 A CN200710120018 A CN 200710120018A CN 101169740 B CN101169740 B CN 101169740B
- Authority
- CN
- China
- Prior art keywords
- client
- node server
- ejb
- state
- container
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Expired - Fee Related
Links
Images
Landscapes
- Computer And Data Communications (AREA)
- Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
Abstract
The invention discloses a dynamic relocation method for an EJB component. The method comprises: (1) starting a target node server, transmitting a component code to the target node server, and automatically allocating and starting a container; (2) creating a invocation agent profile by using the target node server as a component, the component container of the target node server blocks a request from a client-side and transmits and invokes the agent profile to a source node; (3) a source node server relocates the component example to the target node server, the EJB container on the source node updates the invocation agent at the client-side, and the client-side automatically transmits a new request to the target node server and blocks and caches the new request at the target node; and (4) after the relocation, the component container of the target node works normally, sequentially carries out the cached the request from the client-side, receives and carries out the new request from the client-side, and starting a service. The inventive method can relocate the component from one node to another node without stopping the service.
Description
Technical field:
The present invention relates to a kind of EJB (enterprise java bean, EnterpriseJava Bean) member dynamic migration method, be applicable to the distribution dynamic reconstruct of EJB member, belong to software technology field based on the member supports operation platform.
Background technology:
How improving adaptability of software is the fresh content of the research of soft project.In extensive J2EE application server cluster, the running status of node may change at any time, needs for various reasons member is readjusted in the internodal distribution of difference.On traditional application server, must at first stop a member on the node, and it is re-deployed on another node.Yet this method will make that the environment of member time of running is destroyed fully, can not get recovering, and the service that is providing on the source node will be from be stopped midway.Not only there are many shortcomings in this way, also will bring some flagrant gross errors.Traditional process migration can guarantee that service is not stopped, but process is very big with the degree of coupling of operating system, very depends on operating system.The migration of process relates to the proceeding internal memory space management, open file, process message, executing state, the collection of information such as kernel information and recovery, the difficult control of the environment of the time of running, and degree of coupling height between module and the module, whole process can only can not be divided into littler unit as a bulk migration.Present many application programs are based on that the J2EE standard develops, and traditional process migration has not satisfied the needs on the J2EE application server.
Summary of the invention:
At the problems referred to above, the purpose of this invention is to provide a kind of dynamic migration method based on the EJB member.This method makes that on the J2EE application server EJB member can dynamically be moved to another node from a node in the time of running, does not interrupt the service to the client in the middle of transition process, and after migration is finished, member will continue to provide service on new node.
For solving the problems of the technologies described above, technical scheme of the present invention is as follows:
A kind of dynamic migration method of EJB member, with the EJB member dynamically from the source node server migration to the destination node server, comprise the steps:
(1) start the destination node server, the transmission member code is to the destination node server, disposes automatically and starts container;
(2) the destination node server is that agents document is called in the member generation, and the member container of destination node server blocks the request of client, calls agents document to the source node transmission;
(3) the source node server receive all call agents document after, beginning is to destination node server migration member example, the renewal that Enterprise Java Bean container on the source node calls the agency to client, client will newly ask to send to destination node automatically, and block buffer memory at destination node;
(4) after migration finishes, all member container operate as normal on the destination node, order is carried out the client-requested be buffered, accepts and carries out new client-requested, begins service.
The dynamic migration method of above-mentioned EJB member, in the described step (3), the source node server is when destination node server migration member, for the state session member is arranged, the source node server is operated the EJB example, the state that the member container is set is frozen state and extracts session status that the source node server sends the session status file that extracts to the destination node server.On destination server, locate the container of this EJB, recover the ready queue in the instance management device;
The dynamic migration method of above-mentioned EJB member, in the described step (3), the source node server is when destination node server migration member, and for the stateless session means, the source node server directly state of member container is set to frozen state.
The dynamic migration method of above-mentioned EJB member, in the described step (3), the source node server is when destination node server migration member, for entity component: the state that the member container is set is a frozen state, submits the state of current entity component to database.After finishing, migration from database, reads the state of this entity component.
The frozen state of described source node member container is meant, container is accepted client-requested, does not carry out client-requested, but the new agents document that calls is written in the result object that returns to client, and notify this member of client to be moved, request this time will not be performed.
Technique effect of the present invention is: method of the present invention has guaranteed that the state of member is consistent before and after the migration, guaranteed that the client requests in the transition process can access correct processing, do not lose, needn't stop to finish the transition process of member, make member under the situation that does not stop to serve, to move to another node from a node to client's service.This method can be so that member being reconstructed of the internodal distribution freedom and flexibility of difference, solves load balance, and member far call network overhead is excessive, to problems such as not transportable device resource conduct interviews.
Description of drawings
Fig. 1 represents the migration flow process of EJB member in the present invention.
Fig. 2 represents in the dynamic migration process in the present invention the processing to client-requested
Embodiment:
At first, start the PKUAS2 on the target node b, earlier the code packages of using is sent on the PKUAS2, PKUAS2 is with automatic application deployment, and for each EJB member is created corresponding Enterprise Java Bean container, this moment, PKUAS2 was in original state.After application and component deployment finished, management platform sent to PKUAS2 and begins migration (startload) instruction, and signal begins migration work and begins.PKUAS2 calls agents document for each member generates, and the state that the member container is set after the end is a frozen state.
Afterwards, PKUAS2 sends to send to PKUAS1 and calls agents document (send stubs) instruction, signal PKUAS1 begins to accept to call agents document, the agents document that calls that generates is sent to PKUAS1, treat all call agents document send finish after, PKUAS2 sends to management platform and calls agents document and send (sendstubs done) instruction that finishes.
Afterwards, management platform sends to PKUAS 1 and begins migration (start migration) instruction.After PKUAS1 receives this instruction, carry out different operations for different EJB: (1) for the state session member is arranged, the state that the member container is set is a frozen state, and the EJB example is operated, and extracts session status etc.Afterwards, PKUAS1 sends transmit status file (send session) instruction to PKUAS2, and sends the session status file that extracts.(2) for the stateless session means, owing to there is not session status, directly the state of member container is set to frozen state.(3) for entity component: the state that the member container is set is a frozen state, submits the state of current entity component to database.
After different EJB were finished above operation, PKUAS1 sent the session status file to management platform and is sent completely (send sessions done) instruction, finishes with the signal state of operation.Management platform sends migration to PKUAS2 and finishes (Load Finished) instruction, and the state that all member containers on the PKUAS2 are set is an active state.
Gordian technique wherein is as follows:
(1) treating method of the session status of EJB member example:
For the state session member is arranged, in the transition process, all current active instance that comprise in the ready queue of freezing container are to obtain the status information of whole examples; By the example of freezing, then directly from file system, extract its status information file for those.In the transition process, in PKUAS 2 deploy and after having started member, cell therefor is created automatically and is finished.The session status data transmission behind PKUAS2, on PKUAS 2, is located the container of this EJB, recover the ready queue in the instance management device.In this process, safeguard example session status ID, and session state data.Must guarantee the unanimity of the session status ID of example before and after the migration, prevent that the client from will lose session status before.
For no attitude session means, call all at every turn and from the example pond, to take out an example, call and put back to the example pond after finishing.
For entity component, example ID is the major key of the record that obtains when calling establishment (create) method.For the dynamic migration of entity component, the consistance of its state is finished by the persistence of database, before migration state is delivered in the database, reads from database after migration finishes.
(2) to the control of container state
The state of container is used to retrain the behavior of control container in the migration different phase.Source node and destination node have state separately respectively.
The container of source node has two states: active state (Active) and frozen state (Frozen).Original state (Initial) is an active state.
Active state: the container operate as normal, accept and carry out client-requested.When the Autonomic Migration Framework thread was opened, application server transmits on this state can the receiving target node new called agency (Stub).
Frozen state: container is accepted client-requested, does not carry out client-requested, but return results object (InvocationResponse, the encapsulation class of return results among the PKUAS).When container is in this state, container is written to the new agents document that calls in the result object that returns to client after receiving the request that client is sent, and this member of notice client moved, and request this time will not be performed.The container that enters behind this state will exist as the transfer mechanism of client requests, and is in this state after migration always.In the migration that the attitude session means is arranged, container just allows to send session state information to destination node after entering this state.
The container of destination node has three states: original state (Initial), active state (Active) and frozen state (Frozen).Specific as follows:
Original state (Initial): after container is created startup, be in this state, this state allows to generate automatically to call agents document.After generation is called agents document and finished, will transfer frozen state to.
Active state (Active): the container operate as normal, accept and carry out client-requested.Migration end (LoadFinished) can make container enter this state, and this moment, container was carried out the client requests that is buffered with order.
Frozen state (Frozen): container is accepted client-requested, does not carry out client-requested, also return results object not, but client-requested is blocked in the formation.In the migration that the attitude Session EJB is arranged, the session state information that just allows the reception sources node to send when container is in this state.
(3) to moving the disposal route that the back client requests takes place:
Adopt passive renewal client call agency's method, make client at the automatic linking objective node in request failure back.Before migration, the calling the agency and will be changed into byte stream by sequence of EJB on the destination node is transferred on the source node in the initial work of migration, for the container of source node the client that has connected upgraded.To destination node, the client requests obstruction that takes place in all transition processes also is buffered in destination node to client after the renewal with re-send request may.Client requests is not lost before and after having guaranteed migration.As shown in Figure 2, the EJB member in transition process, different migration phase, the method for the Request Processing that client is sent.1) before the migration (client was asked source node in the time period shown in the left oblique line), source node is in the activity attitude, and return results will be normally carried out in request.2) in transition process (client is in the request of sending of time period shown in the grid), source node is in frozen state, and the request of mailing to source node will not carried out, and bundle in the return results and call proxy information.Ask retransmitted (dotted line), and mail to destination node, destination node is in frozen state, so request is buffered, finishes up to migration, and the destination node state that reactivates is carried out again.Return results.3) after migration is finished (client is in the request of sending of time period shown in the right oblique line), the request of mailing to source node will not carried out, and bundle in the return results and call proxy information.Ask retransmitted (dotted line), and mail to destination node, destination node is in active state, and request is performed at destination node.Return results.
Method of the present invention is not moved member executing state data, by control migration opportunity, and the code data and the session state data of migration member.Method of the present invention is by freezing and recover to have the session state data of attitude EJB member example to guarantee the state consistency of member example before and after migration; No attitude EJB member example guarantees the state consistency of member example before and after migration by the persistence of database.In the method for the present invention, when source node EJB member moves, the agency (stub) that calls to client upgrades by former container, when asking the last time, returns the member information of having moved, and will call the agency and be transferred to client.After source node EJB member moves, and the agency is called in the client renewal, will transmit automatically and ask not finish as transition process to destination node, then block buffer memory and should ask at destination node, after the migration end, return to the client call result.
It below is a detailed process that the moving method of state session member is arranged.This EJB provides simple tally function, and current quantity (val) will store in the EJB example, and each subsequently client requests quantity of all will setting out adds one (val+1).When calling ejbCreate (), ejbRemove (), ejbPassivate (), ejbActive (), during operational approach count (), to screen output " ejbCreate () ", " ejbRemove () ", " ejbPassivate () ", " ejbActive () ", " count () ".
The first step: on 2 computer nodes of LAN (Local Area Network), start 2 PKUAS application server instance PKUAS1, PKUAS2.In client, search the Home interface, create 30 EJB objects by the Home interface, and give 30 EJB example initial values and be respectively 0-29.And call an operational approach count (), this moment, the val value of 30 examples was respectively 1-30.These 30 examples exist in the array, and input digit n is to call the count () method of n example of an order.Middle during this period of time client is communicated by letter with PKUAS1 always.The client-side program operation result is as follows:
Client:
Instantiating?beans...
1
2
29
30
Calling?count()on?beans...
Input digit: 0
The 0th EJB example val is: 2
Input digit: 1
The 1st EJB example val is: 3
Source node application server programs PKUAS1 operation result is as follows:
PKUAS1:
ejbCreate()
count()
ejbCreate()
count
count()
count()
Second step: access control platform, the member that appointment will be moved, migration beginning.Operation result is as follows: the process that can see PKUAS1 and PKUAS2 swap data.
PKUAS1:
15:29:29[Thread-41]MigrationThread(DEBUG)start?migrationServer..
15:29:49[Thread-41]MigrationThread(DEBUG)get?stub?from?client
15:29:49[Thread-41]MigrationThread(DEBUG)get?stubCount_stub.ser
15:29:49[Thread-41]MigrationThread(DEBUG)get?stub?done
15:29:49[Thread-41]MigrationService(DEBUG)startMigration()
ejbPassivate()
ejbPassivate()
ejbPassivate()
15:29:49[Thread-41]MigrationThread(DEBUG)send
session:3864058007490920451.ser
15:29:49[Thread-41]MigrationThread(DEBUG)send
session:3864058007490920452.ser
15:29:50[Thread-41]TestSvc(DEBUG)send?session:3864058007490920479.ser
15:29:50[Thread-41]TestSvc(DEBUG)send?session:3864058007490920480.ser
15:29:50[Thread-41]TestSvc(DEBUG)send?session?done
PKUAS2:
15:28:31[Thread-42]MigrationThread(DEBUG)start?migrationClient:
15:28:31[Thread-42]MigrationThread(DEBUG)connected
15:28:31[Thread-42]MigrationService(DEBUG)LoadStart()
15:28:31[Thread-42]MigrationThread(DEBUG)generated?stubs?done
15:28:31[Thread-42]MigrationThread(DEBUG)send?stub:Count_stub.ser
15:28:31[Thread-42]MigrationThread(DEBUG)send?stub?done
15:28:32[Thread-42]MigrationThread(DEBUG)get?session:
3864058007490920451.ser
15:28:32[Thread-42]MigrationThread(DEBUG)get?session:
3864058007490920452.ser
15:28:32[Thread-42]MigrationThread(DEBUG)get?session:
3864058007490920479.ser
15:28:32[Thread-42]MigrationThread(DEBUG)get?session:
3864058007490920480.ser
15:28:32[Thread-42]MigrationThread(DEBUG)get?session?done
15:28:32[Thread-42]MigrationService(DEBUG)LoadFinish()
The 3rd the step: client input digit 0 (calling the count () method of the 0th EJB), then this moment the 0th EJB example val be: 3, state is consistent, and this moment with client communication be PKUAS2.On PKUAS2, demonstrate recalls information.Expression member and all member instance migration complete successfully.
Client:
Instantiating?beans...
1
2
29
30
Calling?count()on?beans...
Input digit: 0
The 0th EJB example val is: 2
Input digit: 1
The 1st EJB example val is: 3
Input digit: 0
The 0th EJB example val is: 3
Input digit: 0
The 0th EJB example val is: 4
PKUAS2:
15:28:32[Thread-42]MigrationThread(DEBUG)get?session?done
15:28:32[Thread-42]MigrationService(DEBUG)LoadFinish()
ejbActive()
count()
count()
Claims (2)
1. the dynamic migration method of an EJB member, with the EJB member dynamically from the source node server migration to the destination node server, it is characterized in that, comprise the steps:
(1) starts the destination node server, transmit the EJB piece code, dispose automatically and start the member container to the destination node server;
(2) the destination node server calls agents document for the EJB member generates, and the member container of destination node server blocks the request of client, calls agents document to the source node transmission;
(3) the source node server receive all call agents document after, beginning is to destination node server migration EJB member example, member container on the source node calls agency's renewal to client, client will newly ask to send to destination node automatically, and block buffer memory at destination node; The source node server when destination node server migration EJB member,
For the state session member is arranged, the source node server is operated EJB member example, and the state that the member container is set is frozen state and extracts session status that the source node server sends the session status file that extracts to the destination node server; Destination server is located this member container, recovers the ready queue in the instance management device;
For the stateless session means, the source node server directly state of member container is set to frozen state;
For entity component: the state that the member container is set is a frozen state, submits the state of current entity component to database;
(4) after migration finishes, all member container operate as normal on the destination node, order is carried out the client-requested be buffered, accepts and carries out new client-requested, begins service;
For entity component: after migration finishes, will from database, read the state of this entity component.
2. the dynamic migration method of EJB member as claimed in claim 1, it is characterized in that, in the described step (3), the frozen state of described source node server upper member container is meant, the member container is accepted client-requested, does not carry out client-requested, but the new agents document that calls is written in the result object that returns to client, and notify this EJB member of client to be moved, request this time will not be performed.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN2007101200185A CN101169740B (en) | 2007-08-07 | 2007-08-07 | EJB component dynamic migration method |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN2007101200185A CN101169740B (en) | 2007-08-07 | 2007-08-07 | EJB component dynamic migration method |
Publications (2)
Publication Number | Publication Date |
---|---|
CN101169740A CN101169740A (en) | 2008-04-30 |
CN101169740B true CN101169740B (en) | 2010-09-08 |
Family
ID=39390375
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN2007101200185A Expired - Fee Related CN101169740B (en) | 2007-08-07 | 2007-08-07 | EJB component dynamic migration method |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN101169740B (en) |
Families Citing this family (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN103873534B (en) * | 2012-12-18 | 2017-06-06 | 中国移动通信集团公司 | A kind of application cluster moving method and device |
CN104731654B (en) * | 2015-04-03 | 2018-03-27 | 南京大学 | A kind of migration reconstruct and support system for Android application |
CN106682021B (en) * | 2015-11-09 | 2021-09-28 | 五八同城信息技术有限公司 | Database migration method and device |
CN105607954B (en) * | 2015-12-21 | 2019-05-14 | 华南师范大学 | A kind of method and apparatus that stateful container migrates online |
CN107438110A (en) * | 2017-09-15 | 2017-12-05 | 湖南新云网科技有限公司 | A kind of terminal data moving method and system based on lucidification disposal |
-
2007
- 2007-08-07 CN CN2007101200185A patent/CN101169740B/en not_active Expired - Fee Related
Also Published As
Publication number | Publication date |
---|---|
CN101169740A (en) | 2008-04-30 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
US6832238B1 (en) | Local transaction management | |
Chandy et al. | A world-wide distributed system using java and the internet | |
Ban | Design and implementation of a reliable group communication toolkit for java | |
EP0677943A2 (en) | A communications system for exchanging data between computers in a network | |
EP1024430A2 (en) | Fault-tolerant Java virtual machine | |
CN101707399B (en) | Method and system for acquiring electric energy information | |
CN101169740B (en) | EJB component dynamic migration method | |
CN101535965A (en) | Technique for improving scalability and portability of a storage management system | |
Lantz et al. | Rochester's intelligent gateway | |
CN105630589A (en) | Distributed process scheduling system and process scheduling and execution method | |
CN103116520A (en) | Remote procedure call remote position control (RPC) method based on transmission control protocol (TCP)/user datagram protocol (UDP) | |
Wang et al. | GRPC: A communication cooperation mechanism in distributed systems | |
Dalmeijer et al. | A reliable mobile agents architecture | |
Stellner et al. | Resource management and checkpointing for PVM | |
US7188111B2 (en) | System and method for connectivity to structured query language database | |
CN103207965A (en) | Method and device for License authentication in virtual environment | |
JPH07210486A (en) | Processing method of multiphase commit | |
Horvat et al. | Mobile agents and Java mobile agents toolkits | |
Mishra et al. | Experience with modularity in Consul | |
Chung et al. | A mechanism for supporting client migration in a shared window system | |
CN101383814A (en) | Device and method implementing data access based on connection pool | |
Warren et al. | A model for dynamic configuration which preserves application integrity | |
Schuster et al. | A general framework for the execution of heterogenous programs in workflow management systems | |
Sridhar et al. | Dynamic module replacement in distributed protocols | |
AU2004264626B2 (en) | Transparent session migration across servers |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
C06 | Publication | ||
PB01 | Publication | ||
C10 | Entry into substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
C14 | Grant of patent or utility model | ||
GR01 | Patent grant | ||
C17 | Cessation of patent right | ||
CF01 | Termination of patent right due to non-payment of annual fee |
Granted publication date: 20100908 Termination date: 20130807 |