EJB function using  SwingUtilities.invokeLater()  is problm msg publishing

My problem for JMS using Message publish to group of people , What I did, Server side I am pushing message for each topic , (it could be n number of topic ) I created for Every five topic to as single thread. (Topic will be [ 200 ~2000] ) ,
Some time this SwingUtilities.invokeLater() function will shown error Message AWT event
I am using EJB Method for like this.
new Thread()
public void run()
     SwingUtilities.invokeLater( new Runnable() {
public void run() {
     HashMap map=null;
     try
          map=MessagePublish2Group.init(); // to getting connection function .
          InitialContext iniCtx=(InitialContext)map.get("InitialContext");                
               TopicSession session =(TopicSession) map.get("TopicSession");
               TextMessage txtmsg = session.createTextMessage();
               txtmsg.setText(Message);
          for(int i=0;i<userlist.length;i++)
               try
               Topic     receiver =(Topic) iniCtx.lookup("topic/"+userlist[i]+"");
          TopicPublisher usertopic = session.createPublisher(receiver);
          usertopic.publish(txtmsg);
          usertopic.close();     
               catch(Exception gexp)
          close(map); // // to closing connection function .
     catch(Exception exp)
          close(map); // to closing connection function .
exp.printStackTrace();
}.start();
Thanks in advance
Sasikumar (Sasimsit)

{color:red}{size:20px}TRIPLE POSTED{size}{color}
[http://forums.sun.com/thread.jspa?threadID=5333442]
[http://forums.sun.com/thread.jspa?threadID=5333443]
[http://forums.sun.com/thread.jspa?threadID=5333445]
Cross posting is rude.
db

Similar Messages

  • Why do we have to use SwingUtilities.invokeLater() to update UI status?

    I just don't understand very well why we have to use SwingUtilities.invokeLater() to update UI status. Why not just new a thread in actionPerformed() method and do time consuming tasks in this thread and update UI status in it? Some tutorials say it is not safe to update UI status not in Event Dispatch Thread, I don't understand, why is it not safe? Can anyone provide a scenario for this? I just write an example, a button and a progressbar, click button, progressbar keeps updating value. I just create a new thread to do this, don't find any issue. Thanks.

    [Swing single threaded rule|http://www.lmgtfy.com/?q=swing+single+threaded+rule]
    db

  • Is it safe to use SwingUtilities.invokeLater(), while updating GUI?

    Hi,
    I am updating GUI components in synchronized block which is runinng on main() thread my application hangs, but if I use SwingUtilities.invokeLater(...) then it runs fine.
    My question is:
    Is it safe to use SwingUtilities.invokeLater(...) in synchronized block.
    Edited by: Amol_Parekh on Nov 1, 2007 1:28 AM

    Paul Hyde in his "Java Thread Programming" (great book!!!) says it is.
    With invokeLater() you say to the Thread Scheduler you want that code to run on the Swing thread. In fact, if that is the only thing you do in the synchronized block I think it is unnecessary.
    Greetings,
    astrognom

  • Should I use a SwingWorker or SwingUtilities.invokeLater() to update my UI?

    Are there specific situations where you want to use method above the other? This whole swing concurrency is very new to me, and I don't really know where to begin.

    When executing long running code you don't want the GUI to freeze. Therefore you have two things to be concerned about. First, you want the long running task to execute in a separate Thread. Secondly, when you need to update the GUI from this code you need to make sure the code executes on the Event Dispatch Thread (EDT).
    You can code this manually by creating a separate Thread and then use SwingUtilities.invokeLater() when necessary.
    A SwingWorker tries to simplify this process by having a simple API where you can add code that executes on a separate Thread or where you can add code that executes on the EDT.
    So in the case of managing long running tasks, the end result should be the same.
    Hwever, there are times when I know code is already executing on the EDT, but I sometimes use invokeLater(..) to force my code to the end of the EDT. This is used in special situations when code doesn't execute in the order you want.
    For example, I've tried to add a FocusListener to a JFormattedTextField to "select the text" when it gains focus. The problem is the the UI also adds a FocusListener. Because of the way listeners are handled the last listener added to the component executes first. Therefore, using the invokeLater() forces my listener code to execute last.
    You can try this code to see what I mean:
    KeyboardFocusManager.getCurrentKeyboardFocusManager()
         .addPropertyChangeListener("permanentFocusOwner", new PropertyChangeListener()
         public void propertyChange(final PropertyChangeEvent e)
              if (e.getNewValue() instanceof JTextField)
                   //  invokeLater needed for JFormattedTextField
                   SwingUtilities.invokeLater(new Runnable()
                        public void run()
                             JTextField textField = (JTextField)e.getNewValue();
                             textField.selectAll();
    });Edited by: camickr on Mar 5, 2011 2:36 PM

  • Why do we have to call SwingUtilities.invokeLater()??

    Hello,
    i am not understanding the concept of SwingUtilities.invokeLater() i read the documentation but still couln't get why it is needed and when it is needed?do we have to call this function everytime some event is generated and some action is performed on component Ex.mouse click on button etc?? Please give me little details regarding it's concept!
    Thanks in advance :)

    (guys correct me if i'm wrong here)Most of the time that's correct, but for some customizations it is necessary to run custom code after all default code contained in the Swing classes has been executed. For example, to request focus be given to a component that would otherwise not be immediately focused, if you omit to enclose that in a invokeLater, it will get the focus but immediately lose it as still-queued events mandate the transfer of focus elsewhere. Moreover, as the event delivery mechanism is asynchronous, the behavior may be inconsistent.
    In general, any customization that may conflict with the normal flow should be wrapped in invokeLater, whether run from the EDT or another thread. The exceptions here are methods which the API declares to be thread safe.
    what you want to do is run that time consuming process in a thread, and when you need to call back to update the GUI, then use SwingUtilities.invokeLater.Or use SwingWorker, that's what it's for.
    cheers, db

  • BPM start event(start condition) doesn't support ejb function call?

    Hi all,
    An id is included in the ws call to trigger the bpm flow,
    I have developed a ejb function, which is doing a simple check whether the process for the specific id is called before or not.
    I have a simple table in bpm java server which records the id used before.
    the ejb is called in the start condition, my desired behavior is: if the ejb returns true, no process should be triggered.
    but the thing is, my flow is not getting triggered once I put the ejb call in the start condition.(ejb is called, as i can see new id record inserted into my db table)
    I cannot even debug the process.
    I can debug the process if that ejb call is removed from the start condition.
    my server is 7.31 sp8
    Best regards,
    Jun

    Thanks for confirming Jun Wu.... always comforting to see even the experts can stuff it up from time to time... and very glad you were able to fix it!

  • Woes wiring up an ejb to use a database control

    first my question & then background:
    how do i wire up an ejb to use a database control jcx object so that the dbcontrol is instantiated at runtime?
    here's the scene:
    i created a java page flow from a database control & this works correctly, but i also need to be able to expose some of the functionality to another deployed application. this application, incidentally is not a workshop application; but rather is a hand-coded war.
    the first application (a workshop app) renders forms that use a database control to persist the data. it only uses one table & therefore, there is only one pojo. as i mentioned, this resides in web project & works correctly. i abstracted my dbcontrol & my pojo to a separate java controls project & built this as a library. the jpf still has no problems seeing the dbcontrol.
    there is a second application (a non workshop app) that needs to be able to use a method provided by the dbcontrol. i created an ejb in a third project in the first application that makes the call to dbcontrol in the exact same way that the jpf did. but i am finding, however, that the dbcontrol is null whenever the ejb makes the call to it's method.
    here's the more detailed design:
    i started with a database control. i mapped to my datasource, wrote out the sql for the methods i wanted & generated the pageflow from this. i rewrote the pageflow/jsps to suit my needs & everything just works. i did notice at the time that i generated the page flow that the dbcontrol was never instantiated. here is a snippet of the jpf:
    <pre>
    public class SiteAlertMessageManagementController extends PageFlowController {
    * This is the control used to generate this pageflow
    * @common:control
    private SiteAlertMessageDBControl dbControl;
    public Forward getCurrentMessage() {  
    SiteAlertMessage currentMessage = dbControl.getCurrentMessage();
    </pre>
    because SiteAlertMessageDBControl is an interface, i assumed that the '@common:control' annotation told weblogic what it needed to know in order to instantiate a runtime class of time SiteAlertMessageDBControl. because it just worked, i never questioned this.
    with the form read/write functionality complete, i assumed i could quickly wrap an ejb around the dbcontrol method & be done with it. i soon realized that i could not create an ejb inside a web project & that an ejb project would not have classpath visibility to my dbcontrol & pojo, so i put the dbcontrol & the pojo into a java control project & made a library out of this. i double checked that the web project could see the classes in the library & they could.
    so i created a separate ejb project that also could now see the classes in the library. i thought i was in the home stretch. i now have these projects in my first application:
    administrationControls, administrationWeb, & administrationEjb. i moved the administrationControls.jar & the administrationEjb.jar over to the WEB-INF/lib directory of my (remember: non-workshop) war & wired up the code to pull the bean off jndi tree to make the rmi call. but it didn't work. so i backtracked & created a new jsp back in my workshop project that would make the same rmi call so that i could use the debugger. with this as the background, here is my specific problem.
    what i noticed is that the ejb code itself works correctly. i guess i should show it as well.
    <pre>
    public class SiteAlertMessagesAPI extends GenericSessionBean implements SessionBean {
    * This is the control used to generate this pageflow
    * @common:control
    private SiteAlertMessageDBControl dbControl;
    public void ejbCreate() {
    // Your code here
    * @ejbgen:remote-method
    public SiteAlertMessage getCurrentMessage() throws Exception {
    SiteAlertMessage message = null;
    try {
    // dbControl is null here
    message = dbControl.getCurrentMessage();
    catch (Exception e) {
    e.printStackTrace();
    return message;
    </pre>
    the problem is that my dbControl object is null. what i did was cut & paste the code from the jpf over to my bean. like i stated earlier, i assumed that the annotation would tell weblogic to instantiate an instance. this was obviously not the case. incidentally, i rewrote my ejbCreate() method like this:
    <pre>
    public void ejbCreate() {
    // Your code here
    dbControl = new SiteAlertMessageDBControl();
    </pre>
    but workshop gives me a "error: this type is abstract and thus cannot be instantiated" warning.
    my question is: how do i wire up an ejb to use a database control jcx object so that the dbcontrol is instantiated at runtime?
    any light you could shed on this would be most appreciated. thanks,
    doug

    Hi,
    unfortunatly, it's not possible to use a control outside a control or a
    web service...
    Emmanuel
    douglas thomas a ?crit :
    first my question & then background:
    how do i wire up an ejb to use a database control jcx object so that the dbcontrol is instantiated at runtime?
    here's the scene:
    i created a java page flow from a database control & this works correctly, but i also need to be able to expose some of the functionality to another deployed application. this application, incidentally is not a workshop application; but rather is a hand-coded war.
    the first application (a workshop app) renders forms that use a database control to persist the data. it only uses one table & therefore, there is only one pojo. as i mentioned, this resides in web project & works correctly. i abstracted my dbcontrol & my pojo to a separate java controls project & built this as a library. the jpf still has no problems seeing the dbcontrol.
    there is a second application (a non workshop app) that needs to be able to use a method provided by the dbcontrol. i created an ejb in a third project in the first application that makes the call to dbcontrol in the exact same way that the jpf did. but i am finding, however, that the dbcontrol is null whenever the ejb makes the call to it's method.
    here's the more detailed design:
    i started with a database control. i mapped to my datasource, wrote out the sql for the methods i wanted & generated the pageflow from this. i rewrote the pageflow/jsps to suit my needs & everything just works. i did notice at the time that i generated the page flow that the dbcontrol was never instantiated. here is a snippet of the jpf:
    <pre>
    public class SiteAlertMessageManagementController extends PageFlowController {
    * This is the control used to generate this pageflow
    * @common:control
    private SiteAlertMessageDBControl dbControl;
    public Forward getCurrentMessage() {  
    SiteAlertMessage currentMessage = dbControl.getCurrentMessage();
    </pre>
    because SiteAlertMessageDBControl is an interface, i assumed that the '@common:control' annotation told weblogic what it needed to know in order to instantiate a runtime class of time SiteAlertMessageDBControl. because it just worked, i never questioned this.
    with the form read/write functionality complete, i assumed i could quickly wrap an ejb around the dbcontrol method & be done with it. i soon realized that i could not create an ejb inside a web project & that an ejb project would not have classpath visibility to my dbcontrol & pojo, so i put the dbcontrol & the pojo into a java control project & made a library out of this. i double checked that the web project could see the classes in the library & they could.
    so i created a separate ejb project that also could now see the classes in the library. i thought i was in the home stretch. i now have these projects in my first application:
    administrationControls, administrationWeb, & administrationEjb. i moved the administrationControls.jar & the administrationEjb.jar over to the WEB-INF/lib directory of my (remember: non-workshop) war & wired up the code to pull the bean off jndi tree to make the rmi call. but it didn't work. so i backtracked & created a new jsp back in my workshop project that would make the same rmi call so that i could use the debugger. with this as the background, here is my specific problem.
    what i noticed is that the ejb code itself works correctly. i guess i should show it as well.
    <pre>
    public class SiteAlertMessagesAPI extends GenericSessionBean implements SessionBean {
    * This is the control used to generate this pageflow
    * @common:control
    private SiteAlertMessageDBControl dbControl;
    public void ejbCreate() {
    // Your code here
    * @ejbgen:remote-method
    public SiteAlertMessage getCurrentMessage() throws Exception {
    SiteAlertMessage message = null;
    try {
    // dbControl is null here
    message = dbControl.getCurrentMessage();
    catch (Exception e) {
    e.printStackTrace();
    return message;
    </pre>
    the problem is that my dbControl object is null. what i did was cut & paste the code from the jpf over to my bean. like i stated earlier, i assumed that the annotation would tell weblogic to instantiate an instance. this was obviously not the case. incidentally, i rewrote my ejbCreate() method like this:
    <pre>
    public void ejbCreate() {
    // Your code here
    dbControl = new SiteAlertMessageDBControl();
    </pre>
    but workshop gives me a "error: this type is abstract and thus cannot be instantiated" warning.
    my question is: how do i wire up an ejb to use a database control jcx object so that the dbcontrol is instantiated at runtime?
    any light you could shed on this would be most appreciated. thanks,
    doug

  • Question on SwingUtilities.invokeLater

    The program I have included is attempting to "simulate" opening and loading a file into memory.
    Run the program, select File and then select Open. You will notice that the File menu does not disappear for 3 seconds (i.e. until the file has been completely read).
    I was hoping it was possible to close the File menu while the file is being read. While reading through various documentation on the invokeLater() method I found the following:
    "Both invokeLater() and invokeAndWait() wait until all pending AWT events finish before they execute"
    Therefore by adding an invokeLater() method I was hoping to accomplish the following series of events:
    1) click on Open menuItem
    2) invoke OpenAction
    3) do the "repaint" (which would cause the file menu to disappear)
    4) finish the OpenAction
    5) do the long running task
    Hopefully you understand what I am trying to accomplish and can provide some guidance. Here is the sample program:
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    public class TestInvokeLater extends JFrame
         JFrame frame;
         JMenuBar menuBar;
         JMenu menu;
         JMenuItem menuItem;
         public TestInvokeLater()
              frame = this;
              setDefaultCloseOperation( EXIT_ON_CLOSE );
              menuBar = new JMenuBar();
              menu = new JMenu("File");
              menuBar.add(menu);
              menuItem = new JMenuItem( new OpenAction() );
              menu.add(menuItem);
              setJMenuBar( menuBar );
              JPanel panel = new JPanel();
              panel.setPreferredSize( new Dimension( 100, 100 ) );
              setContentPane( panel );
         class OpenAction extends AbstractAction
              public OpenAction()
                   putValue( Action.NAME, "Open" );
              public void actionPerformed(ActionEvent e)
              repaint();
         SwingUtilities.invokeLater(new Runnable()
         public void run()
              try
                   Thread.sleep(3000); // simulate log running task
              catch (Exception e) {}
         public static void main(String[] args)
              JFrame frame = new TestInvokeLater();
              frame.pack();
              frame.show();
    }

    Thanks for the input, but I still have some confusion -
    "invokeLater() simply appends the thread to the end of the dispatch queue, this happens before the event code to hide the file menu gets queued"
    This is the part that confuses me. If I understand event driven programming correctly then the code for the MenuItemClicked must complete execution before the next event in the queue can be executed.
    If we assume the code for MenuItemClicked is something like:
    1) fireActionEvent
    2) fireCloseMenuEvent
    When MenuItemClicked is finished executing the next event in the queue is the ActionEvent which invokes my ActionPerformed code:
    1) I use the Swing invokeLater() method (which means it should be queued "after" the fireCloseMenuEvent
    Does this make any sense?

  • Custom ejb function

    Hi expert,
    I need to complete this code in my custum ejb function:
    public DataObject invokeSdo(DataObject input, InvocationContext invocationContext) {
              // check sourceDO
              if (input == null) {
                   throw new IllegalArgumentException("SourceDO must exist");
              if (invocationContext == null) {
                   throw new IllegalArgumentException("HelperContext must exist");
              // input
              Type typeInput = input.getType();
              String parametro = input.getString(typeInput.getProperty(NAME_PROPERTY_INPUT_ARG1));
              // output      
              String item1="string1";
              String item2="string2";
                    String item3="string3";
              DataObject outputDO = invocationContext.createOutputDataObject();
                   HELP ME!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
                        code to add strings item1, item2 , item3 to outputDO
              return outputDO;
    In the function's signature result must be a string whith option "Multiple Occurrences" ???????

    Hi Martin,
    I try your code, this is my ejb function :
    public class UtentiejbBean implements UtentiejbLocal {
         private static final String NAMESPACE_FUNCTION = "demo.sap.com/luca";
         private static final String NAME_PROPERTY_INPUT_ARG1 = SdoRenamingHelper
                   .renameXsdElementToSdoProperty(
                             new QName(NAMESPACE_FUNCTION, "arg1"), false);
         private static final String NAME_PROPERTY_OUTPUT_RESULT = SdoRenamingHelper
                   .renameXsdElementToSdoProperty(new QName(NAMESPACE_FUNCTION,
                             "result"), false);
         public DataObject invokeSdo(DataObject input, InvocationContext invocationContext) {
              // check sourceDO
              if (input == null) {
                   throw new IllegalArgumentException("SourceDO must exist");
              if (invocationContext == null) {
                   throw new IllegalArgumentException("HelperContext must exist");
              // input
              Type typeInput = input.getType();
              String parametro = input.getString(typeInput.getProperty(NAME_PROPERTY_INPUT_ARG1));
              // output
              List<String> listOfStrings =new ArrayList<String>();
              listOfStrings.add("string1");
              listOfStrings.add("string2");
              DataObject responseObject = invocationContext.createOutputDataObject();
              // prepare an array for your response
              List<DataObject> resultList = new ArrayList<DataObject>();
              // get the type definition (sdo property) of your result
              Property myResultProperty = responseObject.getType().getProperty(NAME_PROPERTY_OUTPUT_RESULT) ;
              for (String yourString : listOfStrings) {
                   // create a data object
                   DataObject resultDO = responseObject.createDataObject(myResultProperty);
                   // now set the string as value for your DO and do some other fancy stuff
                   resultDO.setString(resultDO.getType().getProperty(NAME_PROPERTY_OUTPUT_RESULT), yourString);
                   // finally add the element to your result list
                   resultList.add(resultDO);
              // 4. Liste der Ergebnisse zurückgeben
              responseObject.setList(myResultProperty, resultList);
              return responseObject;     
    Then I defined the function :
    name: utenti
    namaspace: demo.sap.com/luca
    return type: string - http://www.w3.org/2001/XMLSchema (with multiple occurrences set)
    parameter name: arg1
    parameter type: string - http://www.w3.org/2001/XMLSchema
    finally i defined a variabile (with expression utenti("arg1") ), in the tab user texts of a task, and i used it in the description field.
    But unfortunatelly my process failed.

  • Javax.swing.SwingUtilities.invokeLater make my program slow

    i am writing a program in which i am implementing documentlistener
    to communicating between two frames
    if i write my code with javax.swing.SwingUtilities.invokeLater it makes my program slow
    and if i write without this thread safe quality then this is fast but giving me runtime exception
    what i do to make my program better
    kindly suggest
    public void insertUpdate(DocumentEvent e) {
                updateLog(e, "inserted into");
            public void removeUpdate(DocumentEvent e) {
                updateLog(e, "removed from");
            public void changedUpdate(DocumentEvent e) {
                //Plain text components don't fire these events.
            public void updateLog(DocumentEvent e, String action) {
                Document doc = (Document)e.getDocument();
    javax.swing.SwingUtilities.invokeLater(new Runnable() {
                public void run() {
    tf4.setText(lbl.getText());
    }

    If your program is becoming too slow or unresponsive, it means that the operation "tf4.setText(lbl.getText());" is taking too long to execute and is therefore blocking the Swing-thread.
    There is little you can do to make that operation faster, but perhaps you can change how or how often you update the frames.
    Setting the whole text via setText() everytime a change happens seems very wasteful. Imagine you have a text with a million characters, and every time the user adds or changes just one character, you are getting and seting over one million characters. That is not the right approach.
    I'm not familiar with text-operations or class DocumentEvent, but I guess that there should be some kind of delta in DocumentEvent containing only the changes that were made. You could apply only these changes on tf4 instead of setting the whole text. Finding out how to do this would be the best solution. This will also make your program more scalable, as with setText() the performance of your application will continuously decrease as the text length increases.
    Usually when working with documents you have a "viewer" and a "model". If your viewer was a JTextBox and your model was, say a StringBuilder, you could make quick changes to the contents of JTextBox using the StringBuilder.append() or delete() methods without having to modify the whole text. You need to find out how this is done with whatever UI system you're using.
    If you can't find out how to do the above, a workaround would be to reduce how often you call "updateLog()". For example, is it truly necessary to call "updateLog" every time a new update happens? Perhaps it would be better to use a timer and only call "updateLog()" every few seconds.
    But as I said, this should only be a temporary workaround. You really should find out how to perform more efficient updates without using setText(). I recommend you search for tutorials and guides on how to work with text and documents on the internet.

  • Create RFC Function using Java Program

    hi
    I am trying to create a small utility in java that extracts data from SAP system and loads it to local Db
    For extracting data from SAP we have a custom ABAP function (RFC) running on SAP server that is called from Java using JCO3 APIs
    Installation of this utility on client side involves -
    1.     Installing RFC on Clientu2019s SAP instance
    2.     Installing / Configuring Java code on Clientu2019s machine
    Is there a way to install / create a RFC function using java -JCO APIs so that Step-1 can be omitted?
    I had browsed through a sample provided in examples installed with JCO3 but its very trivial example can someone point to a exhaustive link or explain how this can be achieved using Java program
    Thanks

    Hi Amit
    I am not sure I understand the question. You want to create an RFC in Java? If this is correct why not create a Remote Method in java for example as EJB or Web Service which is more standard than creating an RFC.
    On the other hand if you want to create a RFC client in Java (a Program which calls a RFC in SAP ABAP system) you can use JCo APIs (which can be either standalone or on the NW Java server) or JRA (from NW 7.1 onwards).
    Regards
    Partha

  • SQL report region source to call a pl/sql function using DB link

    Hi - I have a pl/sql function fn_dbtype(id NUMBER) defined in database X. The pl/sql function executes couple DML statements and returns a string (a SELECT query). I am able to call this function using SQL Plus (Connected to Database X) as below and it works fine:
    declare
    vSQL VARCHAR2(100);
    begin
    vSQL := fn_dbtype(1);
    end;
    The DML operations completed fine and vSQL contains the "Select" query now.
    In APEX:
    I am trying to create a SQL report in APEX using SQL query(PL/SQL function returning a sql statement) option. I am trying to figure out what to put in the region source so that the output of the "Select" query is displayed in the report.
    Moreover APEX is hosted in a different database instance. So I would need to call this pl/sql function using a DB Link.
    Please let me know what I need to put in the region source to execute the pl/sql function which returns the "Select" query thereby displaying the query output in the report. Thanks.
    Edited by: user709584 on Mar 19, 2009 2:32 PM
    Edited by: user709584 on Mar 19, 2009 2:34 PM

    try something like this:
    return fn_dbtype(1)@dblink;

  • How do I pass an array of structs to a C function using the dll flexible prototype adapter?

    What I want to do is pass into a C dll function a variably sized Array of structs of type TPS_Data. My Code compiles but when I run it in TestStand, I get an error -17001; Program Error. "Cannot allocate 0 size buffer Error in parameter 2, 'OpenFrdData'."
    I've allocated the Array of structs, and all of the information is there before I call my function, so is it my prototype? Or am I asking too much of the DLL Flexible Prototype Adapter to pass an Array of Structs?
    I can pass in a single struct of type TPS_Data and that works, but not an array.
    Here's the relevent code:
    typedef struct TPS_DATA
    char Report_Number[256];
    char System_Name[256];
    char Open_Date[256];
    char UUT_Part_Number[256];
    char UUT_Serial_Number[256];
    char UUT_Name[256];
    char Open_Employee_Name[256];
    char Open_Employee_Number[256];
    char Close_Employee_Name[256];
    char Close_Employee_Number[256];
    char Close_Date[256];
    } TPS_Data;
    typedef struct TPS_DATA_ARRAY
    TPS_Data DataRecord;
    } TPS_DataArray;
    long __declspec(dllexport) __stdcall OpenDialog (CAObjHandle Context, TPS_DataArray *TpsData[], const char *psFaultStr, char *sComments, const int nCount);

    OK,
    I can pass the data to the DLL function, using the following types:
    typedef struct StringArrayType
    char string[10][256];
    } StringArray;
    typedef struct MultiStringArrayType
    StringArray Record[10];
    } MultiStringArray;
    void __declspec(dllexport) __stdcall ATP_TestStructPassing(StringArray Strings)
    return;
    void __declspec(dllexport) __stdcall ATP_TestMultiStructPassing(MultiStringArray *Strings)
    return;
    But when the MultiStruct function Exits, TestStand reports an Error:
    -17501 "Unexpected Operating System Error" Source: 'TSAPI'
    There doesn't seem to be a way around this, and once the error occurs, I have to force quit TestStand. I've included the sequence file, and the dll code can be compiled from the fun
    ctions shown above.
    Any thoughts on how to get around this error would be greatly appreciated.
    Attachments:
    StructArrayPassing.seq ‏16 KB

  • How can i do the upload file function using tomcat library??

    how can i do the upload file function using tomcat library??

    Did you read the document for the library?
    If you can't figure it out, why don't you ask the people who provide the library?
    This has nothing to do with JavaMail.

  • How to  use data function using characterstics variable for calculation on

    how to  use data function using characterstics variable for calculation on  attribute as key figure

    Hi Gayatri
    Did you not see my answer for CASE because CASE does indeed offer the use of the BETWEEN clause, but DECODE does not. Let me give you a little synopsis of DECODE.
    In its most simple form it takes 4 values and looks like this: DECODE(A, B, C, D)
    This essentially means, IF A = B THEN C ELSE D
    The trick to solving BETWEEN in a DECODE is to work out algoriths where A = B. Because we don't know how many values are between 00 and 99, although I could guess there were 100 we could of course have 100 parts in the DECODE but that would be awful. How about if we look at it another way and say this:
    IF PART_NUMBER < 'SDK00' THEN pay_amount
    ELSE IF PART_NUMBER > 'SDK99' THEN pay_AMOUNT
    ELSE pay_amount + 100
    This statement only had 2 hard coded values, but how to make DECODE work with less than? Easy, we use the LEAST function. The LEAST function takes 2 values and returns the one with the lowest value. So I use LEAST(PART_NUMBER, 'SDK00') then whenever the PART_NUMBER is lower than SDK00 it will be true. A similar situation exists for the opposite function GREATEST. Putting all of this together then, you can do this:
    DECODE(PART_NUMBER, GREATEST(PART_NUMBER, 'SDK00'), DECODE(PART_NUMBER, LEAST(PART_NUMBER, 'SDK99'), PAY_AMOUNT * 100, PAY_AMOUNT), PAY_AMOUNT)
    In English this can be read as follows:
    IF the PART_NUMBER is greater than or equal to SDK00 and the PART_NUMBER is less than or equal to SDK99 THEN PAY_AMOUNT x 100 ELSE 0
    Best wishes
    Michael

Maybe you are looking for