on 07-17-2015 12:45 AM
Hello guys,
I'm trying to develop a java class that connects a web system (made in struts) with a SAP backend.
i want that class to offer a Jco Destination always opened and with it's context opened (JCoContext.begin(conn)). if I achieve this then i can preload my SAP rfc's with data so that they run way faster (rather than fetching the data all over again with each rfc request).
The problem is that i read that the context i desire to keep always opened (so it can give me the statefulness i need) will close if the thread of execution ends (even if i dont issue the JCoContext.end(conn) command.
i'm thinking that maybe a servlet will do. Offering my class as a servlet, but i have my doubts since i think that every request to the servlet will be a separate thread, hence, closing my desired context.
What do you guys think? Is there another way to achieve this?
Hi Fernando,
in this case, you should introduce or search the web for a deployable that registers a SessionReferenceProvider that integrates with the session management of the servlet container. Do not include it in your application. Runtime embedding components should not be part of applications - separation of concerns. See also the JavaDoc of the package com.sap.conn.jco.ext. As there canbe only one such component, a JCo application should never bring its own with its application deployable.. In case such a SessionReferenceProvider implementation is registered, thread switches don't hurt and your JCoContext will survive thread ends and will only be closed automatically in case the servlet container session it belongs to has ended.
Best regards,
Markus
P.S.: It's JCoContext.begin(destination). Do not treat a destination like a connection, it is not a connection. It represents an execution target and opens connections if needed, but it is not a connetion
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Fernando,
In addition to Markus, com.sap.conn.jco.ext.JCoSessionReference interface is a reference to a sessionin run time which registered a com.sap.conn.jco.ext.SessionReferenceProvider using ID associated with JCoSessionReference.
Thanks,
Hamendra
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
85 | |
10 | |
10 | |
9 | |
6 | |
6 | |
6 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.