CN107301097A - It is a kind of to call java objects, the storage method of the reference address information of java objects and device - Google Patents

It is a kind of to call java objects, the storage method of the reference address information of java objects and device Download PDF

Info

Publication number
CN107301097A
CN107301097A CN201610230695.1A CN201610230695A CN107301097A CN 107301097 A CN107301097 A CN 107301097A CN 201610230695 A CN201610230695 A CN 201610230695A CN 107301097 A CN107301097 A CN 107301097A
Authority
CN
China
Prior art keywords
java
java objects
reference address
tables
data
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
CN201610230695.1A
Other languages
Chinese (zh)
Other versions
CN107301097B (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 CN201610230695.1A priority Critical patent/CN107301097B/en
Publication of CN107301097A publication Critical patent/CN107301097A/en
Application granted granted Critical
Publication of CN107301097B publication Critical patent/CN107301097B/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/46Multiprogramming arrangements
    • G06F9/54Interprogram communication
    • G06F9/541Interprogram communication via adapters, e.g. between incompatible applications

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Devices For Executing Special Programs (AREA)
  • Stored Programmes (AREA)

Abstract

Java objects, the storage method of the reference address information of java objects and device are called this application discloses a kind of.This calls the method for java objects to include:Trigger call instruction of the code to java objects of appointed language;First tables of data is inquired about by the call instruction, determine whether to preserve the reference address information of the java objects in first tables of data, the bar number of the reference address information for the java objects that first tables of data can be preserved, the second tables of data set up more than java local interfaces JNI by the appointed language, the bar number of the reference address information for the java objects that can be preserved;When it is present, the java objects are called by the reference address information of the java objects;When in the absence of when, the java objects are called by java local interfaces JNI.Therefore prior art is solved, due to the second tables of data that java local interfaces JNI is set up by the appointed language, the reference address information of a small amount of java objects can only be preserved, cause the problem of java object utilities malfunction.

Description

It is a kind of to call java objects, the storage method of the reference address information of java objects and device
Technical field
The application is related to computer programming language technical field, more particularly to one kind calls java objects, java The storage method and device of the reference address information of object.
Background technology
Java language is a kind of object oriented program language, the java languages in programming process Code interpreter is strong, so that java language is widely used, and some conventional are browsed in daily life What the java Applet in device were write by java language.Definition is usually required during java language uses Or statement class, method and data can be included in class.When calling the method or data in class, it is necessary to first will Such instantiation generation java object, then call by the java objects method or data in such.
In practical application it is possible that, the code of some module is write by java language in same application, And the code of other modules is write by the extralinguistic other Languages of java (such as C language, C++), Or the code of application and system is write by java language and other Languages respectively.Therefore program is operationally, Need java language can be recognized and call mutually with other Languages.Wherein, other Languages is calling java During method in the class of language, it is also desirable to pass through the java objects for calling such to generate.Currently, it can typically lead to Cross java local interfaces (java native interface, JNI) and call java objects to solve other Languages Problem.Java local interfaces JNI is by providing multiple application programming interface (application Programming interface, API) so that other Languages can realize java objects by these API Call.
In practical application, when the code of other Languages is longer, generally it there is also in the code running Need the situation for repeating to call same java objects.At this time for the ease of calling, prior art would generally By the reference address of the java objects, enter in the tables of data that java local interfaces JNI is set up by the language Row is preserved.The code of the language obtains this when needing to call the java objects by inquiring about the tables of data The reference address of java objects, is called so as to realize to the java objects.
This problem of the prior art is, due to being limited by syntax rule, and java local interfaces JNI leads to The tables of data of language foundation is crossed, is typically only capable to preserve the reference address of less amount of java objects.Therefore will The reference address of java objects is stored in the tables of data, when the quantity for the java objects for needing to call is more, The phenomenon of java object references error generally occurs.
The content of the invention
The embodiment of the present application offer is a kind of to call java objects, the storage side of the reference address information of java objects Method and device, for solving during the code call java objects of other Languages in the prior art, due to java In the tables of data that local interface JNI is set up by the language, the reference of a small amount of java objects can only be preserved Location, causes the problem of java object utilities malfunction.
The embodiment of the present application provides a kind of method for calling java objects, and this method includes:
Trigger call instruction of the code to java objects of appointed language;
First tables of data is inquired about by the call instruction, determines whether preserved in first tables of data State the reference address information of java objects, the reference for the java objects that first tables of data can be preserved The bar number of location information, the second tables of data energy set up more than java local interfaces JNI by the appointed language The bar number of the reference address information of the java objects enough preserved;
When it is present, the java objects are called by the reference address information of the java objects;
When in the absence of when, the java objects are called by java local interfaces JNI.
Preferably, the reference address information of the java objects specifically includes the reference with the java objects The associated unique identifier in address;Then,
The reference address information by the java objects calls the java objects to specifically include:
JNI is called to quote management group by the unique identifier associated with the reference address of the java objects Part is adjusted to obtain the reference address of the java objects according to the reference address of acquired java objects With the java objects, the JNI quotes management assembly and passed through for managing the code of the appointed language Java local interfaces JNI is called to java objects.
Preferably, after the java objects are called by java local interfaces JNI, methods described is also wrapped Include:The reference address information of the java objects is stored in the first tables of data.
Preferably, the reference address information by the java objects is stored in the first tables of data and specifically included:
The generation unique identifier associated with the reference address of the java objects, and by the unique mark Symbol is stored in the first tables of data.
Preferably, methods described also includes:Set up in java local interfaces JNI by the appointed language In second tables of data, the reference address information of the java objects is deleted.
Preferably, it is characterised in that
The code of the appointed language specifically includes the code of C language and/or the code of C Plus Plus;And/or,
First tables of data specifically includes the tables of data that java local interfaces JNI is set up by java language.
The embodiment of the present application also provides a kind of storage method of the reference address information of java objects, this method bag Include:
When receiving the code of appointed language to the call instructions of java objects, pass through java local interfaces JNI Obtain the java objects;
The reference address information of the java objects is stored in the first tables of data, first tables of data can The bar number of the reference address information of the java objects of preservation, is specified more than java local interfaces JNI by described The bar number of the reference address information for the java objects that the second tables of data that language is set up can be preserved.
The embodiment of the present application also provides a kind of device for calling java objects, and the device includes:Trigger element, Judging unit, the first call unit and the second call unit, wherein:
The trigger element, call instruction of the code to java objects for triggering appointed language;
The judging unit, for inquiring about the first tables of data by the call instruction, determines first number According to whether preserving the reference address information of the java objects in table, if so, the first call unit is then triggered, If it is not, the second call unit is then triggered, the reference address for the java objects that first tables of data can be preserved The bar number of information, can more than java local interfaces JNI the second tables of data set up by the appointed language The bar number of the reference address information of the java objects of preservation;
First call unit, the java is called for the reference address information by the java objects Object;
Second call unit, for calling the java objects by java local interfaces JNI.
It is preferred that, the reference address information of the java objects specifically includes the reference with the java objects The associated unique identifier in address;Then,
First call unit specifically includes first and calls subelement, for by with the java objects The associated unique identifier of reference address calls JNI to quote management assembly to obtain drawing for the java objects With address, and the java objects, the JNI are called according to the reference address of acquired java objects Quoting management assembly is used to manage the code of the appointed language by java local interfaces JNI to java objects Call.
The embodiment of the present application also provides a kind of storage device of the reference address information of java objects, the device bag Include:Acquiring unit and memory cell, wherein:
The acquiring unit, for when receiving the code of appointed language to the call instructions of java objects, leading to Cross java local interfaces JNI and obtain the java objects;
The memory cell, for the reference address information of the java objects to be stored in into the first tables of data, The bar number of the reference address information for the java objects that first tables of data can be preserved, it is local more than java The reference address for the java objects that the second tables of data that interface JNI is set up by the appointed language can be preserved The bar number of information.
At least one above-mentioned technical scheme that the embodiment of the present application is used can reach following beneficial effect:
Due to after call instruction of the code of appointed language to java objects is triggered, being looked into by the call instruction The first tables of data is ask, according to the preservation in first tables of data to the reference address information of the java objects Situation calls the java objects.And the reference for the java objects that first tables of data can be preserved The bar number of location information, the second tables of data set up more than java local interfaces JNI by the appointed language, The bar number of the reference address information for the java objects that can be preserved.So as to solve in the prior art, due to the The reference address information for the java objects that can be preserved in two tables of data is less, java pairs called in needs In the case of more, the problem of being malfunctioned to these java object references may result in..
Brief description of the drawings
Accompanying drawing described herein is used for providing further understanding of the present application, constitutes the part of the application, The schematic description and description of the application is used to explain the application, does not constitute the improper limit to the application It is fixed.In the accompanying drawings:
Fig. 1 is that a kind of flow that implements for method for calling java objects that the embodiment of the present application 1 is provided is shown It is intended to;
Fig. 2 is a kind of method for calling java objects of the offer of the embodiment of the present application 1 under concrete application scene Implement schematic flow sheet;
Fig. 3 is a kind of the specific of the storage method of the reference address for java objects that the embodiment of the present application 2 is provided Implementation process schematic diagram;
Fig. 4 is a kind of concrete structure schematic diagram for device for calling java objects that the embodiment of the present application 3 is provided;
Fig. 5 is a kind of the specific of the storage device of the reference address for java objects that the embodiment of the present application 4 is provided Structural representation.
Embodiment
It is specifically real below in conjunction with the application to make the purpose, technical scheme and advantage of the application clearer Apply example and technical scheme is clearly and completely described corresponding accompanying drawing.Obviously, it is described Embodiment is only some embodiments of the present application, rather than whole embodiments.Based on the implementation in the application Example, the every other implementation that those of ordinary skill in the art are obtained under the premise of creative work is not made Example, belongs to the scope of the application protection.
Below in conjunction with accompanying drawing, the technical scheme that each embodiment of the application is provided is described in detail.
Embodiment 1
As it was previously stated, in actual applications, the code of the certain module due to same application often occurs Write by java language, and the code of other modules passes through other Languages (such as C language, C++) Write, or the code of application and system is write by java language and other Languages respectively, therefore in java Usually require to call mutually between language and other Languages.When other Languages calls java language, by The characteristics of itself object-oriented of java language, thus how to call java objects become one it is important Factor.Under normal circumstances, other Languages can be realized to java objects by java local interfaces JNI Call.
In addition, generally there is also one section of code of other Languages operationally, it is necessary to repeatedly call same The situation of java objects.Particularly, code it is longer when, such case more generally occurs.It is existing In technology, for the ease of being called to the java objects, it is common practice to by the reference of the java objects Address, is preserved in the tables of data that java local interfaces JNI is set up by the language.The generation of the language Code is when needing to call the java objects, the reference of the java objects is obtained by inquiring about the tables of data Location, is called so as to be realized by the reference address of the java objects to the java objects.
But in actual applications, it will usually limited by syntax rule, java local interfaces JNI correspondences , the tables of data of the language is typically only capable to preserve the reference address of less amount of java objects.If by java The reference address of object is stored in the tables of data, when run into need call java objects it is a fairly large number of During situation, it will usually situation about can not call occur, the code that the language is resulted even in when serious is difficult to transport OK.
Below by by taking the java objects in the code call java codes of C language as an example.In actual applications, According to syntax rule, the tables of data that java local interfaces JNI is set up by C language is typically only capable to preservation 512 The reference address of individual java objects.In the case where the code of C language is longer, it will usually occur needing to adjust The quantity of java objects is more than 512 phenomenon.At this time, if by the reference of these java objects Address is stored in the tables of data, it will the situation that some java objects are difficult to call occur, can when serious The code of the C language can be caused to be difficult to run.
In view of this defect, this application provides a kind of method for calling java objects, for solve it is above-mentioned in, The code of other Languages is called by the reference address for the java objects being stored in the tables of data of the language During java objects, the negligible amounts of the reference address for the java objects that can be preserved due to the tables of data, and lead The problem of cause is difficult to call.The schematic flow sheet of this method is as shown in figure 1, comprise the steps:
Step S11:Trigger call instruction of the code to java objects of appointed language.
Herein, the code of appointed language refers to the code write by appointed language, and the appointed language can be with It is C language, C Plus Plus or its of java objects can be called by java local interfaces JNI Its language.
When including the instruction of the java objects called in java codes in the code of appointed language, at this In the running of the code of appointed language, it will usually trigger the instruction, the tune to carry out the java objects With.
Step S12:By the call instruction inquire about the first tables of data, determine be in first tables of data The no reference address information for preserving the java objects, when it is present, perform step S13, when in the absence of When, perform step S14.
Herein, the bar number of the reference address information for the java objects that first tables of data can be preserved, The second tables of data set up more than java local interfaces JNI by the appointed language, the java that can be preserved The bar number of the reference address information of object.
In actual applications, because the code call of the appointed language is java objects in java codes. Therefore calling for the ease of the java objects, generally can locally be connect first tables of data by java Mouth JNI transfers java language to set up.That is, first tables of data generally can be that java is local The tables of data that interface JNI is set up by java language.According to syntax rule, set up in this way The bar number of the reference address information for the java objects that first tables of data can be preserved, it will usually more than java sheets The second tables of data that ground interface JNI is set up by the appointed language, the reference for the java objects that can be preserved The bar number of location information.
By taking the java objects in the code call java codes of C language as an example, according to syntax rule, java The second tables of data that local interface JNI is set up by C language is typically only capable to enough 512 java objects of preservation Reference address information, but the first tables of data that java local interfaces JNI is set up by java language, can The bar number of the reference address information of the java objects of preservation is typically larger than 512.
First tables of data is inquired about by the call instruction, determines whether preserved in first tables of data State the reference address information of java objects.In actual applications, when the call instruction of java objects is triggered Afterwards, can by the tables of data of instructions query first, according to Query Result determine in first tables of data whether Preserve the reference address information of the java objects.
It is further to note that in actual applications, can also generally be managed by a module to java Calling for object, is called especially by java local interfaces JNI to java objects, can claim the module Management module (java Native Interface Reference Manager) is quoted for JNI.The module generally may be used Java objects in java language are called for management appointed language, particularly appointed language passes through java Local interface JNI is called to java objects.In addition, during the actual development module, due to language The difference of rule is sayed, the JNI quotes management module generally and the appointed language has corresponding relation.For example, When the appointed language is C language, the JNI quotes the corresponding code for being used to manage C language of management module Java objects are called by java local interfaces JNI;, should when the appointed language is C Plus Plus JNI, which quotes management module, to be used to manage the code of C Plus Plus by java local interfaces JNI to java objects Call;When the appointed language is other language, the JNI, which quotes management module, to be used to manage correspondence language The code of speech is called by java local interfaces JNI to java objects.Certainly, herein can't be right The form that JNI quotes management assembly is defined, it is only necessary to illustrate that the JNI quotes management assembly and is used to manage The code of appointed language is called by java local interfaces JNI to java objects, would not influence the present invention Technique effect.
Particularly, the reference address information of java objects herein refers to the reference address of java objects Information, the information is used for the reference address for determining the java, and the reference address of the java objects is used to lead to Cross the reference address and call the java objects.In actual applications, the reference address information of java objects is usual Can directly be the reference address of java objects or related to the reference address of the java objects The other information of connection, the reference address of the java objects can be determined by the other information, the other information Form can be unique identifier.That is, the reference address information of the java objects is specifically included The unique identifier associated with the reference address of the java objects.
Step S13:When it is present, described java pairs is called by the reference address information of the java objects As.
When preserving the reference address information of the java objects in the first tables of data, the java can be passed through The reference address information of object calls the java objects.
In actual applications, due to java objects reference address message form difference, generally call the java The mode of object is also different.For example, when the reference address information of the java objects is just drawing for java objects When using address, the java objects directly can be called by the reference address information of the java objects;Work as institute The information for stating the reference address of java objects is specially associated only with the reference address of the java objects During one identifier, the reference address information by the java objects calls the java objects specific Including:JNI is called to quote management by the unique identifier associated with the reference address of the java objects Component obtains the reference address of the java objects, and according to the reference address of acquired java objects The java objects are called, the JNI quotes management assembly and passed through for managing the code of the appointed language Java local interfaces JNI is called to java objects.
Step S14:When in the absence of when, the java objects are called by java local interfaces JNI.
When the reference address information for not having to preserve the java objects in the first tables of data, java can be passed through Local interface JNI calls the java objects in the java codes.
In actual applications, the scene generally further encountered is, the code of appointed language operationally needs many It is secondary to call same java objects.So for the ease of repeatedly calling to the java objects, generally logical Cross after java local interfaces JNI calls the java objects, can also be by the reference of the java objects Address information is preserved.So cause, when the java objects are called in next time, inquiry first can be passed through Tables of data obtains the reference address information of the java objects, so that call the java objects more square Just.Therefore, a kind of preferred scheme in practical application is, described being called by java local interfaces JNI After java objects, the reference address information of the java objects is stored in the first tables of data.
In practical application, when the reference address information of java objects is specially the reference with the java objects During the unique identifier that address is associated, the reference address information of the java objects is stored in the first data The mode of table can specifically include step S141.
Step S141:The generation unique identifier associated with the reference address of the java objects, and will The unique identifier storage is in the first tables of data.
Herein, the form of the unique identifier generated can also have a variety of, for example, can use integer shape The Arabic numerals of formula are used as unique identifier, it would however also be possible to employ English alphabet also may be used as unique identifier To add English alphabet as unique identifier using Arabic numerals, naturally it is also possible to take other form only One identifier.In addition, the method for generation unique identifier has a lot, for example, unique mark can be generated at random Symbol, can also generate unique identifier by way of numerical value progressively increases, can also be by the generation of other methods only One identifier, generally can generate unique identifier by way of numerical value progressively increases in actual applications.Here Restriction is not made to the method for generation unique identifier, and the form of unique identifier.In addition, by institute Stating unique identifier storage can be by calling JNI to quote management assembly by unique mark in the first tables of data Know symbol and be stored in the first tables of data.
When first time calling java objects, the java objects are not preserved in usual first tables of data Reference address information, the java objects, Ran Housheng can be at this time called by java local interfaces JNI Into the unique identifier associated with the reference address information of the java objects, and by calling JNI to quote pipe Reason component is by the unique identifier storage in the first tables of data.It can so cause, this is called after During java objects, by inquiring about the first database, the reference address information of the java objects can be obtained, and The java objects are called according to the reference address information of the java objects, so as to more facilitate the java Object is called.
It should be further stated that, under actual conditions, in step s 13, pass through drawing for the java objects When calling java objects with address information, generally it is also required to be called by java local interfaces JNI. And the rule of java objects is called according to java local interfaces JNI, during the java objects are called, The reference address information of the java objects can be set up in java local interfaces JNI by the appointed language Preserved, called in this point and step S14 by java local interfaces JNI described in second tables of data Java objects are identical.Therefore, after by java local interfaces JNI by the java object references, generally Step S15 can also be included.
Step S15:In the second tables of data that java local interfaces JNI is set up by the appointed language, Delete the reference address information of the java objects.
When calling java objects by java local interfaces JNI, completed in the invoked procedure of java objects Afterwards, the reference address of the java objects in the second database can also be deleted, so only need to by The reference address of the java objects is preserved in the first database, and storage can be saved in actual applications Resource.
Using the method for calling java objects in the embodiment of the present application 1, in the code pair of triggering appointed language After the call instruction of java objects, the first tables of data is inquired about by the call instruction, according to first data The java objects are called in table to the preservation situation of the reference address information of the java objects, by institute The bar number of the reference address information for the java objects that the first tables of data can be preserved is stated, is locally connect more than java The second tables of data that mouth JNI is set up by the appointed language, the reference address for the java objects that can be preserved The bar number of information.So as to solve in the prior art, due to the java objects that can be preserved in the second tables of data Reference address information it is less, in the case where needing the java objects that call more, may cause to these The problem of java object references malfunction.
It should be noted that the executive agent that embodiment 1 provides each step of method may each be same and set It is standby, or, each step of this method can also be used as executive agent by distinct device.Such as, step S11 Executive agent with step S12 can be equipment 1;Again such as, step S11 executive agent can be to set Standby 1, the executive agent of step S12 sums can be equipment 2;Etc..
Above is the explanation of the method for calling java objects provided the embodiment of the present application.In order to make it easy to understand, The embodiment of the present application is additionally provided in practical application, implements the concrete application scene of this method.The application scenarios For the java objects in the code call java codes of C language.Under the application scenarios, appointed language is C Language, the code of appointed language is the code of C language.As shown in table 2, shown method under the application scenarios Specifically it may comprise steps of:
Step S21:Trigger call instruction of the code to the java objects in java codes of C language;
Step S22:First tables of data is inquired about by the call instruction;
First tables of data is specially the tables of data that java local interfaces JNI is set up by java language.
Step S23:Determine whether preserved in first tables of data and described java pairs according to Query Result The associated unique identifier of the reference address of elephant, if step S24 is then performed to step S26, if not, then holding Row step S27 to step S29;
Step S24:Obtain the unique identifier;
Step S25:Call JNI to quote management assembly to obtain the java objects by unique identifier Reference address;
Herein, JNI reference management assemblies pass through java local interfaces JNI for managing the code of C language Java objects are called.
Step S26:The java objects are called according to the reference address of acquired java objects;
Step S27:The java objects are called by java local interfaces JNI;
Step S28:The generation unique identifier associated with the reference address of the java objects;
Step S29:Management assembly is quoted by the unique identifier storage of generation in the first tables of data by JNI;
Step S210:In the second tables of data that java local interfaces JNI is set up by C language, delete The reference address information of the java objects.
In addition, it is necessary to explanation, because C Plus Plus and C language have similar syntax rule, therefore this Apply in java Object Process of the embodiment in the code call java codes of C Plus Plus, with the application The similar process of scene is similar, herein just not otherwise indicated.
Embodiment 2
Embodiments herein 2 provides a kind of storage method of the reference address of java objects, for solving In the prior art, when calling java objects by java local interfaces JNI, due to the java that can be called Number of objects is less to cause the problem of possibly can not be run.The flow chart of this method is as shown in figure 3, this method The step of include:
Step S31:When receiving the code of appointed language to the call instructions of java objects, pass through java sheets Ground interface JNI obtains the java objects.
Herein, the code of appointed language refers to the code that appointed language is write, and the appointed language generally can be with Make C language or C Plus Plus or java can be called by java local interfaces JNI The other Languages of object.
In actual applications, java local interfaces JNI can provide multiple application programming interfaces (application programming interface, API) so that other Languages can pass through these API Obtain the java objects.
Step S32:The reference address information of the java objects is stored in the first tables of data.
Herein, the bar number of the reference address information for the java objects that first tables of data can be preserved, greatly The java objects that can be preserved in java local interfaces JNI the second tables of data set up by the appointed language Reference address information bar number.
In actual applications, the form of first tables of data can have a variety of, generate the side of first tables of data Formula can also have a variety of.But, the reference address information for the java objects that first tables of data can be preserved Bar number, the second tables of data set up more than java local interfaces JNI by the appointed language, can be preserved Java objects reference address information bar number.Wherein, it is a kind of generate the first tables of data preferred scheme be, Java local interfaces JNI sets up first tables of data by java language.It can so inquiring about the number According to expression, it is more prone to realize.
In actual applications, the reference address information of the java objects is stored in the mode of the first tables of data Can have a variety of.A kind of preferred scheme is, by calling JNI to quote management assembly by the java objects Reference address information is stored in the first tables of data.Wherein, the JNI quotes management assembly and is used to manage the finger The code of attribute speech calls java objects by java local interfaces JNI.
The method provided using the embodiment of the present application 2, java is being obtained by java local interfaces JNI After object, the reference address information of the java objects is stored in the first tables of data, due to the first data The bar number of the reference address information for the java objects that table can be preserved, institute is passed through more than java local interfaces JNI State appointed language foundation the second tables of data, the bar number of the reference address information for the java objects that can be preserved, Therefore problem of the prior art is solved.
Embodiment 3
Using inventive concept same as Example 1, embodiments herein 3 calls java there is provided one kind The device of object, the device 40 includes:Trigger element 401, judging unit 402, the first call unit 403 With the second call unit 404, wherein:
The trigger element 401, call instruction of the code to java objects for triggering appointed language;
The judging unit 402, for inquiring about the first tables of data by the call instruction, determines described the Whether the reference address information of the java object is preserved in one tables of data, if so, then triggering first is called Unit 403, if it is not, the second call unit 404 is then triggered, the java that first tables of data can be preserved The bar number of the reference address information of object, is set up more than java local interfaces JNI by the appointed language The bar number of the reference address information for the java objects that second tables of data can be preserved;
First call unit 403, is called described for the reference address information by the java objects Java objects;
Second call unit 404, for calling the java objects by java local interfaces JNI.
Embodiments herein 3 due to using and the identical inventive concept of embodiment 1, therefore can obtain and The identical invention effect of embodiment 1.In addition, in actual applications, the device 40 that embodiment 3 is provided is also Other implementation results can be obtained by being combined with hardware unit.For example, the code in appointed language is needed When the java objects to be called are more, during these java objects are called, the first tables of data is inquired about Frequency generally it is higher, at this time can by first tables of data preserve in the buffer, can so accelerate adjust Speed.Certainly, this is that the device 40 combines one of technique effect that hardware unit is obtained, in tool It is also possible to that other technique effects can be obtained in body implementation process, will not enumerate here.
Herein, the reference address information of java objects refers to the information of the reference address of java objects, the letter The reference address for determining the java is ceased, the reference address of the java objects is used for passing through the reference Call the java objects in location.Generally, the reference address information of java objects can directly be drawing for java objects It is other by this with address or the other information associated with the reference address of the java objects Information can determine the reference address of the java objects, and the form of the other information can be unique identifier. In actual applications, a kind of preferred scheme is that the reference address information of the java objects is and the java The associated unique identifier of the reference address of object;Then, first call unit 403 specifically includes One calls subelement 4031, for passing through the unique mark associated with the reference address of the java objects Symbol calls JNI to quote management assembly to obtain the reference address of the java objects, and according to acquired The reference address of java objects calls the java objects, and the JNI, which quotes management assembly, to be used to manage described The code of appointed language is called by java local interfaces JNI to java objects.
Embodiment 4
Using inventive concept same as Example 2, the application also provides a kind of reference address of java objects The storage device of information, the device 50 includes:Acquiring unit 501 and memory cell 502, wherein:
The acquiring unit 501, for when receiving the code of appointed language to the call instructions of java objects, The java objects are obtained by java local interfaces JNI;
The memory cell 502, for the reference address information of the java objects to be stored in into the first data Table, the bar number of the reference address information for the java objects that first tables of data can be preserved, more than java The reference for the java objects that the second tables of data that local interface JNI is set up by the appointed language can be preserved The bar number of address information.
The device 50 provided using the embodiment of the present application 4, java pairs is obtained by acquiring unit 501 As after, the reference address information of the java objects is stored in the first tables of data by memory cell 502, The bar number of the reference address information for the java objects that can be preserved due to the first tables of data, it is local more than java The second tables of data that interface JNI is set up by the appointed language, the reference for the java objects that can be preserved The bar number of location information, therefore solve problem of the prior art.
It should be understood by those skilled in the art that, embodiments herein can be provided as method, system or meter Calculation machine program product.Therefore, the application can be using complete hardware embodiment, complete software embodiment or knot The form of embodiment in terms of conjunction software and hardware.Wherein wrapped one or more moreover, the application can be used Containing computer usable program code computer-usable storage medium (include but is not limited to magnetic disk storage, CD-ROM, optical memory etc.) on the form of computer program product implemented.
The application is produced with reference to according to the method, equipment (system) and computer program of the embodiment of the present application The flow chart and/or block diagram of product is described.It should be understood that can by computer program instructions implementation process figure and / or each flow and/or square frame in block diagram and the flow in flow chart and/or block diagram and/ Or the combination of square frame.These computer program instructions can be provided to all-purpose computer, special-purpose computer, insertion Formula processor or the processor of other programmable data processing devices are to produce a machine so that pass through and calculate The instruction of the computing device of machine or other programmable data processing devices is produced for realizing in flow chart one The device for the function of being specified in individual flow or multiple flows and/or one square frame of block diagram or multiple square frames.
These computer program instructions, which may be alternatively stored in, can guide computer or the processing of other programmable datas to set In the standby computer-readable memory worked in a specific way so that be stored in the computer-readable memory Instruction produce include the manufacture of command device, the command device realization in one flow or multiple of flow chart The function of being specified in one square frame of flow and/or block diagram or multiple square frames.
These computer program instructions can be also loaded into computer or other programmable data processing devices, made Obtain and perform series of operation steps on computer or other programmable devices to produce computer implemented place Reason, so that the instruction performed on computer or other programmable devices is provided for realizing in flow chart one The step of function of being specified in flow or multiple flows and/or one square frame of block diagram or multiple square frames.
In a typical configuration, computing device includes one or more processors (CPU), input/defeated Outgoing interface, network interface and internal memory.
Internal memory potentially includes the volatile memory in computer-readable medium, random access memory And/or the form, such as read-only storage (ROM) or flash memory (flash RAM) such as Nonvolatile memory (RAM). Internal memory is the example of computer-readable medium.
Computer-readable medium includes permanent and non-permanent, removable and non-removable media can be by appointing What method or technique realizes that information is stored.Information can be computer-readable instruction, data structure, program Module or other data.The example of the storage medium of computer includes, but are not limited to phase transition internal memory (PRAM), static RAM (SRAM), dynamic random access memory (DRAM), its Random access memory (RAM), read-only storage (ROM), the electrically erasable of his type are read-only Memory (EEPROM), fast flash memory bank or other memory techniques, read-only optical disc read-only storage (CD-ROM), digital versatile disc (DVD) or other optical storages, magnetic cassette tape, tape magnetic Disk storage or other magnetic storage apparatus or any other non-transmission medium, can be calculated available for storage The information that equipment is accessed.Defined according to herein, computer-readable medium does not include temporary computer-readable matchmaker The data-signal and carrier wave of body (transitory media), such as modulation.
It should also be noted that, term " comprising ", "comprising" or its any other variant be intended to it is non- It is exclusive to include, so that process, method, commodity or equipment including a series of key elements are not only wrapped Include those key elements, but also other key elements including being not expressly set out, or also include for this process, Method, commodity or the intrinsic key element of equipment.In the absence of more restrictions, by sentence " including One ... " limit key element, it is not excluded that in the process including key element, method, commodity or equipment Also there is other identical element.
It will be understood by those skilled in the art that embodiments herein can be provided as method, system or computer journey Sequence product.Therefore, the application can using complete hardware embodiment, complete software embodiment or combine software and The form of the embodiment of hardware aspect.Moreover, the application can be used wherein includes calculating one or more Machine usable program code computer-usable storage medium (include but is not limited to magnetic disk storage, CD-ROM, Optical memory etc.) on the form of computer program product implemented.
Embodiments herein is these are only, the application is not limited to.For people in the art For member, the application can have various modifications and variations.It is all to be made within spirit herein and principle Any modification, equivalent substitution and improvements etc., should be included within the scope of claims hereof.

Claims (10)

1. a kind of method for calling java objects, it is characterised in that including:
Trigger call instruction of the code to java objects of appointed language;
First tables of data is inquired about by the call instruction, determines whether preserved in first tables of data State the reference address information of java objects, the reference for the java objects that first tables of data can be preserved The bar number of location information, the second tables of data energy set up more than java local interfaces JNI by the appointed language The bar number of the reference address information of the java objects enough preserved;
When it is present, the java objects are called by the reference address information of the java objects;
When in the absence of when, the java objects are called by java local interfaces JNI.
2. method as claimed in claim 1, it is characterised in that the reference address information of the java objects Specifically include the unique identifier associated with the reference address of the java objects;Then,
The reference address information by the java objects calls the java objects to specifically include:
JNI is called to quote management group by the unique identifier associated with the reference address of the java objects Part is adjusted to obtain the reference address of the java objects according to the reference address of acquired java objects With the java objects, the JNI quotes management assembly and passed through for managing the code of the appointed language Java local interfaces JNI is called to java objects.
3. method as claimed in claim 1, it is characterised in that called by java local interfaces JNI After the java objects, methods described also includes:The reference address information of the java objects is stored In the first tables of data.
4. method as claimed in claim 3, it is characterised in that the reference by the java objects Location information is stored in the first tables of data and specifically included:
The generation unique identifier associated with the reference address of the java objects, and by the unique mark Symbol is stored in the first tables of data.
5. the method as described in claim 1, it is characterised in that methods described also includes:In java sheets In the second tables of data that ground interface JNI is set up by the appointed language, the reference of the java objects is deleted Address information.
6. method as claimed in claim 1, it is characterised in that
The code of the appointed language specifically includes the code of C language and/or the code of C Plus Plus;And/or,
First tables of data specifically includes the tables of data that java local interfaces JNI is set up by java language.
7. a kind of storage method of the reference address information of java objects, it is characterised in that including:
When receiving the code of appointed language to the call instructions of java objects, pass through java local interfaces JNI Obtain the java objects;
The reference address information of the java objects is stored in the first tables of data, first tables of data can The bar number of the reference address information of the java objects of preservation, is specified more than java local interfaces JNI by described The bar number of the reference address information for the java objects that the second tables of data that language is set up can be preserved.
8. a kind of device for calling java objects, it is characterised in that including:Trigger element, judging unit, First call unit and the second call unit, wherein:
The trigger element, call instruction of the code to java objects for triggering appointed language;
The judging unit, for inquiring about the first tables of data by the call instruction, determines first number According to whether preserving the reference address information of the java objects in table, if so, the first call unit is then triggered, If it is not, the second call unit is then triggered, the reference address for the java objects that first tables of data can be preserved The bar number of information, can more than java local interfaces JNI the second tables of data set up by the appointed language The bar number of the reference address information of the java objects of preservation;
First call unit, the java is called for the reference address information by the java objects Object;
Second call unit, for calling the java objects by java local interfaces JNI.
9. device as claimed in claim 8, it is characterised in that the reference address information of the java objects Specifically include the unique identifier associated with the reference address of the java objects;Then,
First call unit specifically includes first and calls subelement, for by with the java objects The associated unique identifier of reference address calls JNI to quote management assembly to obtain drawing for the java objects With address, and the java objects, the JNI are called according to the reference address of acquired java objects Quoting management assembly is used to manage the code of the appointed language by java local interfaces JNI to java objects Call.
10. a kind of storage device of the reference address information of java objects, it is characterised in that including:Obtain Unit and memory cell, wherein:
The acquiring unit, for when receiving the code of appointed language to the call instructions of java objects, leading to Cross java local interfaces JNI and obtain the java objects;
The memory cell, for the reference address information of the java objects to be stored in into the first tables of data, The bar number of the reference address information for the java objects that first tables of data can be preserved, it is local more than java The reference address for the java objects that the second tables of data that interface JNI is set up by the appointed language can be preserved The bar number of information.
CN201610230695.1A 2016-04-14 2016-04-14 Method and device for storing calling java object and reference address information of java object Active CN107301097B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201610230695.1A CN107301097B (en) 2016-04-14 2016-04-14 Method and device for storing calling java object and reference address information of java object

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201610230695.1A CN107301097B (en) 2016-04-14 2016-04-14 Method and device for storing calling java object and reference address information of java object

Publications (2)

Publication Number Publication Date
CN107301097A true CN107301097A (en) 2017-10-27
CN107301097B CN107301097B (en) 2020-05-08

Family

ID=60137472

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201610230695.1A Active CN107301097B (en) 2016-04-14 2016-04-14 Method and device for storing calling java object and reference address information of java object

Country Status (1)

Country Link
CN (1) CN107301097B (en)

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109462507A (en) * 2018-11-15 2019-03-12 北京金山云网络技术有限公司 Configure update method, device, system and electronic equipment
CN110990425A (en) * 2019-11-28 2020-04-10 中科驭数(北京)科技有限公司 JDBC driving method and device of hardware database
CN111324467A (en) * 2018-12-13 2020-06-23 北京嘀嘀无限科技发展有限公司 Business service calling method, device, equipment and storage medium

Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
KR20030075332A (en) * 2002-03-18 2003-09-26 엘지전자 주식회사 Method for cooperating BSM with java application in mobile communication
CN1746844A (en) * 2005-09-29 2006-03-15 浪潮电子信息产业股份有限公司 Method for monitoring and managing machine group system of cross-operation platform
US7350197B2 (en) * 2003-08-19 2008-03-25 Toshiba Corporation Method and apparatus for object-to-object Java Native Interface mapping
CN102662772A (en) * 2012-03-08 2012-09-12 河海大学 Method for realizing data communication between different languages in multi-language development system
CN103778067A (en) * 2014-02-11 2014-05-07 珠海市金邦达保密卡有限公司 Object processing method and device of Java card and Java card
CN104199654A (en) * 2014-08-27 2014-12-10 百度在线网络技术(北京)有限公司 Open platform calling method and device
CN104391730A (en) * 2014-08-03 2015-03-04 浙江网新恒天软件有限公司 Software source code language translation system and method

Patent Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
KR20030075332A (en) * 2002-03-18 2003-09-26 엘지전자 주식회사 Method for cooperating BSM with java application in mobile communication
US7350197B2 (en) * 2003-08-19 2008-03-25 Toshiba Corporation Method and apparatus for object-to-object Java Native Interface mapping
CN1746844A (en) * 2005-09-29 2006-03-15 浪潮电子信息产业股份有限公司 Method for monitoring and managing machine group system of cross-operation platform
CN102662772A (en) * 2012-03-08 2012-09-12 河海大学 Method for realizing data communication between different languages in multi-language development system
CN103778067A (en) * 2014-02-11 2014-05-07 珠海市金邦达保密卡有限公司 Object processing method and device of Java card and Java card
CN104391730A (en) * 2014-08-03 2015-03-04 浙江网新恒天软件有限公司 Software source code language translation system and method
CN104199654A (en) * 2014-08-27 2014-12-10 百度在线网络技术(北京)有限公司 Open platform calling method and device

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
雷灵光 等: ""一种基于行为的Android系统资源访问控制方案"", 《计算机研究与发展》 *

Cited By (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109462507A (en) * 2018-11-15 2019-03-12 北京金山云网络技术有限公司 Configure update method, device, system and electronic equipment
CN109462507B (en) * 2018-11-15 2021-09-28 北京金山云网络技术有限公司 Configuration updating method, device and system and electronic equipment
CN111324467A (en) * 2018-12-13 2020-06-23 北京嘀嘀无限科技发展有限公司 Business service calling method, device, equipment and storage medium
CN111324467B (en) * 2018-12-13 2023-08-08 北京嘀嘀无限科技发展有限公司 Business service calling method, device, equipment and storage medium
CN110990425A (en) * 2019-11-28 2020-04-10 中科驭数(北京)科技有限公司 JDBC driving method and device of hardware database
CN110990425B (en) * 2019-11-28 2020-12-25 中科驭数(北京)科技有限公司 JDBC driving method and device of hardware database

Also Published As

Publication number Publication date
CN107301097B (en) 2020-05-08

Similar Documents

Publication Publication Date Title
CN107424069B (en) Wind control feature generation method, risk monitoring method and equipment
CN107766101A (en) App starts processing method, device and the equipment of event
US11461410B2 (en) Case leaf nodes pointing to business objects or document types
CN112181804B (en) Parameter verification method, device and storage medium
CN106033439A (en) Method and system for processing distributed transaction
CN104346365A (en) Device and method for determining specific service associated logs
CN112416645A (en) Fault root cause inference positioning method and device based on artificial intelligence
CN105335310A (en) Interface defining method, and data transmission method and apparatus
CN107301097A (en) It is a kind of to call java objects, the storage method of the reference address information of java objects and device
CN106411970A (en) Fault handling method, device and system based on service call
CN111443901A (en) Business expansion method and device based on Java reflection
CN112765248A (en) SQL-based data extraction method and equipment
CN113157904B (en) Sensitive word filtering method and system based on DFA algorithm
CN107194280B (en) Model establishing method and device
CN107491700B (en) Data access method and equipment
CN105988785A (en) RPC (remote procedure call) service development method and device
CN112926008A (en) Method and device for generating form page, electronic equipment and storage medium
CN104765775A (en) Log saving method and device
CN112491943A (en) Data request method, device, storage medium and electronic equipment
CN106980617A (en) A kind of method and system based on JSON sentence operating databases
CN113095824B (en) Asset management method and device based on block chain and electronic equipment
CN105989445A (en) Rule management method and system
CN114629961A (en) Message format checking method and related equipment
CN114170007A (en) Orthogonal easy return message assembly method, program product, medium, and electronic device
CN107229651A (en) Unique constraints abnormal determination method, abnormality eliminating method and device

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
GR01 Patent grant
GR01 Patent grant
TR01 Transfer of patent right
TR01 Transfer of patent right

Effective date of registration: 20200918

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

Patentee after: Innovative advanced technology Co.,Ltd.

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

Patentee before: Advanced innovation technology Co.,Ltd.

Effective date of registration: 20200918

Address after: Cayman Enterprise Centre, 27 Hospital Road, George Town, Grand Cayman, British 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.