Using the Java Gateway in a Production - InterSystems Documentation
Using the Java Gateway in a Production - InterSystems Documentation
Using the Java Gateway in a Production - InterSystems Documentation
Create successful ePaper yourself
Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.
Proxy Call Sequence<br />
Figure 1–3: Import<strong>in</strong>g <strong>Java</strong> Classes<br />
1. The Ensemble session sends an import request.<br />
2. Upon receiv<strong>in</strong>g <strong>the</strong> request, <strong>the</strong> <strong>Java</strong> <strong>Gateway</strong> worker thread <strong>in</strong>trospects <strong>the</strong> <strong>in</strong>dicated <strong>Java</strong> packages and classes.<br />
3. If it f<strong>in</strong>ds any <strong>Java</strong> classes that are new or changed, or that have no proxy classes on <strong>the</strong> Ensemble side, <strong>the</strong> thread<br />
generates new proxy classes for <strong>the</strong>m.<br />
Important:<br />
The <strong>Java</strong> <strong>Gateway</strong> import only imports classes, methods, and fields marked as public.<br />
1.6 Proxy Call Sequence<br />
A call to any Ensemble proxy method <strong>in</strong>itiates <strong>the</strong> follow<strong>in</strong>g sequence of events:<br />
1. All Ensemble proxy parameters are marshaled onto <strong>the</strong> wire. This is a very simple process <strong>in</strong> <strong>the</strong> vast majority of cases<br />
— parameters are simply written <strong>in</strong>to <strong>the</strong> output TCP/IP buffer.<br />
2. A message is sent over <strong>the</strong> TCP/IP connection to <strong>the</strong> <strong>Java</strong> <strong>Gateway</strong> worker thread. The message consists of <strong>the</strong> method<br />
name, marshaled parameters and, <strong>in</strong> some <strong>in</strong>stances, o<strong>the</strong>r m<strong>in</strong>or load.<br />
3. The <strong>Java</strong> <strong>Gateway</strong> worker thread consumes <strong>the</strong> message, unmarshals <strong>the</strong> parameters, f<strong>in</strong>ds <strong>the</strong> appropriate method or<br />
constructor call, and <strong>in</strong>vokes it us<strong>in</strong>g <strong>Java</strong> reflection. If <strong>the</strong> given method is an overloaded method, <strong>the</strong> gateway uses<br />
a method overload algorithm to f<strong>in</strong>d <strong>the</strong> right <strong>Java</strong> method version. For details, see <strong>the</strong> Overloaded Methods section<br />
of <strong>the</strong> “Mapp<strong>in</strong>g Specification” chapter of this guide.<br />
4. The results of <strong>the</strong> method <strong>in</strong>vocation (if any) are marshaled onto <strong>the</strong> wire and sent back to <strong>the</strong> Ensemble side over <strong>the</strong><br />
same TCP/IP channel.<br />
<strong>Us<strong>in</strong>g</strong> <strong>the</strong> <strong>Java</strong> <strong>Gateway</strong> 7