CN107179921A - Terminal closedown method and apparatus - Google Patents

Terminal closedown method and apparatus Download PDF

Info

Publication number
CN107179921A
CN107179921A CN201610140730.0A CN201610140730A CN107179921A CN 107179921 A CN107179921 A CN 107179921A CN 201610140730 A CN201610140730 A CN 201610140730A CN 107179921 A CN107179921 A CN 107179921A
Authority
CN
China
Prior art keywords
thread
actuated
new request
service logic
terminal
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.)
Granted
Application number
CN201610140730.0A
Other languages
Chinese (zh)
Other versions
CN107179921B (en
Inventor
何杰
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Advanced New Technologies Co Ltd
Advantageous New Technologies Co Ltd
Original Assignee
Alibaba Group Holding Ltd
Priority date (The priority date 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 date listed.)
Filing date
Publication date
Application filed by Alibaba Group Holding Ltd filed Critical Alibaba Group Holding Ltd
Priority to CN201610140730.0A priority Critical patent/CN107179921B/en
Publication of CN107179921A publication Critical patent/CN107179921A/en
Application granted granted Critical
Publication of CN107179921B publication Critical patent/CN107179921B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/445Program loading or initiating
    • G06F9/44594Unloading
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/466Transaction processing

Abstract

The application proposes a kind of terminal closedown method and apparatus, and the terminal closedown method includes:Receive after out code, obtain thread not actuated in thread registered in advance;Perform the not actuated thread;After all not actuated threads are finished, close a terminal.This method can solve the problem that some problems that forced shutdown is present.

Description

Terminal closedown method and apparatus
Technical field
The application is related to field of terminal technology, more particularly to a kind of terminal closedown method and apparatus.
Background technology
At present, many terminals are internal not terminate just to be forced to terminate also in operation when stopping, Simultaneously in the instantaneous of system stopping, user's request that also can be a small amount of is not responded.What this mode was brought asks Topic is that on the one hand interaction is not friendly enough, the problems such as dirty data may be produced in addition, data are lost.
The content of the invention
The application is intended at least solve one of technical problem in correlation technique to a certain extent.
Therefore, the purpose of the application is to propose a kind of terminal closedown method, this method can be solved by force Some problems that system shutdown is present.
Further object is to propose a kind of terminal closedown device.
To reach above-mentioned purpose, the terminal closedown method that the application first aspect embodiment is proposed, including:Connect Receive after out code, obtain thread not actuated in thread registered in advance;Perform the not actuated line Journey;After all not actuated threads are finished, close a terminal.
The terminal closedown method that the application first aspect embodiment is proposed, is all held by not actuated thread Row turns off terminal after finishing, and can avoid the problem of forced shutdown causes, improve interaction friendly, Avoid the generation of dirty data, it is to avoid loss of data etc..
To reach above-mentioned purpose, the terminal closedown device that the application second aspect embodiment is proposed, including:Obtain Modulus block, for receiving after out code, obtains thread not actuated in thread registered in advance;Perform Module, for performing the not actuated thread;Closedown module, for being performed in all not actuated threads After finishing, close a terminal.
The terminal closedown device that the application second aspect embodiment is proposed, is all held by not actuated thread Row turns off terminal after finishing, and can avoid the problem of forced shutdown causes, improve interaction friendly, Avoid the generation of dirty data, it is to avoid loss of data etc..
The aspect and advantage that the application is added will be set forth in part in the description, and will partly be retouched from following Become obvious in stating, or recognize by the practice of the application.
Brief description of the drawings
The above-mentioned and/or additional aspect of the application and advantage are from the following description of the accompanying drawings of embodiments It will be apparent and be readily appreciated that, wherein:
Fig. 1 is the schematic flow sheet for the terminal closedown method that the embodiment of the application one is proposed;
Fig. 2 is the schematic flow sheet for the terminal closedown method that another embodiment of the application is proposed;
Fig. 3 is the structural representation for the terminal closedown device that another embodiment of the application is proposed;
Fig. 4 is the structural representation for the terminal closedown device that another embodiment of the application is proposed;
Fig. 5 is the structural representation for the terminal that another embodiment of the application is proposed.
Embodiment
Embodiments herein is described below in detail, the example of the embodiment is shown in the drawings, wherein certainly Beginning to same or similar label eventually represents same or similar module or the mould with same or like function Block.The embodiments described below with reference to the accompanying drawings are exemplary, is only used for explaining the application, and can not It is interpreted as the limitation to the application.On the contrary, embodiments herein includes falling into attached claims All changes, modification and equivalent in the range of spirit and intension.
Fig. 1 is the schematic flow sheet for the terminal closedown method that the embodiment of the application one is proposed.Referring to Fig. 1, This method includes:
S11:Receive after out code, obtain thread not actuated in thread registered in advance.
Wherein it is possible to which the every kind of service logic of correspondence, registers a thread, will pass through the execution of thread Realize corresponding service logic.Service logic is such as including closing file, deleting file.
S12:Perform the not actuated thread.
Wherein it is possible to determine whether thread is not actuated according to the status indicator of thread.
For example, each thread of correspondence sets status indicator, status indicator is for example represented with islive, its In, islive can include true (true) or false (false) two states, when thread When islive is false, it is not actuated thread to determine the thread.
After not actuated thread is determined, each not actuated thread can be performed successively.
S13:After all not actuated threads are finished, close a terminal.
For example, there is N number of not actuated thread when receiving out code, then when this is N number of not actuated Thread be all performed and finish after, turn off terminal.
In the present embodiment, terminal is turned off after being all finished by not actuated thread, can be kept away Exempt from the problem of forced shutdown causes, improve interaction friendly, avoid the generation of dirty data, it is to avoid data Lose etc..
Fig. 2 is the schematic flow sheet for the terminal closedown method that another embodiment of the application is proposed.This implementation The flow of example can be divided into registration phase, refusal stage and dwell period.Referring to Fig. 2, this method bag Include:
S21:According to the service logic of registration, the correspondence service logic creates thread, and, registration is simultaneously It is stored back into line transfer journey.
The stage is properly termed as registration phase.
Wherein, user can be with self-defined service logic, for example, which file or deletion closed during shutdown Which file etc..
Specifically, the corresponding device of this method can be specifically a software kit, the software kit is externally carried For an interface, the interface is for example referred to as IShutdownHook interfaces, and user can call the interface And customized service logic is registered in the device.
After user's registration service logic is into the device, each service logic can be corresponded to and create one New thread (Tread), to realize corresponding service logic.After a thread is created, the thread Reside in internal memory, and execution is started according to the service logic of itself.
In addition, in registration phase, the device can be with built-in readjustment thread, and it is to be used in fact to adjust back thread The thread of existing hook mechanism, after out code is received, to obtain and perform not actuated thread.
S22:Receive after out code, if receiving new request, intercept new request, and refuse Or the new request of forwarding.
The stage is properly termed as the refusal stage.
After out code is received, the filter built in the device can be started, filter is starting Afterwards, new request can be intercepted.
After new request is intercepted, the new request can be refused, for example, the state of opposite end one is returned, Show that service is turned off, rather than when time-out.Or,
After new request is intercepted or the new request of forwarding, for example, registered during registration phase Service logic demonstrates the need for forwarding the new request, then can be transmitted to the new request corresponding Thread is handled.
S23:Readjustment thread is obtained, not actuated thread is obtained by the readjustment thread, performed each Not actuated thread, and after all not actuated threads are finished, close a terminal.
The stage is properly termed as dwell period.
Wherein it is possible to it gets all registered threads by built-in registration, and by returning Line transfer journey filters out all not actuated threads according to islive marks, and not actuated thread refers to Islive is false thread.
After all not actuated threads are got, these threads can be performed, and be finished After close.
In the present embodiment, terminal is turned off after being all finished by not actuated thread, can be kept away Exempt from the problem of forced shutdown causes, improve interaction friendly, avoid the generation of dirty data, it is to avoid data Lose etc..Further, newly asked by interception and refuse or forward, relative to the side for waiting time-out Formula, can further improve friendly.
Fig. 3 is the structural representation for the terminal closedown device that another embodiment of the application is proposed.Referring to figure 3, the device 30 includes:Acquisition module 31, performing module 32 and closedown module 33.
Acquisition module 31, for receiving after out code, obtains not actuated in thread registered in advance Thread.
Wherein it is possible to which the every kind of service logic of correspondence, registers a thread, will pass through the execution of thread Realize corresponding service logic.Service logic is such as including closing file, deleting file.
Performing module 32, for performing the not actuated thread.
Wherein it is possible to determine whether thread is not actuated according to the status indicator of thread.
For example, each thread of correspondence sets status indicator, status indicator is for example represented with islive, its In, islive can include true (true) or false (false) two states, when thread When islive is false, it is not actuated thread to determine the thread.
After not actuated thread is determined, each not actuated thread can be performed successively.
Closedown module 33, for after all not actuated threads are finished, closing a terminal.
For example, there is N number of not actuated thread when receiving out code, then when this is N number of not actuated Thread be all performed and finish after, turn off terminal.
In some embodiments, referring to Fig. 4, the device also includes:
Acquisition module 34, for by external interface, obtaining the service logic of registration.
Specifically, the device can be a software kit, the software kit externally provides an interface, and this connects Mouth is for example referred to as IShutdownHook interfaces, and user can call the interface and by customized business Logic is registered in the device.
Creation module 35, for the service logic according to registration, the correspondence service logic creates thread.
After user's registration service logic is into the device, each service logic can be corresponded to and create one New thread (Tread), to realize corresponding service logic.After a thread is created, the thread Reside in internal memory, and execution is started according to the service logic of itself.
In some embodiments, referring to Fig. 4, the device also includes:
Callback module 36, for registering and being stored back into line transfer journey, to receive after out code, passes through The readjustment thread obtains not actuated thread.
Readjustment thread is the thread for realizing hook mechanism, after out code is received, to obtain Take and perform not actuated thread.
Wherein it is possible to it gets all registered threads by built-in registration, and by returning Line transfer journey filters out all not actuated threads according to islive marks, and not actuated thread refers to Islive is false thread.
After all not actuated threads are got, these threads can be performed, and be finished After close.
In some embodiments, referring to Fig. 4, the device also includes:
Blocking module 37, for after out code is received, if receiving new request, intercepting institute New request is stated, and refuses the new request after interception or forwards the new request.
After out code is received, the filter built in the device can be started, filter is starting Afterwards, new request can be intercepted.
After new request is intercepted, the new request can be refused, for example, the state of opposite end one is returned, Show that service is turned off, rather than when time-out.Or,
After new request is intercepted or the new request of forwarding, for example, registered during registration phase Service logic demonstrates the need for forwarding the new request, then can be transmitted to the new request corresponding Thread is handled.
In the present embodiment, terminal is turned off after being all finished by not actuated thread, can be kept away Exempt from the problem of forced shutdown causes, improve interaction friendly, avoid the generation of dirty data, it is to avoid data Lose etc..Further, newly asked by interception and refuse or forward, relative to the side for waiting time-out Formula, can further improve friendly.
Fig. 5 is the structural representation for the terminal that another embodiment of the application is proposed.Referring to Fig. 5, the terminal 50 include:Housing 51, processor 52, memory 53, circuit board 54 and power circuit 55, wherein, Circuit board 54 is placed in the interior volume that housing is surrounded, and processor 52 and memory 53 are arranged on circuit board On 54;Power circuit 55, for being powered for each circuit or device of electronic equipment;Memory 53 is used for Store executable program code;The executable program code that processor 52 is stored by reading in memory come Operation program corresponding with executable program code, for performing following steps:
Receive after out code, obtain thread not actuated in thread registered in advance;
Perform the not actuated thread;
After all not actuated threads are finished, close a terminal.
Optionally, in addition to:
After out code is received, if receiving new request, the new request is intercepted, and intercepting After refuse the new request or forward the new request.
Optionally, in addition to:
According to the service logic of registration, the correspondence service logic creates thread.
Optionally, in addition to:
By external interface, the service logic of registration is obtained.
Optionally, in addition to:
Register and be stored back into line transfer journey, to receive after out code, obtained not by the readjustment thread The thread of startup.
Particular content in the present embodiment may refer to the associated description in above-described embodiment, no longer go to live in the household of one's in-laws on getting married herein State.
In the present embodiment, terminal is turned off after being all finished by not actuated thread, can be kept away Exempt from the problem of forced shutdown causes, improve interaction friendly, avoid the generation of dirty data, it is to avoid data Lose etc..Further, newly asked by interception and refuse or forward, relative to the side for waiting time-out Formula, can further improve friendly.
It should be noted that in the description of the present application, term " first ", " second " etc. are only used for retouching Purpose is stated, and it is not intended that indicating or implying relative importance.In addition, in the description of the present application, removing Non- to be otherwise noted, the implication of " multiple " refers at least two.
Any process described otherwise above or method description are construed as in flow chart or herein, table Show including it is one or more be used for realize specific logical function or process the step of executable instruction generation Module, fragment or the part of code, and the scope of the preferred embodiment of the application includes other realization, Wherein can not by order that is shown or discussing, including according to involved function by it is basic and meanwhile in the way of Or in the opposite order, carrying out perform function, this should be by embodiments herein those of skill in the art Member is understood.
It should be appreciated that each several part of the application can be realized with hardware, software, firmware or combinations thereof. In the above-described embodiment, multiple steps or method can in memory and by suitable instruction be held with storage The software or firmware that row system is performed are realized.If for example, realized with hardware, and in another embodiment party It is the same in formula, it can be realized with any one of following technology well known in the art or their combination:Have For the discrete logic for the logic gates that logic function is realized to data-signal, with suitable combination The application specific integrated circuit of logic gates, programmable gate array (PGA), field programmable gate array (FPGA) Deng.
Those skilled in the art be appreciated that to realize the whole that above-described embodiment method carries or Part steps can be by program to instruct the hardware of correlation to complete, and described program can be stored in one kind In computer-readable recording medium, the program upon execution, including one of the step of embodiment of the method or its group Close.
In addition, each functional unit in the application each embodiment can be integrated in a processing module, Can also be that unit is individually physically present, can also two or more units be integrated in a module In.Above-mentioned integrated module can both be realized in the form of hardware, it would however also be possible to employ software function module Form is realized.If the integrated module is realized using in the form of software function module and is used as independent product Sale in use, can also be stored in a computer read/write memory medium.
Storage medium mentioned above can be read-only storage, disk or CD etc..
In the description of this specification, reference term " one embodiment ", " some embodiments ", " example ", The description of " specific example " or " some examples " etc. means to combine that the embodiment or example describe is specific Feature, structure, material or feature are contained at least one embodiment of the application or example.In this theory In bright book, identical embodiment or example are not necessarily referring to the schematic representation of above-mentioned term.Moreover, Specific features, structure, material or the feature of description can be in any one or more embodiments or examples In combine in an appropriate manner.
Although embodiments herein has been shown and described above, it is to be understood that above-described embodiment It is exemplary, it is impossible to be interpreted as the limitation to the application, one of ordinary skill in the art is the application's In the range of above-described embodiment can be changed, change, replace and modification.

Claims (10)

1. a kind of terminal closedown method, it is characterised in that including:
Receive after out code, obtain thread not actuated in thread registered in advance;
Perform the not actuated thread;
After all not actuated threads are finished, close a terminal.
2. according to the method described in claim 1, it is characterised in that also include:
After out code is received, if receiving new request, the new request is intercepted, and intercepting After refuse the new request or forward the new request.
3. according to the method described in claim 1, it is characterised in that also include:
According to the service logic of registration, the correspondence service logic creates thread.
4. method according to claim 3, it is characterised in that also include:
By external interface, the service logic of registration is obtained.
5. method according to claim 3, it is characterised in that also include:
Register and be stored back into line transfer journey, to receive after out code, obtained not by the readjustment thread The thread of startup.
6. a kind of terminal closedown device, it is characterised in that including:
Acquisition module, for receiving after out code, obtains thread not actuated in thread registered in advance;
Performing module, for performing the not actuated thread;
Closedown module, for after all not actuated threads are finished, closing a terminal.
7. device according to claim 6, it is characterised in that also include:
Blocking module, for after out code is received, if receiving new request, is intercepted described new Request, and refuse the new request after interception or forward the new request.
8. device according to claim 6, it is characterised in that also include:
Creation module, for the service logic according to registration, the correspondence service logic creates thread.
9. device according to claim 8, it is characterised in that also include:
Acquisition module, for by external interface, obtaining the service logic of registration.
10. device according to claim 8, it is characterised in that also include:
Callback module, for registering and being stored back into line transfer journey, to receive after out code, by described Adjust back thread and obtain not actuated thread.
CN201610140730.0A 2016-03-11 2016-03-11 Terminal shutdown method and device Active CN107179921B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201610140730.0A CN107179921B (en) 2016-03-11 2016-03-11 Terminal shutdown method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201610140730.0A CN107179921B (en) 2016-03-11 2016-03-11 Terminal shutdown method and device

Publications (2)

Publication Number Publication Date
CN107179921A true CN107179921A (en) 2017-09-19
CN107179921B CN107179921B (en) 2020-10-02

Family

ID=59830731

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201610140730.0A Active CN107179921B (en) 2016-03-11 2016-03-11 Terminal shutdown method and device

Country Status (1)

Country Link
CN (1) CN107179921B (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112559057A (en) * 2020-11-17 2021-03-26 新华三技术有限公司成都分公司 Shutdown processing method and device

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2001331331A (en) * 2000-05-18 2001-11-30 Nec Corp Unique process multithread operating system
US20020174163A1 (en) * 2001-04-05 2002-11-21 International Business Machines Corporation Method, apparatus, and program to keep a JVM running during the shutdown process of a Java based server executing daemon threads
CN101741967A (en) * 2008-11-21 2010-06-16 爱思开电讯投资(中国)有限公司 Terminal for realizing normal shutdown and method thereof
CN101924830A (en) * 2010-07-21 2010-12-22 宇龙计算机通信科技(深圳)有限公司 A kind of closedown method of portable terminal, system and portable terminal
CN103793667A (en) * 2012-11-03 2014-05-14 上海欧朋软件有限公司 Server shutdown method

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2001331331A (en) * 2000-05-18 2001-11-30 Nec Corp Unique process multithread operating system
US20020174163A1 (en) * 2001-04-05 2002-11-21 International Business Machines Corporation Method, apparatus, and program to keep a JVM running during the shutdown process of a Java based server executing daemon threads
CN101741967A (en) * 2008-11-21 2010-06-16 爱思开电讯投资(中国)有限公司 Terminal for realizing normal shutdown and method thereof
CN101924830A (en) * 2010-07-21 2010-12-22 宇龙计算机通信科技(深圳)有限公司 A kind of closedown method of portable terminal, system and portable terminal
CN103793667A (en) * 2012-11-03 2014-05-14 上海欧朋软件有限公司 Server shutdown method

Non-Patent Citations (2)

* Cited by examiner, † Cited by third party
Title
[美]ARNOLD.K 等著,虞万荣 等译: "《Java编程语言(第三版)》", 31 December 2003, 北京:中国电力出版社 *
宁正元 等: "《Delphi程序设计与应用教程》", 31 January 2005, 厦门:厦门大学出版社 *

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112559057A (en) * 2020-11-17 2021-03-26 新华三技术有限公司成都分公司 Shutdown processing method and device
CN112559057B (en) * 2020-11-17 2022-05-27 新华三技术有限公司成都分公司 Shutdown processing method and device

Also Published As

Publication number Publication date
CN107179921B (en) 2020-10-02

Similar Documents

Publication Publication Date Title
WO2021008413A1 (en) Fault prompting method for internet of things device, and related apparatus
CN107911249B (en) Method, device and equipment for sending command line of network equipment
CN108121608A (en) A kind of array dispatching method and node device
CN104484223B (en) A kind of Android system application method for closing and device
CN108377232B (en) Multi-protocol communication method and device, electronic equipment and readable storage medium
CN111708584A (en) Vehicle diagnosis method and device, diagnosis equipment and storage medium
CN109462502A (en) Configuration information saves control method, device and the SDN controller of instruction
CN106055239A (en) Screen recording method and device
CN106293987A (en) A kind of method and apparatus repairing starting up of terminal exception
CN108112010A (en) Access method, apparatus, terminal and the computer readable storage medium of network
CN109086065A (en) A kind of method for upgrading software, system and terminal device
CN103701653B (en) The processing method of a kind of interface hot plug configuration data and network configuration server
CN107179921A (en) Terminal closedown method and apparatus
CN105930178A (en) Configurable parameter dynamic loading method and system
CN107609197B (en) A kind of method of data synchronization, data synchronization unit and mobile terminal
CN103645922A (en) Software cleaning method based on cloud query
CN103019695A (en) Data object and state control logical separation system and method
CN109086102A (en) Dynamic loading method, device and the storage medium of diagnostic software
EP1915696A1 (en) Dma simultaneous transfer to multiple memories
CN107193821B (en) Monitoring method and system
CN108287761A (en) Method for recovering internal storage and device, terminal device and computer readable storage medium
CN106535161B (en) The method, apparatus and intelligent terminal of intelligent terminal progress intelligent dialing
CN108845767B (en) Method, system, device and storage medium for cache acceleration management of volume in storage
CN106055532A (en) Processing method and device for data replication
CN113849379B (en) Method, device, equipment and readable medium for collecting server asset information

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
REG Reference to a national code

Ref country code: HK

Ref legal event code: DE

Ref document number: 1244324

Country of ref document: HK

GR01 Patent grant
GR01 Patent grant
TR01 Transfer of patent right
TR01 Transfer of patent right

Effective date of registration: 20200925

Address after: Cayman Enterprise Centre, 27 Hospital Road, George Town, Grand Cayman Islands

Patentee after: Innovative advanced technology Co.,Ltd.

Address before: Cayman Enterprise Centre, 27 Hospital Road, George Town, Grand Cayman Islands

Patentee before: Advanced innovation technology Co.,Ltd.

Effective date of registration: 20200925

Address after: Cayman Enterprise Centre, 27 Hospital Road, George Town, Grand Cayman Islands

Patentee after: Advanced innovation technology Co.,Ltd.

Address before: A four-storey 847 mailbox in Grand Cayman Capital Building, British Cayman Islands

Patentee before: Alibaba Group Holding Ltd.