CN107301097B - Method and device for storing calling java object and reference address information of java object - Google Patents

Method and device for storing calling java object and reference address information of java object Download PDF

Info

Publication number
CN107301097B
CN107301097B CN201610230695.1A CN201610230695A CN107301097B CN 107301097 B CN107301097 B CN 107301097B CN 201610230695 A CN201610230695 A CN 201610230695A CN 107301097 B CN107301097 B CN 107301097B
Authority
CN
China
Prior art keywords
java
reference address
data table
address information
objects
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.)
Active
Application number
CN201610230695.1A
Other languages
Chinese (zh)
Other versions
CN107301097A (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

Images

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

The application discloses a method and a device for calling java objects and storing reference address information of the java objects. The method for calling the java object comprises the following steps: triggering an invoking instruction of the code of the specified language to the java object; querying a first data table through the calling instruction, and determining whether the reference address information of the java objects is stored in the first data table, wherein the number of the reference address information of the java objects which can be stored in the first data table is greater than the number of the reference address information of the java objects which can be stored in a second data table established by a java local interface JNI through the specified language; when the java object exists, calling the java object through the reference address information of the java object; and when the Java objects do not exist, calling the Java objects through a Java native interface JNI. Therefore, the problem that in the prior art, because the java local interface JNI only can store a small amount of reference address information of the java object through the second data table established by the specified language, the java object effectiveness is wrong is solved.

Description

Method and device for storing calling java object and reference address information of java object
Technical Field
The application relates to the technical field of computer programming languages, in particular to a method and a device for storing calling java objects and reference address information of the java objects.
Background
The java language is an object-oriented programming language, and codes written by the java language in the programming process have strong interpretability, so that the java language is widely used, and java applets in some commonly used browsers in daily life are written by the java language. The java language generally requires defining or declaring classes, which may contain methods and data. When a method or data in a class is called, the class needs to be instantiated to generate a java object, and then the method or data in the class is called through the java object.
In practical applications, it may happen that the code of a certain module in the same application is written by java language, while the code of other modules is written by other languages (e.g. C language, C + +, etc.) than java language, or the code of the application and the system is written by java language and other languages, respectively. Therefore, when the program runs, the java language and other languages can be mutually recognized and called. When the method in the class of the java language is called by other languages, the java object generated by calling the class is also required. Currently, the problem of calling java objects by other languages is generally solved through a Java Native Interface (JNI). The java native interface JNI provides a plurality of Application Programming Interfaces (APIs) so that other languages can call java objects through the APIs.
In practical application, when the code of other languages is long, the situation that the same java object needs to be called repeatedly usually occurs in the running process of the code. In order to facilitate calling, the prior art generally stores the reference address of the java object in a data table established by the java native interface JNI through the language. When the java object needs to be called, the code of the language acquires the reference address of the java object by inquiring the data table, so that the calling of the java object is realized.
The problem of this prior art is that, due to the syntax rules, the java native interface JNI can usually only store a smaller number of reference addresses of java objects through the data table created by the language. Therefore, the reference address of the java object is stored in the data table, and when the number of java objects needing to be called is large, the java object calling error usually occurs.
Disclosure of Invention
The embodiment of the application provides a method and a device for calling java objects and storing reference address information of the java objects, which are used for solving the problem that in the prior art, when codes of other languages call the java objects, only a small number of reference addresses of the java objects can be stored in a data table established by a java local interface JNI through the language, so that the effectiveness of the java objects is wrong.
The embodiment of the application provides a method for calling a java object, which comprises the following steps:
triggering an invoking instruction of the code of the specified language to the java object;
querying a first data table through the calling instruction, and determining whether the reference address information of the java objects is stored in the first data table, wherein the number of the reference address information of the java objects which can be stored in the first data table is greater than that of the java objects which can be stored in a second data table established by a java local interface JNI through the specified language;
when the java object exists, calling the java object through the reference address information of the java object;
and when the Java objects do not exist, calling the Java objects through a Java native interface JNI.
Preferably, the reference address information of the java object specifically includes a unique identifier associated with the reference address of the java object; then the process of the first step is carried out,
the invoking the java object through the reference address information of the java object specifically includes:
and invoking a JNI reference management component through a unique identifier associated with the reference address of the java object to acquire the reference address of the java object, and invoking the java object according to the acquired reference address of the java object, wherein the JNI reference management component is used for managing invocation of the java object by the code of the specified language through a java native interface JNI.
Preferably, after the java objects are called through the java native interface JNI, the method further comprises: and storing the reference address information of the java object in a first data table.
Preferably, the storing the reference address information of the java object in the first data table specifically includes:
a unique identifier associated with the reference address of the java object is generated and stored in a first data table.
Preferably, the method further comprises: and deleting the reference address information of the java object in a second data table established by the java native interface JNI through the specified language.
Preferably, it is characterized in that the first and second parts,
the code of the specified language specifically comprises code of C language and/or code of C + + language; and/or the presence of a gas in the gas,
the first data table specifically comprises a data table established by a java native interface JNI through a java language.
The embodiment of the application also provides a storage method of the reference address information of the java object, which comprises the following steps:
when an instruction for calling a java object by a code of a specified language is received, acquiring the java object through a java local interface JNI;
and storing the reference address information of the java objects in a first data table, wherein the number of pieces of reference address information of the java objects which can be stored in the first data table is greater than that of the java objects which can be stored in a second data table established by the java local interface JNI through the specified language.
An embodiment of the present application further provides a device for invoking java objects, where the device includes: trigger unit, judgement unit, first call unit and second call unit, wherein:
the trigger unit is used for triggering a calling instruction of a code of a specified language to a java object;
the judging unit is used for inquiring a first data table through the calling instruction, determining whether the first data table stores the reference address information of the java objects, if so, triggering the first calling unit, and if not, triggering a second calling unit, wherein the number of the reference address information of the java objects which can be stored in the first data table is larger than that of the reference address information of the java objects which can be stored in a second data table established by a java local interface JNI through the specified language;
the first calling unit is used for calling the java object through the reference address information of the java object;
the second calling unit is used for calling the java object through a java local interface JNI.
Preferably, the reference address information of the java object specifically includes a unique identifier associated with the reference address of the java object; then the process of the first step is carried out,
the first invoking unit specifically comprises a first invoking sub-unit, which is configured to invoke a JNI reference management component through a unique identifier associated with a reference address of the java object to obtain the reference address of the java object, and invoke the java object according to the obtained reference address of the java object, where the JNI reference management component is configured to manage invocation of the java object by the code of the specified language through a java native interface JNI.
An embodiment of the present application further provides a storage apparatus for reference address information of a java object, where the apparatus includes: an acquisition unit and a storage unit, wherein:
the obtaining unit is used for obtaining the java object through a java local interface JNI when receiving a calling instruction of a code of a specified language to the java object;
the storage unit is used for storing the reference address information of the java objects in a first data table, and the number of pieces of reference address information of the java objects which can be stored in the first data table is larger than the number of pieces of reference address information of the java objects which can be stored in a second data table established by the java local interface JNI through the specified language.
The embodiment of the application adopts at least one technical scheme which can achieve the following beneficial effects:
after an invoking instruction of the code of the specified language to the java object is triggered, the first data table is inquired through the invoking instruction, and the java object is invoked according to the storage condition of the reference address information of the java object in the first data table. And the number of pieces of reference address information of java objects which can be stored in the first data table is larger than that of the pieces of reference address information of java objects which can be stored in the second data table established by the java native interface JNI through the specified language. Therefore, the problem that in the prior art, because the reference address information of java objects which can be stored in the second data table is less, errors can be caused to the java objects under the condition that more java objects need to be called. .
Drawings
The accompanying drawings, which are included to provide a further understanding of the application and are incorporated in and constitute a part of this application, illustrate embodiment(s) of the application and together with the description serve to explain the application and not to limit the application. In the drawings:
fig. 1 is a schematic flowchart of a specific implementation of a method for invoking java objects according to embodiment 1 of the present application;
fig. 2 is a schematic flowchart of a specific implementation flow of a method for invoking java objects in a specific application scenario, provided in embodiment 1 of the present application;
fig. 3 is a schematic flowchart of a specific implementation of a method for storing a reference address of a java object according to embodiment 2 of the present application;
fig. 4 is a schematic structural diagram of an apparatus for invoking java objects according to embodiment 3 of the present application;
fig. 5 is a schematic structural diagram of a storage apparatus for referencing addresses of java objects according to embodiment 4 of the present application.
Detailed Description
In order to make the objects, technical solutions and advantages of the present application more apparent, the technical solutions of the present application will be described in detail and completely with reference to the following specific embodiments of the present application and the accompanying drawings. It should be apparent that the described embodiments are only some of the embodiments of the present application, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present application.
The technical solutions provided by the embodiments of the present application are described in detail below with reference to the accompanying drawings.
Example 1
As described above, in practical applications, since codes of some modules of the same application are often written in java language, codes of other modules are written in other languages (e.g., C language, C + +, etc.), or codes of the application and the system are written in java language and other languages, respectively, it is generally required to be able to call each other between java language and other languages. When other languages call java, because of the object-oriented characteristic of java, how to call java objects becomes an important factor. In general, the calling of java objects by other languages can be realized through a java native interface JNI.
In addition, the situation that one piece of code of other languages needs to repeatedly call the same java object when running also usually occurs. This is particularly the case when the code is longer. In the prior art, in order to facilitate the invocation of the java object, a common practice is to store the reference address of the java object in a data table established by the java native interface JNI through the language. When the java object needs to be called, the code of the language acquires the reference address of the java object by inquiring the data table, so that the calling of the java object is realized through the reference address of the java object.
In practical application, however, the java native interface JNI is usually limited by syntax rules, and the data table of the language usually only stores a smaller number of reference addresses of java objects. If the reference address of the java object is stored in the data table, when the number of java objects needing to be called is large, the situation that the java objects cannot be called usually occurs, and even the code of the language is difficult to run in severe cases.
In the following, the C language code will be used to call java objects in java code as an example. In practical application, according to grammar rules, the java native interface JNI can only store reference addresses of 512 java objects through a data table established by the C language. In the case of long code of C language, the number of java objects to be called is more than 512. At this time, if the reference addresses of the java objects are saved in the data table, some java objects are difficult to call, which may cause the code of the C language to be difficult to run in severe cases.
In view of the defects, the application provides a method for calling java objects, which is used for solving the problem that when the java objects are called by codes of other languages through the reference addresses of the java objects stored in the data table of the language, the number of the reference addresses of the java objects which can be stored in the data table is small, so that the calling is difficult. The flow diagram of the method is shown in figure 1, and comprises the following steps:
step S11: and triggering a calling instruction of the code of the specified language to the java object.
Here, the code of the designated language refers to code written in the designated language, and the designated language may be C language, C + + language, or other languages that can call java objects through the java native interface JNI.
When the code of the specified language contains an instruction for calling a java object in java code, the instruction is usually triggered during the running process of the code of the specified language to call the java object.
Step S12: and querying a first data table through the call instruction, determining whether the reference address information of the java object is stored in the first data table, and if so, executing the step S13, and if not, executing the step S14.
Here, the number of pieces of reference address information of java objects that can be stored in the first data table is greater than the number of pieces of reference address information of java objects that can be stored in the second data table created by the java native interface JNI through the specified language.
In practical application, the code of the specified language calls java objects in java code. Therefore, in order to facilitate the calling of the java object, the first data table can be generally established by calling java language through a java native interface JNI. That is, the first data table may be a data table created by java native interface JNI through java language in general. According to the grammar rule, the number of pieces of reference address information of java objects which can be stored in the first data table established in the mode is usually larger than the number of pieces of reference address information of java objects which can be stored in the second data table established by the java native interface JNI through the specified language.
Taking the example that codes of C language call java objects in java codes, according to grammar rules, a second data table established by a java native interface JNI through C language can usually only store reference address information of 512 java objects, but the number of pieces of reference address information of java objects that can be stored by a first data table established by the java native interface JNI through java language is usually larger than 512.
And querying a first data table through the calling instruction, and determining whether the reference address information of the java object is stored in the first data table. In practical application, after a calling instruction of a java object is triggered, a first data table can be queried through the instruction, and whether the reference address information of the java object is stored in the first data table is determined according to a query result.
It should be noted that, in practical applications, the invocation of java objects may be generally managed by a module, and particularly, the invocation of java objects by a java Native Interface JNI may be referred to as a JNI Reference management module (java Native Interface Reference Manager). The module can be generally used for managing the calling of java objects in java language by a specified language, in particular the calling of java objects by the specified language through a java native interface JNI. In addition, in the process of actually developing the module, the JNI reference management module generally has a corresponding relation with the specified language due to different language rules. For example, when the specified language is C language, the code for managing C language corresponding to the JNI reference management module calls java objects through a java native interface JNI; when the specified language is C + + language, the JNI reference management module is used for managing the calling of codes of the C + + language to java objects through a java local interface JNI; when the specified language is other languages, the JNI reference management module is used for managing the calling of the codes of the corresponding language to java objects through a java native interface JNI. Of course, the form of the JNI reference management component is not limited, and it is only necessary to explain that the JNI reference management component is used for managing the invocation of java objects by the code of the specified language through the java native interface JNI, so that the technical effect of the present invention is not affected.
In particular, the reference address information of the java object herein refers to information of a reference address of the java object, which is used to determine the reference address of java, and the reference address of the java object is used to call the java object through the reference address. In practical applications, the reference address information of the java object may be directly the reference address of the java object, or may be other information associated with the reference address of the java object, through which the reference address of the java object may be determined, and the other information may be in the form of a unique identifier. That is, the reference address information of the java object specifically includes a unique identifier associated with the reference address of the java object.
Step S13: and when the java object exists, calling the java object through the reference address information of the java object.
When the reference address information of the java object is stored in the first data table, the java object can be called through the reference address information of the java object.
In practical applications, the java objects are usually called differently due to the different reference address information forms of the java objects. For example, when the reference address information of the java object is the reference address of the java object, the java object can be directly called through the reference address information of the java object; when the information of the reference address of the java object is specifically a unique identifier associated with the reference address of the java object, the invoking the java object through the information of the reference address of the java object specifically includes: and invoking a JNI reference management component through a unique identifier associated with the reference address of the java object to acquire the reference address of the java object, and invoking the java object according to the acquired reference address of the java object, wherein the JNI reference management component is used for managing invocation of the java object by the code of the specified language through a java native interface JNI.
Step S14: and when the Java objects do not exist, calling the Java objects through a Java native interface JNI.
When the reference address information of the java object is not stored in the first data table, the java object in the java code can be called through a java native interface JNI.
In practical applications, it is also common to encounter scenarios where code in a given language requires multiple calls to the same java object at run-time. Therefore, in order to facilitate multiple calls to the java object, the reference address information of the java object can be saved after the java object is called through the java native interface JNI. Therefore, when the java object is called next time, the reference address information of the java object can be acquired by inquiring the first data table, so that the java object is called more conveniently. Therefore, in a preferred embodiment of the present invention, after the java objects are called through the java native interface JNI, the java object reference address information is stored in the first data table.
In practical applications, when the reference address information of the java object is specifically a unique identifier associated with the reference address of the java object, the manner of storing the reference address information of the java object in the first data table may specifically include step S141.
Step S141: a unique identifier associated with the reference address of the java object is generated and stored in a first data table.
Here, the generated unique identifier may have various forms, for example, an integer-form arabic number may be used as the unique identifier, an english alphabet may be used as the unique identifier, an arabic number plus an english alphabet may be used as the unique identifier, and naturally, other forms of unique identifiers may be used. In addition, there are many methods for generating the unique identifier, for example, the unique identifier may be generated randomly, or may be generated by a numerical value increasing method, or may be generated by other methods, and in practical applications, the unique identifier may be generated by a numerical value increasing method. The method of generating the unique identifier, and the form of the unique identifier, are not limited herein. Additionally, storing the unique identifier in the first data table can store the unique identifier in the first data table by calling a JNI reference management component.
When the java object is called for the first time, the reference address information of the java object is not usually stored in the first data table, the java object can be called through a java native interface JNI at this time, then a unique identifier associated with the reference address information of the java object is generated, and the unique identifier is stored in the first data table by calling a JNI reference management component. Therefore, when the java object is called later, the reference address information of the java object can be acquired by querying the first database, and the java object is called according to the reference address information of the java object, so that the calling of the java object can be more convenient.
It should be further noted that, in practical cases, in step S13, when the java object is called by the reference address information of the java object, the java object generally needs to be called through the java native interface JNI. And according to the rule that the java object is called by the java native interface JNI, in the process of calling the java object, the reference address information of the java object is stored in a second data table established by the java native interface JNI through the specified language, which is the same as that of calling the java object through the java native interface JNI in the step S14. Therefore, step S15 may also be generally included after the java object is called through the java native interface JNI.
Step S15: and deleting the reference address information of the java object in a second data table established by the java native interface JNI through the specified language.
When the java object is called through the java native interface JNI, the reference address of the java object in the second database can be deleted after the calling process of the java object is completed, so that the reference address of the java object only needs to be stored in the first database, and the storage resource can be saved in practical application.
By using the method for invoking java objects in embodiment 1 of the present application, after an invocation instruction of a code of a specified language to a java object is triggered, a first data table is queried through the invocation instruction, and the java object is invoked according to a storage condition of reference address information of the java object in the first data table. Therefore, the problem that in the prior art, because the reference address information of java objects which can be stored in the second data table is less, errors can be caused to the java objects under the condition that more java objects need to be called.
It should be noted that all execution subjects of the steps of the method provided in embodiment 1 may be the same device, or all the steps of the method may be executed by different devices. For example, the execution subjects of step S11 and step S12 may be the apparatus 1; for another example, the execution subject of step S11 may be device 1, and the execution subjects of steps S12 and S2; and so on.
The above is a description of a method for calling java objects provided in the embodiments of the present application. For convenience of understanding, the embodiment of the present application also provides a specific application scenario for implementing the method in practical application. The application scene calls java objects in java code for code of C language. In the application scenario, the designated language is C, and the code of the designated language is C. As shown in table 2, the method shown in the application scenario may specifically include the following steps:
step S21: triggering an invoking instruction of the code of the C language to a java object in the java code;
step S22: querying a first data table through the calling instruction;
the first data table is specifically a data table established by a java local interface JNI through a java language.
Step S23: determining whether the unique identifier associated with the reference address of the java object is stored in the first data table according to the query result, if so, executing steps S24 to S26, and if not, executing steps S27 to S29;
step S24: obtaining the unique identifier;
step S25: calling a JNI reference management component through the unique identifier to acquire a reference address of the java object;
here, the JNI reference management component is configured to manage invocation of java objects by code in C language through a java native interface JNI.
Step S26: calling the java object according to the reference address of the obtained java object;
step S27: calling the java object through a java local interface JNI;
step S28: generating a unique identifier associated with the reference address of the java object;
step S29: storing the generated unique identifier in a first data table by referring to the management component through the JNI;
step S210: and deleting the reference address information of the java object in a second data table established by the java native interface JNI through the C language.
In addition, it should be noted that, because the C + + language and the C language have similar grammatical rules, in the process of calling a java object in java code by code in the C + + language, the embodiment of the present application is similar to a process similar to the application scenario, and is not described herein.
Example 2
Embodiment 2 of the present application provides a method for storing a reference address of a java object, which is used to solve the problem in the prior art that when a java object is invoked through a java native interface JNI, the java object may not be run due to a small number of java objects that can be invoked. The flow chart of the method is shown in fig. 3, and the steps of the method include:
step S31: and when receiving a calling instruction of the code of the specified language to the java object, acquiring the java object through a java local interface JNI.
Here, the code of the designated language refers to code written in the designated language, and the designated language may be C language, C + + language, or another language capable of calling java objects through java native interface JNI.
In practical applications, the java native interface JNI can provide multiple Application Programming Interfaces (APIs), so that other languages can obtain the java objects through the APIs.
Step S32: and storing the reference address information of the java object in a first data table.
Here, the number of pieces of reference address information of java objects that can be stored in the first data table is greater than the number of pieces of reference address information of java objects that can be stored in the second data table created by the java native interface JNI through the specified language.
In practical applications, the first data table may have various forms, and the manner of generating the first data table may also have various forms. However, the number of pieces of reference address information of java objects that can be stored in the first data table is greater than the number of pieces of reference address information of java objects that can be stored in the second data table created by the java native interface JNI through the specified language. The preferred scheme for generating the first data table is that a java native interface JNI establishes the first data table through java language. This may make querying the data representation easier to implement.
In practical applications, there are various ways to store the reference address information of the java object in the first data table. In a preferred embodiment, the reference address information of the java object is stored in the first data table by calling the JNI reference management component. The JNI reference management component is used for managing the codes of the specified languages to call java objects through java local interfaces JNI.
By adopting the method provided by the embodiment 2 of the application, after the java objects are acquired through the java native interface JNI, the reference address information of the java objects is stored in the first data table, and the number of pieces of reference address information of the java objects, which can be stored in the first data table, is greater than that of the java objects in the second data table established by the java native interface JNI through the specified language, so that the problems in the prior art are solved.
Example 3
With the same inventive concept as embodiment 1, embodiment 3 of the present application provides an apparatus for calling java objects, the apparatus 40 including: a trigger unit 401, a judgment unit 402, a first calling unit 403 and a second calling unit 404, wherein:
the triggering unit 401 is configured to trigger an instruction for calling java objects by codes of a specified language;
the judging unit 402 is configured to query a first data table through the call instruction, determine whether the first data table stores the reference address information of the java objects, if so, trigger a first calling unit 403, and if not, trigger a second calling unit 404, where the number of pieces of reference address information of the java objects that can be stored in the first data table is greater than the number of pieces of reference address information of the java objects that can be stored in a second data table established by the java local interface JNI through the specified language;
the first invoking unit 403 is configured to invoke the java object through the reference address information of the java object;
the second invoking unit 404 is configured to invoke the java object through a java native interface JNI.
Since embodiment 3 of the present application adopts the same inventive concept as embodiment 1, the same inventive effects as embodiment 1 can be obtained. In practical applications, the apparatus 40 provided in example 3 can be combined with hardware devices to achieve other effects. For example, when the number of java objects to be called by the code of the specified language is large, the frequency of querying the first data table is generally high during the process of calling the java objects, and at this time, the first data table can be stored in the cache, so that the calling speed can be increased. Of course, this is only one of the technical effects achieved by the apparatus 40 in combination with hardware devices, and other technical effects may be achieved in the specific implementation process, which is not listed here.
Here, the reference address information of the java object refers to information of a reference address of the java object, which is used to determine the reference address of the java object, which is used to call the java object through the reference address. Generally, the reference address information of the java object may be directly the reference address of the java object, or may be other information associated with the reference address of the java object, through which the reference address of the java object may be determined, and the other information may be in the form of a unique identifier. In practical application, it is preferable that the reference address information of the java object is a unique identifier associated with the reference address of the java object; then, the first invoking unit 403 specifically includes a first invoking subunit 4031, configured to invoke a JNI reference management component through a unique identifier associated with the reference address of the java object to obtain the reference address of the java object, and invoke the java object according to the obtained reference address of the java object, where the JNI reference management component is configured to manage invocation of the java object by the code of the specified language through a java native interface JNI.
Example 4
With the same inventive concept as embodiment 2, the present application also provides a storage apparatus for reference address information of java objects, the apparatus 50 comprising: an acquisition unit 501 and a storage unit 502, wherein:
the obtaining unit 501 is configured to obtain a java object through a java native interface JNI when receiving a call instruction of a code of a specified language to the java object;
the storage unit 502 is configured to store the reference address information of the java objects in a first data table, where the number of pieces of reference address information of the java objects that can be stored in the first data table is greater than the number of pieces of reference address information of the java objects that can be stored in a second data table established by the java local interface JNI through the specified language.
With the apparatus 50 provided in embodiment 4 of the present application, after the java objects are acquired by the acquiring unit 501, the reference address information of the java objects is stored in the first data table through the storage unit 502, and since the number of pieces of reference address information of the java objects that can be stored in the first data table is greater than that of the java local interface JNI established by the second data table in the specified language, the number of pieces of reference address information of the java objects that can be stored in the second data table is also greater than that of the java local interface JNI, thereby solving the problems in the prior art.
As will be appreciated by one skilled in the art, embodiments of the present application may be provided as a method, system, or computer program product. Accordingly, the present application may take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, the present application may take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, and the like) having computer-usable program code embodied therein.
The present application is described with reference to flowchart illustrations and/or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the application. It will be understood that each flow and/or block of the flow diagrams and/or block diagrams, and combinations of flows and/or blocks in the flow diagrams and/or block diagrams, can be implemented by computer program instructions. These computer program instructions may be provided to a processor of a general purpose computer, special purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, create means for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing apparatus to function in a particular manner, such that the instructions stored in the computer-readable memory produce an article of manufacture including instruction means which implement the function specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer implemented process such that the instructions which execute on the computer or other programmable apparatus provide steps for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
In a typical configuration, a computing device includes one or more processors (CPUs), input/output interfaces, network interfaces, and memory.
The memory may include forms of volatile memory in a computer readable medium, Random Access Memory (RAM) and/or non-volatile memory, such as Read Only Memory (ROM) or flash memory (flash RAM). Memory is an example of a computer-readable medium.
Computer-readable media, including both non-transitory and non-transitory, removable and non-removable media, may implement information storage by any method or technology. The information may be computer readable instructions, data structures, modules of a program, or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), Static Random Access Memory (SRAM), Dynamic Random Access Memory (DRAM), other types of Random Access Memory (RAM), Read Only Memory (ROM), Electrically Erasable Programmable Read Only Memory (EEPROM), flash memory or other memory technology, compact disc read only memory (CD-ROM), Digital Versatile Discs (DVD) or other optical storage, magnetic cassettes, magnetic tape magnetic disk storage or other magnetic storage devices, or any other non-transmission medium that can be used to store information that can be accessed by a computing device. As defined herein, a computer readable medium does not include a transitory computer readable medium such as a modulated data signal and a carrier wave.
It should also be noted that the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other identical elements in the process, method, article, or apparatus that comprises the element.
As will be appreciated by one skilled in the art, embodiments of the present application may be provided as a method, system, or computer program product. Accordingly, the present application may take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, the present application may take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, and the like) having computer-usable program code embodied therein.
The above are merely examples of the present application and are not intended to limit the present application. Various modifications and changes may occur to those skilled in the art. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application should be included in the scope of the claims of the present application.

Claims (10)

1. A method of invoking a java object, comprising:
triggering an invoking instruction of the code of the specified language to the java object;
querying a first data table through the calling instruction, and determining whether the reference address information of the java objects is stored in the first data table, wherein the number of the reference address information of the java objects which can be stored in the first data table is greater than that of the java objects which can be stored in a second data table established by a java local interface JNI through the specified language;
when the java objects exist, calling the java objects through the reference address information of the java objects stored in the first data table;
and when the Java objects do not exist, calling the Java objects through a Java native interface JNI.
2. A method as claimed in claim 1, characterized in that the reference address information of java objects stored in the first data table specifically includes a unique identifier associated with the reference address of the java objects; then the process of the first step is carried out,
the invoking the java object through the reference address information of the java object stored in the first data table specifically includes:
and invoking a JNI reference management component through a unique identifier associated with the reference address of the java object to acquire the reference address of the java object, and invoking the java object according to the acquired reference address of the java object, wherein the JNI reference management component is used for managing invocation of the java object by the code of the specified language through a java native interface JNI.
3. The method as claimed in claim 2, wherein after invoking the java objects through a java native interface JNI, the method further comprises: and storing the reference address information of the java object in a first data table.
4. A method as claimed in claim 3, wherein said storing reference address information of said java objects in a first data table specifically comprises:
a unique identifier associated with the reference address of the java object is generated and stored in a first data table.
5. The method of claim 1, wherein the method further comprises: and deleting the reference address information of the java object in a second data table established by the java native interface JNI through the specified language.
6. The method of claim 1,
the code of the specified language specifically comprises code of C language and/or code of C + + language; and/or the presence of a gas in the gas,
the first data table specifically comprises a data table established by a java native interface JNI through a java language.
7. A method for storing reference address information of java objects is characterized by comprising the following steps:
when an instruction for calling a java object by a code of a specified language is received, acquiring the java object through a java local interface JNI;
and storing the reference address information of the java objects in a first data table, wherein the number of pieces of reference address information of the java objects which can be stored in the first data table is greater than that of the java objects which can be stored in a second data table established by the java local interface JNI through the specified language.
8. An apparatus for invoking java objects, comprising: trigger unit, judgement unit, first call unit and second call unit, wherein:
the trigger unit is used for triggering a calling instruction of a code of a specified language to a java object;
the judging unit is used for inquiring a first data table through the calling instruction, determining whether the first data table stores the reference address information of the java objects, if so, triggering the first calling unit, and if not, triggering a second calling unit, wherein the number of the reference address information of the java objects which can be stored in the first data table is larger than that of the reference address information of the java objects which can be stored in a second data table established by a java local interface JNI through the specified language;
the first invoking unit is used for invoking the java objects through the reference address information of the java objects stored in the first data table;
the second calling unit is used for calling the java object through a java local interface JNI.
9. An apparatus as claimed in claim 8, wherein the reference address information of java objects stored in the first data table specifically includes a unique identifier associated with the reference address of the java object; then the process of the first step is carried out,
the first invoking unit specifically comprises a first invoking sub-unit, which is configured to invoke a JNI reference management component through a unique identifier associated with a reference address of the java object to obtain the reference address of the java object, and invoke the java object according to the obtained reference address of the java object, where the JNI reference management component is configured to manage invocation of the java object by the code of the specified language through a java native interface JNI.
10. An apparatus for storing reference address information of java objects, comprising: an acquisition unit and a storage unit, wherein:
the obtaining unit is used for obtaining the java object through a java local interface JNI when receiving a calling instruction of a code of a specified language to the java object;
the storage unit is used for storing the reference address information of the java objects in a first data table, and the number of pieces of reference address information of the java objects which can be stored in the first data table is larger than the number of pieces of reference address information of the java objects which can be stored in a second data table established by the java local interface JNI through the specified language.
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 CN107301097A (en) 2017-10-27
CN107301097B true 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)

Families Citing this family (3)

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

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系统资源访问控制方案";雷灵光 等;《计算机研究与发展》;20140515(第5期);第1028-1037页 *

Also Published As

Publication number Publication date
CN107301097A (en) 2017-10-27

Similar Documents

Publication Publication Date Title
CN110941528B (en) Log buried point setting method, device and system based on fault
CN107066519B (en) Task detection method and device
CN108268609B (en) File path establishing and accessing method and device
CN107301097B (en) Method and device for storing calling java object and reference address information of java object
CN114547024A (en) SQL statement risk detection method, device, equipment and medium
CN108647102B (en) Service request processing method and device of heterogeneous system and electronic equipment
CN110837446A (en) Equipment management method and device applied to embedded system, medium and embedded equipment
CN116432185B (en) Abnormality detection method and device, readable storage medium and electronic equipment
CN112559565A (en) Abnormity detection method, system and device
CN111625225A (en) Program specified data output method and device
CN111309402B (en) Data monitoring and application program processing method, device and equipment
CN110019497B (en) Data reading method and device
CN110750271B (en) Service aggregation, method and device for executing aggregated service and electronic equipment
CN114791884A (en) Test environment construction method and device, storage medium and electronic equipment
CN113867776A (en) Method and device for publishing middle station application, electronic equipment and storage medium
CN111966709A (en) Data query method and device and electronic equipment
CN112699129A (en) Data processing system, method and device
CN111580938A (en) Transaction processing method, device, equipment and medium for work unit
CN111324778A (en) Data and service processing method and device and electronic equipment
CN111124931B (en) Java code compliance checking method and device
CN112749189A (en) Data query method and device
CN110321250B (en) Disaster recovery method and device for application
CN110968599B (en) Inquiry method and device based on Impala
CN108268311B (en) Determination method and device for caller application program
CN112416555B (en) Client restarting method, device and apparatus, and storage medium

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.