To use a Threading Class for EJBs or not?

I was wondering if someone can help me answer this question? I am going to have this class that will be used by the Beans to complete a transaction. Because I have several Beans that all need this one particular class to complete a transaction, I was wondering if it would be good to create this class in a cache type manner. Meaning this class will only be instantiated once when the server loads after that all the beans will only reference it through this class' getInstance() method. I know this class does not contain any data that needs to persist however I would like to avoid having mulitple instances of this one particular class. The class completes a rather long transaction process. It is not much from my side, but I have to wait a few seconds for the other application that I connect to, to complete the transaction, then finally get a return. This class does not do too much work, but it just needs to wait for a long time to get back a response. Since threads are lighter and cheaper than a complete process I was wondering if I should create this class that extends the thread. Below I have some basic code that can do this but I was wondering if this would be a good methodolgy for transaction heavy application. Sorry for making it too long. I have marked the class with X's to prevent the client who we connect to.
public class XXXXXXX extends Thread {
private static XXXXXXXX wconn = null;
private XXXXXXXX xxc;
private String response = null;
public XXXXXXXX() {
this.xxc = new XXXXXXXX ();
* set properties *
this.xxc.host = ""; //Connector ID
this.xxc.port = 8800; //without SSL
//this.xxc.port = 443; //SSL
this.xxc.ssl = false; //SSL (if true, change port to 443!)
this.xxc.compress = true; //compression
this.xxc._native = true; // native request; MUST set to true for XML Pro
this.xxc.keepalive = false; //indicates if the connection to the server should persist
public void run()
public static XXXXXXXX getInstance()
return wconn;
private other functions ....
Thank You for any insight that you can provide.

So you want to run something outside the containter. It doesn't matter whether you have a seperate app or just run inside the same JVM as the container. Once you are outside the container it doesn't matter how you implement it in terms of J2EE.
It sounds to me like you just have a job and you are submitting that job for processing. You might want to examine what happens when more than one thread accesses that instance at the same time but other than that it works. You might also want to look at what happens if one or more of the other systems are down (where persisting the job on your side might make sense.)

Similar Messages

  • How to use the different class for each screen as well as function.

    Hi Experts,
    How to use the different class for each screen as well as function.
    With BestRegards,
    M.Thippa Reddy.

    Hi ThippaReddy,
    see this sample code
    Public Class ClsMenInBlack
    #Region "Declarations"
        'Class objects
        'UI and Di objects
        Dim objForm As SAPbouiCOM.Form
        'Variables
        Dim strQuery As String
    #End Region
    #Region "Methods"
        Private Function GeRate() As Double
                Return Double
        End Function
    #End Region
    Public Sub SBO_Appln_MenuEvent(ByRef pVal As SAPbouiCOM.MenuEvent, ByRef BubbleEvent As Boolean)
            If pVal.BeforeAction = True Then
                If pVal.MenuUID = "ENV_Menu_MIB" Then
                End If
            Else ' Before Action False
                End If
        End Sub
    #End Region
    End Class
    End Class
    Rgds
    Micheal
    Vasu Anna Regional Feeling a???? Just Kidding
    Edited by: micheal willis on Jul 27, 2009 5:49 PM
    Edited by: micheal willis on Jul 27, 2009 5:50 PM

  • [svn] 1605: Bug: BLZ-155 - Deadlock using a thread pool for tomcat connectors

    Revision: 1605
    Author: [email protected]
    Date: 2008-05-07 14:24:53 -0700 (Wed, 07 May 2008)
    Log Message:
    Bug: BLZ-155 - Deadlock using a thread pool for tomcat connectors
    QA: Yes - Jorge verified in the QE lab
    Doc: No
    Ticket Links:
    http://bugs.adobe.com/jira/browse/BLZ-155
    Modified Paths:
    blazeds/branches/3.0.x/modules/core/src/java/flex/messaging/client/EndpointPushNotifier.j ava

    Cross post: http://forum.java.sun.com/thread.jspa?threadID=5215686&tstart=0
    If you must post across forums, just post in the most relevant one and then give the link to that in the other posts.

  • HT204053 I had Snow Leopard and was using iWeb and Filezilla for my website (not MobileMe). Wanting to move to single-click publishing, I now find it is not supported by iCloud and Mountain Lion. I feel cheated, having bought it mainly for this purpose!

    I had Snow Leopard and was using iWeb and Filezilla for my website (not MobileMe). Wanting to move to single-click publishing (supported by MobileMe), I now find it is not supported by iCloud and Mountain Lion. I feel cheated, having bought it mainly for this purpose! The other thing they don't tell you is that Mountain Lion disables OfficeMac, and I am considering uninstalling it for that reason - do I get my money back?!

    You stated; "Mountain Lion disables OfficeMac"
    That is not true.
    Mountain Lion does not have Rosetta so it is not capable of executing PowerPC code. If you have MS Office 2004 that is coded in PowerPC code and will not run in Mountain Lion. What you need to do is upgrade to an Intel version of Office.
    Allan

  • Using iMessage is it for free if not via wifi?

    Using iMessage is it for free if not via wifi?

    There is no specific charge for using iMessage. However, if you are using via 3g4g connection, then yes, it will count towards your data plan limits.

  • How to use inbound exit class for more than one workflow step

    Hi All,
    In Offline Workflow Approval Scenarios where the work items are sent to outlook of non sap users inbox through workitem exit of the respective workflow item. Based on the user reply from outlook email(either approve or reject) which sends an auto reply to Offline user . We configure an inbound exit class and assign the same in the SMICM transaction. Based on the code written using SAP_WAPI function modules in inbound class exit offline user gets the user approval result and performs the action in SAP.
    My question now Is how can we use this inbound exit class for all the steps of a workflow.
    For ex: In a workflow I have a decision step followed by an activity step. First I will write the work item exit for the user decision step and inbound exit code for the user decision step and offline user executed the user decision step with approve action.
    followed by that I have an activity step for that I will code a work item exit for that activity level but how can I user the same inbound exit class for the activity step as well .
    Quick reply  would be of great  help for me.
    With Best Regards,
    Veni

    For the outbound processing you have the option of replacing the workflow exit by chancing the bsp application of the extended notification (see note 1448241 solution as an example of how to do the change) and replacing the standard links with a "mailto:...".
    As far as the inbound processing, that depends on what should be done in the activity step, if for example you have a bapi which executes what the user does you can call it in the inbound class instead of the user and then the relevant wapi (complete the workitem/raise event etc.).

  • Why can we only use 1 release class for overall Release of Purchase Req?

    Hi,
    After realizing that it would be beneficial to use more than one release class for overall release of Purchase Requisition with classification, in use with release groups for overall release, I now ask if someone knows why SAP has chosen to only allow 1 release class for overall release of Purchase Requisition?
    In my scenario I would like Release group US, used for release strategies for US-plant to be able to use 1 release class with a specific set of characteristics.
    For example class REL_PREQ_CLASS_OVERALL_VALUE_IN_USD including a characteristic PR_TOTVAL_USD looking at CEBAN-GFWRT. The chosen currency for this characteristic would be USD.
    I would then like to allow Release group FR, used for release strategies for FRANCE-plant to use another release class with another set of characteristics.
    For example class REL_PREQ_CLASS_OVERALL_VALUE_IN_EUR including a characteristic PR_TOTVAL_EUR looking at CEBAN-GFWRT. The chosen currency for this characteristic would be EUR.
    In this way the release strategies for the respective release groups US and FR, could maintain their overall limit values in their respective release strategies in their own currencies.
    1. Observe that I do not want to use the same Release class for both release groups for overall release, even though I know that this is currently the only allowed option, as far as I've understood.
    2. Observe that I do not want to specify the two characteristics PR_TOTVAL_USD and PR_TOTVAL_EUR for overall value in the same release class, as this would lead to double maintenance for a large number of release strategies. Also consider the maintenance when new countries with new currencies want release strategies.
    3. Observe that I only want to use overall release.
    What I'm trying to avoid is having to continuously translate local business USD overall value limits to limits in the currency chosen for the overall value characteristic. If this for example is specified in DKK, this would lead to a need to adjust the overall value limits as soon as the exchange rate between USD and DKK changes in the system.
    Please consider this simple example:
    Local requirement is that USD purchase requisitions should be blocked when the USD value is above 1000 USD. However in my release strategy I would have to maintain a value of >5365 DDK, if DKK is chosen as the currency for overall characteristic.(e.g exchange rate 5,365).
    Next month the currency exchange rate in the system between USD and DKK has changed, and therefore I would have to go into CL24N and maintain the value to reflect the new exchange rate between USD and DKK. Lets say it has gone up to 5,435. I would now have to maintain a value of > 5435 DKK in my release strategy to correctly reflect the local business requirement of 1000 USD.
    So if anyone could please explain why SAP has taken the decision to make the Release class for overall release client specific that would be much appreciated and awarded accordingly. Also if you have any suggestion on how I could obtain the above scenario on maintaning overall value limits in different currencies than that would be awarded to.
    BR Jakob F. Skott

    You can give feed back to Apple from the iTunes drop-down menu in the iTunes menu bar..
    You can also contact the iTS Customer Service from the links on this page - http://www.apple.com/support/itunes/store/
    MJ

  • Excel opens and does not close when using the OI classes for some users...

    Hello Experts,
    I am using the OI classes(i_oi_container_control, i_oi_error, i_oi_document_proxy, i_oi_spreadsheet) to transfer Excel data to my itab. The problem we are encountering is that for some users the excel automatically opens and does not close. But in my case it is not opening so it is fine in my case. In my code I am already using the 'CLOSE_DOCUMENT' and 'RELEASE_DOCUMENT'.

    Viraylab,
    Check by any case you set the parameter register_on_close_event of the method init_control? Dont set the parameter as it will look for the corressponding custom code in your program. Also try with the method release_all_documents.
    Regards,
    Kiran Bobbala

  • Exit Class for Inbound Mail not getting triggered

    Hi Gurus,
    I have created an exit class for processing the Inbound Mail that comes to SAP Inbox (SOIN).
    I have set up the Inbound processing rule in transaction SO50 and set it to all recipients.
    If i send a mail from any external id to the id configured in SAP then it is coming in SAP Inbox (SOIN) but the exit class for processing the email is not getting triggered.
    I have made all the settings for SMTP.
    Kindly guide me with the steps needed to be followed for triggering the Exit Class.

    Hi
    Check u have maintained ur outgoing mail server IP in SCOT transation.
    Check link step to configure PO mail.
    http://architectsap.com/blog/sap/sap-mm-purchasing-send-purchase-order-by-mail-to-vendor-in-sap/

  • Using Time Capsule only for back-ups, not as a modem

    Hi, We have Comcast modem and router for internet connection. Is it possible to use Time Capsule only for Time Machine-generated back-ups of our Macs?
    Is there any complication setting up TC for use as back-up only device?
    Thanks!

    You can use TC this way. And it's very simple to setup.
    Check out the setup guide here:
    http://manuals.info.apple.com/enUS/Time_Capsule_Early2009Setup.pdf
    EDIT:
    I've just noticed that they've removed the section "Using Your Time Capsule on an Existing Wireless Network" from the new manual.
    Anyway here is a copy of the text under that section in the old guide:
    To set it up:
    1 Open AirPort Utility (located in /Applications/Utilities/ on a computer using Mac OS X,
    and in Start > All Programs > AirPort on a computer using Windows), select your Time
    Capsule, and then click Continue.
    2 Follow the onscreen instructions to join your current wireless network.
    3 After your Time Capsule is set up, you can use Mac OS X Leopard to set up Time
    Machine to back up the Mac OS X Leopard computers on your network. See “Using
    Time Machine with Your Time Capsule” on page 27 for more information.
    If you’re using an earlier version of Mac OS X, or if you’re using Windows, you can
    connect to Time Capsule to share or back up files.
    Message was edited by: dchao99

  • How to add compiled classes for EJBs in 10.1.3

    Hi there,
    I have a problem when migrating to 10.1.3.
    I have a big library of EJBs which I use in everal projects just by copying precompiled classes and adding them in ejb-jar.xml
    In previous JDeveloper I used ant as default build procedure. My build.xml didn't compile anything. just copied precompiled classes to output dir. Thus, the new project didn't care if classes were really build from source or not.
    The problem is that new JDeveloper doesn't allow setting a ant task as defualt build procedure and, so, building and then performing a ejb-jar.xml "verify enterprise beans" I get plenty of errors saying it can't find classes. (I have to copy them manually, or run the ant task manually).
    It is very tedious to copy classes manually as they are changed often... also, the deployment profile invokes nternal building procedure (an ant task before that copied classes) but now does nothing.
    I have tried to add these classes to the src dir, the resource dirs and even classpath, but they never get copied to output directory.
    Can I solve this or JDeveloper is only prepared to handle EJBs which source code is owned in the project itself?
    Thanks,
    Ignacio

    That link is to an older version of Jdev. There is no 'Common' section in project properties and no html input path either. There is a 'Project Content' section and within that section there is a 'Web Application' option. However i get "ArrayIndexOutOfBoundsException" whenever i click on the 'Web Application' option. I suspect this is the area where i can configure the .jsp portion of my project. I can't get to it though due to the exception.

  • PageNotFound when using servlets as clients for EJB

    Can anyone help me? I have a container managed EJB. I'm using servlets as my client. I placed my EJB's in a jar file and my servlets and html pages in a WAR file. I deployed them using J2EE's deploytool. I can access my html files but not my servlet files. It always says file not found or a 405 error (resource not allowed) I access my servlet this way...
    http://localhost:8000/ReservationContextRoot/ReservationAlias
    my web.xml file looks like the following:
    <?xml version="1.0" encoding="Cp1252"?>
    <!DOCTYPE web-app PUBLIC '-//Sun Microsystems, Inc.//DTD Web Application 2.2//EN' 'http://java.sun.com/j2ee/dtds/web-app_2.2.dtd'>
    <web-app>
    <display-name>ReservationWAR</display-name>
    <description>no description</description>
    <servlet> <servlet-name>ReservationServlet</servlet-name>
    <display-name>ReservationServlet</display-name>
    <description>no description</description>
    <servlet-class>ReservationServlet</servlet-class>
    </servlet>
    <servlet-mapping>
    <servlet-name>ReservationServlet</servlet-name>
    <url-pattern>ReservationAlias</url-pattern>
    </servlet-mapping>
    <session-config>
    <session-timeout>30</session-timeout>
    </session-config>
    <resource-ref>
    <description>no description</description>
    <res-ref-name>jdbc/ReservationDB</res-ref-name>
    <res-type>javax.sql.DataSource</res-type>
    <res-auth>Container</res-auth>
    </resource-ref>
    <ejb-ref> <description>no description</description>
    <ejb-ref-name>ejb/Reservation</ejb-ref-name>
    <ejb-ref-type>Entity</ejb-ref-type>
    <home>ReservationHome</home>
    <remote>Reservation</remote>
    </ejb-ref>
    </web-app>

    Are you sure your servlet class itself can run without problem? Try debug in the these steps:
    1. Change your servlet to simply output some HTML text, so you can be sure tomcat can get to your servlet. If this is OK, it means the servlet itself has problem, probably the EJB stuff.
    2. Make sure the EJB container is running.
    3. Make your servlet a standalone client (not a servlet) and see if it can run. Pay attention to how you do JNDI lookup of the EJB.
    Yi

  • Using java math class  for power's SQ rt and rounding.

    Hey all
    ive attempted to use maths class to create a program a user can enter a number and then the output shows
    The number rounded to the nearest integer
    The Square root of the number
    and finaly the number to the power of 6
    So far i have the following code but im a bit thick to what im missing ....
    import java.util.*;
    public class Mathclass
         public static void main(String[] args)
         Scanner kybd = new Scanner(System.in);
         double num = kybd.nextInt(); // kybd is an instance of Scanner
         public static double ceil (double num);
         public static double sqrt (double num);
         public static double exp (double num);
    }}Please be kind i know the outputs arnt there yet but im getting 15 errors in javac
    Thankyou

    Javaman01 wrote:
    i can understand that you feel this way , i just have a lot of programs i need to complete for a portfolio tommorow , so i need all the help i can get.Well, then I guess you started too late. Talk to your teacher that you won't be able to get it done on your own. Start learning your course book or the basic tutorials I posted and try to do the assignments again. I really think you know too little to get this done.
    Javaman01 wrote:
    if you wish not to help the please dont comment as i fear this will put others of helping me when i need it most.I did help you! And you have nothing to say about me posting here or not. Just as I can't stop you from trying to get others to do your homework.
    Javaman01 wrote:
    thankyouYou're welcome.

  • Permission Class for EJB

    Hi,
    we are creating permission class into an EJB project (like at link http://help.sap.com/saphelp_nw04/helpdata/en/58/3093404f673028e10000000a1550b0/content.htm) but we not find the superclass com.sap.security.api.permissions.ActionPermission.
    Can someone tell us where to find the superclass?
    Regards,
    Matteo

    Hi Matteo,
    Make sure that your project property,Java build path has
    SAP_SYSTEM_ADD_LIBS/comp/SAP-JEE/DCs/sap.com/com.sap.security.api.sda/_comp/gen/default/public/default/lib/java/com.sap.security.api.perm.jar
    In my case it is pointing to the following location
    C:/Program Files/SAP/JDT/eclipse/plugins/com.sap.tc.ap/comp/SAP-JEE/DCs/sap.com/com.sap.security.api.sda/_comp/gen/default/public/default/lib/java/com.sap.security.api.perm.jar

  • Possible to use RMI without IIOP for EJBs?

    Is it possble to use RMI on a client to connect to a remote EJB without using CORBA
    (IIOP)?
    How might I do it?
    I'd like to avoid the CORBA overhead if possible.
    Thanks.

    Do I just have to replace iiop:// with t3:// in the url?
    Andy Piper <[email protected]> wrote:
    "Tom Hennen" <[email protected]> writes:
    Is it possble to use RMI on a client to connect to a remote EJB withoutusing CORBA
    (IIOP)?
    How might I do it?
    I'd like to avoid the CORBA overhead if possible.Use t3
    andy

Maybe you are looking for

  • Communication error when trying to video or audio chat with friends

    whenever i try to audio or video chat with friends this msg comes up saying i didnt get a response from the other person and it tells me to send problems to apple heres my details log Date/Time: 2009-02-23 23:19:47.347 -0500 OS Version: 10.5.6 (Build

  • Prob. with addiational line items when clearing Cust/Vendor

    Hi Experts, I've a serious issue with Account Clearing (F-32, F-44, F-03).  SAP generates unwanted additional line items when clearing customer/Vendor or GL accounts.  I've studied almost all the relevant SAP notes but couldn't found the solution of

  • Preinstalled dictionary is not working on 808

    Hi I was using Nokia's preinstalled dictionary from a long time but I update my phone on 14th feb afterthat it is not working. The problem is that as I'm an Indian so I need Hindi support for some english words. But after that update in place of Hind

  • Computer won't sync with icloud

    After installing Lion and enabling icloud on my macbook pro...it won't sync to icloud.  I've logged in on the internet to see my icloud account and no new entries put in my calendar from my laptop are there.  New enteries from my iphone 4s are in icl

  • Ios simulator for director ios apps

    did someone have success with the xcode ios simulator running a director published .ipa? ive tried so far in xcode 5: uncompressed the .ipa file which gives me a folder called Payload with the .app inside. i copied the app into /Applications/Xcode.ap