Thread execution

Hello,
I am misunderstanding why this finishes the thread before the program exits. I thought that the thread executes on its own branch then the main program continues, in which the main method finishes thus calling the threads to stop before java shuts down.
public class TestThread extends Thread {
  public void run() {
    for (int incr=0;incr<100000;incr++) {
      System.out.println("The value of incr is: "+incr);
  public static void main(String[] args) {
    TestThread thread1=new TestThread();
    thread1.start();
}Here the thread loop completes entirely.
public class TestThread extends Thread {
  public void run() {
    for (int incr=0;incr<900000;incr++) {
      System.out.println("The value of incr is: "+incr);
  public static void main(String[] args) {
    TestThread thread1=new TestThread();
    thread1.start();
    System.exit(0);
}Here the thread doesn't complete in its entirety. I thought that the two examples provides above were similiar. Why is the first example's main method waiting on the thread before shutdown?
Thanks for your help.
--Gregory                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

Thank you for your responses. I'm just trying to understand. Second question, when I override public void start() { run(); } to the class I've extended. I did basically what the API says it does, call run(), but it doesn't seem to branch off as an independent thread. When should the start() method be ever overwritten?
public class TestThread extends Thread {
  public void run() {
    for (int incr=0;incr<10000;incr++) {
      System.out.println("The value of incr is: "+incr);
  public void start() {
    run();
  public static void main(String[] args) {
    TestThread testThread=new TestThread();
    testThread.setDaemon(true);
    testThread.start();
}Thank you again

Similar Messages

  • Thread execution causes Swing GUI to become unpresponsive

    Hello, I'm trying to refresh my memory of multithreaded Swing applications and have run into a wall. I have my main class, SimpleGUI, which creates the GUI interface and instantiates SimplePB and starts the SimplePB thread. The problem is that the SimpleGUI main class, which has a button to start the SimplePB thread so that a progress bar is updated, will result in a unresponsive GUI when the button is clicked. The button action code follows:
    public void actionPerformed(ActionEvent ae)
              System.out.println("Got action! "+ae);
              if(ae.getActionCommand().equals("Start")) {
              jb.setEnabled(false);
              spbt.run();
         }Do I need to do the Swing interface in a multithreaded manner as well? If so, how? If not, what am I doing wrong? Any pointers are greatly appreciated, thanks.

    sbpt.run();sbpt.start();
    At the moment you're not doing 'thread execution' at all, you are just running its code inline in the AWT thread, which freezes the GUI, which is why you needed the thread in the first place.

  • Process and thread execution time

    HI all
    I am doing a project to develop a high level simulation framework. In the project I need to calculate the number of cycles of a snippet of code in a thread. Like
    void func()
    event1():
    int x;
    x = x * x;
    for();
    while();
    exec(numberofcyles)
    event2();
    Here I want to calculate the number of cycles between event1 and event2 and pass these number of cycles to the exec(numberofcycles) which will later on be simulated. I investigated a number of tools like gprof, Dtrace, linux process statistics, rdstc, getrusage(). None of these seems to be very relevent.
    I tried linux process statistics i.e. /proc/<pid>/task/<tid>/stat. I can access the execution time of threads, but all the time I get 0 execution time. What I think that it reads the execution time of threads when it was started. Is there any way to get the updated execution time of thread?
    Any help will be highly appreciated.
    Irfan

    I suggest reposting in the Unix forum here:
    http://discussions.apple.com/forum.jspa?forumID=735

  • Thread execution time problem

    Hi everyone.
    I�m developing an application that creates multiple threads, does certain calculations, and runs a couple programs.
    The problem is: for some reason, the time that takes to run each thread tends to increment as the number of threads increments.
    That is, for 2 threads the time is x for 4 is x + n, and so on.
    I�d checked that every thread is doing the same (with few differences that not influences in a reasonable fashion), and that, skipping the external programs execution, the problem doesn�t exist. Moreover, there are no inter thread communication.
    My questions: there is any way in which I can reduce the amount of time?
              There is some reason for the amount of time the external process called takes to run to increment? (I checked that if I not call those programs the amount of time each thread takes to execute is near 0 millisecs).
              Something like Windows limits the use of a program multiple times, or something like that.(yes i have only tested it in Windows environment, and yes, the external programs i use are posix compliant)
    The actually time is about 120 secs., and I have to cut it to, at least, aprox. 40.
    A thread alone can run in less than 30 secs., in the worst case.
    Thanks in advance.

    Now imagine that most of the tasks involve fetching
    something from the refrigerator. Even if you have
    multiple chefs in the kitchen, they will, unless
    scheduled properly, all be contending to open the
    door and reach inside.I think that could be the case. All the threads are trying to execute the same archive. As far as I remember, a file isn't locked if it is accessed for reading (or executing) only, but, on the other hand, you're right, there is only one refrigerator on this kitchen, and too many chefs.
    Something else attracted my attention about this. When I run my project, there are two things that grow considerably: first the CPU's usage, and second, the amount of memory each of the external process called by my program consumes I think this could be related with my problem.
    Again: I ran my project commenting the calls to Runtime.exec(�command�) and the time dropped significantly. Running normally, the threads tend to increment their time of execution. Lets say the first thread takes to execute X seconds, the nth thread will take X plus M. In the test I ran, the first thread lived for 30 seconds and the last (150th) lived for about 130 seconds. Without the calls to Runtime.exec() the first threads lived for 0 milliseconds and the last(150th) lived for 6 milliseconds. Therefore, the CPU�s overhead for everything else isn�t the problem here, I think.
    I tried something else to discard the problem of the file access:
    I created ten copies of the ping program in a directory other than the system default, and called them �ping1�, �ping2�, and so on.
    Then, I created a program that creates some threads and executes a ping through a call to the program pingN (with Runtime.exec(), again), so each thread will access a different file (the first thread access ping1, the second ping2 �), and so, the bottle neck problem on the file system shouldn�t happen. But that hasn�t changed anything. With the calls to Runtime.exec() the execution time goes to the clouds, and without it, it�s near zero. And neither is fault of the ping, the I set the timeout to 3 seconds and the retries to 4, so the max amount of time it�ll take to execute is about 12 seconds, but it takes 40+-

  • Thread execution halted

    Hi everyone,
    I'm currently coding a program that acts as a link between 2 applications via a socket.
    When i press the connect button in my swing form it creates a connectionmanager and executes the connectBridge() method.
    Going further down the methods the method createLink() is executed.
    This method listens on a specific port waiting for a connection.
    This is where the program halts until a connection has been made.
    Is there any way to let the execution of connectBridge() move on?
    Thanks
    //Swing form
    ConnectionManager cm = new ConnectionManager();
    cm.connectBridge("127.0.0.1", 4444, "192.168.0.1", 4444);
    cm.start();
    //connection manager class
    public class ConnectionManager extends Thread {
        private String prefix = "ConnectionManager :: ";
        public static int bridgeSize = 20;
        public static int bridgeIndex = 0;
        public ScripterLinkManager slm;
        public ProxyLinkManager plm;
        public String[][] bridge = new String[2][bridgeSize];
        public ConnectionManager() {
         slm = new ScripterLinkManager(this);
         plm = new ProxyLinkManager(this);
         prepareBridge();
        @Override
        public void run() {
         while (true) {
             try {
              Thread.sleep(500);
              //Thread.yield();
              printBridgeStates();
             } catch (InterruptedException ex) {
              ex.printStackTrace();
    public void connectBridge(String scripterIP, int scripterPort, String proxyIP, int proxyPort) {
         System.out.println(prefix + "connectBridge()\n\tScripter: " + scripterIP + ":" + scripterPort + "\n\tProxy: " + proxyIP + ":" + proxyPort);
         bridge[0][bridgeIndex] = scripterIP + ":" + scripterPort;
         bridge[1][bridgeIndex] = proxyIP + ":" + proxyPort;
         bridgeIndex++;
         plm.createLink(proxyIP, proxyPort);
         slm.createLink(scripterIP, scripterPort);
    //scripter link manager
    public class ScripterLinkManager extends Thread {
        private String prefix = "ScripterLinkManager :: ";
        private static int sIndex = 0;
        private ConnectionManager owner;
        private Vector<ScripterLink> slv = new Vector<ScripterLink>();
        public ScripterLinkManager(ConnectionManager owner) {
         this.owner = owner;
    public int createLink(String ip, int port) {
         try {
             ServerSocket server = new ServerSocket();
    //EXECUTION IS HALTED HERE
             server.bind(new InetSocketAddress(ip, port));
             this.slv.add(sIndex, new ScripterLink(this, server.accept(), sIndex));
             this.slv.get(sIndex).start();
             sIndex++;
         } catch (IOException ex) {
             ex.printStackTrace();
         return sIndex - 1;
        }

    What happens is that now you have two separate threads happening at the same time. The first thread is the one going through your main method, the second is created by "new Thread(r)" and is started by "t.start()".
    The crucial point to understand is that threads are executed independently- the run method of HelloRunner does not execute through to completion while main waits for it. The first thread will continue to execute its commands at the same time that the second thread does. Think of it this way: you have ten tasks to do. What you have done is find a coworker and given him a few of those tasks to work on. He doesn't sit and wait for you to finish yours before working on his; he works on them at the same time.
    But there is a subtlety here- the CPU of your computer can execute only one thread at a time. All these threads are competing for the CPU time and the CPU switches between them (this switching can be be fast). There are ways to give threads different priorities, but most threads have the same priority level. There is no guarantee as to what thread the CPU will work on and how long it will work on that thread before switching to another. What that means is that, if you run your program many times, you may find that your output is not appearing in the same order. In this case, though, the CPU is executing the next statement of the first thread before it has initialized the loop and entered it in the second thread.

  • How to manage thread execution?

    Hi friends,
    I have a scenario like in my program i have created three threads like t1,t2,t3 and i have started thread t1and t2 at the same time and i have to put the condition like t3 will be started only when t2 finishes before t1 otherwise t3 will not be started.
    Please tell me the logic for doing that.
    Thanks.

    You have a flag.
    The execution path for t2 sets that flag when t2 is finished.
    The execution path for t1 checks the flag at the end of the execution. If the flag is set then create t3 and start it.

  • Thread execution time

    I have a logic that creates an XML by iterating through a collection of objects (which in turn has many child collections). When the number of collection becomes more it actually takes too long time to complete the xml generation. So i decided to go for threaded design where i create a thread for each parent collection. For e.g. earlier if i had 10 parent collections it would take 60 secs (6 secs for each). Now after my threaded design i expected it to be at 6 secs for all the 10 collections as all 10 collections are executed parallely. But to my surprise it didn't give me much time difference. It was almost the same time (reduced a little time). Iam wondering what could be wrong?. After creating all my threads say 10 threads for 10 collections iam using JOIN to connect all of them. Any inputs would be greatly appreciated.
    TIA.
    Balachandar.

    It will take the same time since the same amount of work needs to be done regardless of the number of threads used! Unless you have a lot of processors in your system then threads only 'seem' to run concurrently. Even with a multiprocessor system you need a JVM which would take advantage of the extra processors to see any speed increase.

  • SQL Trace in SAP Manufacturing Execution Logging Configuration disappear

    Dears,
    We set it to trace the sql log, but it often disappear suddently.
    The log may as below for your referenct.
    Thanks!
    #2.0 #2011 04 01 16:15:13:836#+0800#Info#com.sap.me.trace#
    ##sap.com/meear#68B5996B863C332900000000000010A8#1859650000000004#sap.com/meear#com.sap.me.trace.VM#UMEUser#5922#SAP J2EE Engine JTA Transaction : [01c604207ffffffd85f]#FC6254555C3711E081A10000001C6042#24ac39ef5c3811e0bd410000001c6042#24ac39ef5c3811e0bd410000001c6042#0#Thread[HTTP Worker [@1423449306],5,Dedicated_Application_Thread]#Plain##
    [0] SELECT MODIFIED_DATE_TIME from WORKSTATION where HANDLE='WorkstationBO:FXM,S,POD_CARY' #
    #2.0 #2011 04 01 16:15:46:695#+0800#Error#com.sap.engine.services.webservices.espbase.server.runtime.RuntimeProcessingEnvironment#
    #BC-ESI-WS-JAV-RT#webservices_lib#68B5996B863C332A00000001000010A8#1859650000000005#sap.com/me~ear#com.sap.engine.services.webservices.espbase.server.runtime.RuntimeProcessingEnvironment#Guest#0##3975C02C5C3811E0A21E0000001C6042#3975c02c5c3811e0a21e0000001c6042#3975c02c5c3811e0a21e0000001c6042#0#Thread[HTTP Worker [@2101874070],5,Dedicated_Application_Thread]#Plain##
    process()
    [EXCEPTION]
    com.sap.engine.interfaces.webservices.runtime.ProtocolException: Authentication failed. For details see log entry logID=68B5996B863C332A00000000000010A8 in security log.
         at com.sap.engine.services.wssec.srt.protocols.ProviderSecurityProtocol.logThrowable(ProviderSecurityProtocol.java:1103)
         at com.sap.engine.services.wssec.srt.protocols.ProviderSecurityProtocol.afterDeserialization(ProviderSecurityProtocol.java:719)
         at com.sap.engine.services.webservices.espbase.server.runtime.ProtocolProcessor.protocolsAfterDeserialization(ProtocolProcessor.java:156)
         at com.sap.engine.services.webservices.espbase.server.runtime.RuntimeProcessingEnvironment.preProcess(RuntimeProcessingEnvironment.java:439)
         at com.sap.engine.services.webservices.espbase.server.runtime.RuntimeProcessingEnvironment.process(RuntimeProcessingEnvironment.java:260)
         at com.sap.engine.services.webservices.runtime.servlet.ServletDispatcherImpl.doPostWOLogging(ServletDispatcherImpl.java:178)
         at com.sap.engine.services.webservices.runtime.servlet.ServletDispatcherImpl.doPostWithLogging(ServletDispatcherImpl.java:114)
         at com.sap.engine.services.webservices.runtime.servlet.ServletDispatcherImpl.doPost(ServletDispatcherImpl.java:72)
         at com.sap.engine.services.webservices.servlet.SOAPServletExt.doPost(SOAPServletExt.java:90)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:754)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:847)
         at com.sap.engine.services.servlets_jsp.server.runtime.FilterChainImpl.runServlet(FilterChainImpl.java:162)
         at com.sap.engine.services.servlets_jsp.server.runtime.FilterChainImpl.doFilter(FilterChainImpl.java:81)
         at com.sap.me.webservice.ClearServiceContextFilter.doFilter(ClearServiceContextFilter.java:28)
         at com.sap.engine.services.servlets_jsp.server.runtime.FilterChainImpl.doFilter(FilterChainImpl.java:73)
         at com.sap.engine.services.servlets_jsp.server.HttpHandlerImpl.runServlet(HttpHandlerImpl.java:461)
         at com.sap.engine.services.servlets_jsp.server.HttpHandlerImpl.handleRequest(HttpHandlerImpl.java:298)
         at com.sap.engine.services.httpserver.server.RequestAnalizer.startServlet(RequestAnalizer.java:397)
         at com.sap.engine.services.httpserver.server.RequestAnalizer.startServlet(RequestAnalizer.java:386)
         at com.sap.engine.services.servlets_jsp.filters.DSRWebContainerFilter.process(DSRWebContainerFilter.java:48)
         at com.sap.engine.services.httpserver.chain.AbstractChain.process(AbstractChain.java:78)
         at com.sap.engine.services.servlets_jsp.filters.ServletSelector.process(ServletSelector.java:83)
         at com.sap.engine.services.httpserver.chain.AbstractChain.process(AbstractChain.java:78)
         at com.sap.engine.services.servlets_jsp.filters.ApplicationSelector.process(ApplicationSelector.java:243)
         at com.sap.engine.services.httpserver.chain.AbstractChain.process(AbstractChain.java:78)
         at com.sap.engine.services.httpserver.filters.WebContainerInvoker.process(WebContainerInvoker.java:78)
         at com.sap.engine.services.httpserver.chain.HostFilter.process(HostFilter.java:9)
         at com.sap.engine.services.httpserver.chain.AbstractChain.process(AbstractChain.java:78)
         at com.sap.engine.services.httpserver.filters.ResponseLogWriter.process(ResponseLogWriter.java:60)
         at com.sap.engine.services.httpserver.chain.HostFilter.process(HostFilter.java:9)
         at com.sap.engine.services.httpserver.chain.AbstractChain.process(AbstractChain.java:78)
         at com.sap.engine.services.httpserver.filters.DefineHostFilter.process(DefineHostFilter.java:27)
         at com.sap.engine.services.httpserver.chain.ServerFilter.process(ServerFilter.java:12)
         at com.sap.engine.services.httpserver.chain.AbstractChain.process(AbstractChain.java:78)
         at com.sap.engine.services.httpserver.filters.MonitoringFilter.process(MonitoringFilter.java:29)
         at com.sap.engine.services.httpserver.chain.ServerFilter.process(ServerFilter.java:12)
         at com.sap.engine.services.httpserver.chain.AbstractChain.process(AbstractChain.java:78)
         at com.sap.engine.services.httpserver.filters.MemoryStatisticFilter.process(MemoryStatisticFilter.java:43)
         at com.sap.engine.services.httpserver.chain.ServerFilter.process(ServerFilter.java:12)
         at com.sap.engine.services.httpserver.chain.AbstractChain.process(AbstractChain.java:78)
         at com.sap.engine.services.httpserver.filters.DSRHttpFilter.process(DSRHttpFilter.java:42)
         at com.sap.engine.services.httpserver.chain.ServerFilter.process(ServerFilter.java:12)
         at com.sap.engine.services.httpserver.chain.AbstractChain.process(AbstractChain.java:78)
         at com.sap.engine.services.httpserver.server.Processor.chainedRequest(Processor.java:428)
         at com.sap.engine.services.httpserver.server.Processor$FCAProcessorThread.process(Processor.java:247)
         at com.sap.engine.services.httpserver.server.rcm.RequestProcessorThread.run(RequestProcessorThread.java:45)
         at com.sap.engine.core.thread.execution.Executable.run(Executable.java:122)
         at com.sap.engine.core.thread.execution.Executable.run(Executable.java:101)
         at com.sap.engine.core.thread.execution.CentralExecutor$SingleThread.run(CentralExecutor.java:327)
    Caused by: com.sap.engine.services.wssec.policy.exception.VerifyException: [ASJ.wssec.020441] Authentication failed. For details see log entry logID=68B5996B863C332A00000000000010A8 in security log.
         at com.sap.engine.services.wssec.srt.protocols.ProviderSecurityProtocol.authenticate(ProviderSecurityProtocol.java:258)
         at com.sap.engine.services.wssec.srt.protocols.ProviderSecurityProtocol.afterDeserialization(ProviderSecurityProtocol.java:687)
         ... 47 more
    #2.0 #2011 04 01 16:15:46:773#+0800#Error#com.sap.engine.services.webservices.espbase.server.runtime.RuntimeProcessingEnvironment#
    #BC-ESI-WS-JAV-RT#webservices_lib#68B5996B863C332C00000001000010A8#1859650000000005#sap.com/me~ear#com.sap.engine.services.webservices.espbase.server.runtime.RuntimeProcessingEnvironment#Guest#0##3A404CDE5C3811E0CD230000001C6042#3a404cde5c3811e0cd230000001c6042#3a404cde5c3811e0cd230000001c6042#0#Thread[HTTP Worker [@909268645],5,Dedicated_Application_Thread]#Plain##
    process()
    [EXCEPTION]
    com.sap.engine.interfaces.webservices.runtime.ProtocolException: Authentication failed. For details see log entry logID=68B5996B863C332C00000000000010A8 in security log.
         at com.sap.engine.services.wssec.srt.protocols.ProviderSecurityProtocol.logThrowable(ProviderSecurityProtocol.java:1103)
         at com.sap.engine.services.wssec.srt.protocols.ProviderSecurityProtocol.afterDeserialization(ProviderSecurityProtocol.java:719)
         at com.sap.engine.services.webservices.espbase.server.runtime.ProtocolProcessor.protocolsAfterDeserialization(ProtocolProcessor.java:156)
         at com.sap.engine.services.webservices.espbase.server.runtime.RuntimeProcessingEnvironment.preProcess(RuntimeProcessingEnvironment.java:439)
         at com.sap.engine.services.webservices.espbase.server.runtime.RuntimeProcessingEnvironment.process(RuntimeProcessingEnvironment.java:260)
         at com.sap.engine.services.webservices.runtime.servlet.ServletDispatcherImpl.doPostWOLogging(ServletDispatcherImpl.java:178)
         at com.sap.engine.services.webservices.runtime.servlet.ServletDispatcherImpl.doPostWithLogging(ServletDispatcherImpl.java:114)
         at com.sap.engine.services.webservices.runtime.servlet.ServletDispatcherImpl.doPost(ServletDispatcherImpl.java:72)
         at com.sap.engine.services.webservices.servlet.SOAPServletExt.doPost(SOAPServletExt.java:90)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:754)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:847)
         at com.sap.engine.services.servlets_jsp.server.runtime.FilterChainImpl.runServlet(FilterChainImpl.java:162)
         at com.sap.engine.services.servlets_jsp.server.runtime.FilterChainImpl.doFilter(FilterChainImpl.java:81)
         at com.sap.me.webservice.ClearServiceContextFilter.doFilter(ClearServiceContextFilter.java:28)
         at com.sap.engine.services.servlets_jsp.server.runtime.FilterChainImpl.doFilter(FilterChainImpl.java:73)
         at com.sap.engine.services.servlets_jsp.server.HttpHandlerImpl.runServlet(HttpHandlerImpl.java:461)
         at com.sap.engine.services.servlets_jsp.server.HttpHandlerImpl.handleRequest(HttpHandlerImpl.java:298)
         at com.sap.engine.services.httpserver.server.RequestAnalizer.startServlet(RequestAnalizer.java:397)
         at com.sap.engine.services.httpserver.server.RequestAnalizer.startServlet(RequestAnalizer.java:386)
         at com.sap.engine.services.servlets_jsp.filters.DSRWebContainerFilter.process(DSRWebContainerFilter.java:48)
         at com.sap.engine.services.httpserver.chain.AbstractChain.process(AbstractChain.java:78)
         at com.sap.engine.services.servlets_jsp.filters.ServletSelector.process(ServletSelector.java:83)
         at com.sap.engine.services.httpserver.chain.AbstractChain.process(AbstractChain.java:78)
         at com.sap.engine.services.servlets_jsp.filters.ApplicationSelector.process(ApplicationSelector.java:243)
         at com.sap.engine.services.httpserver.chain.AbstractChain.process(AbstractChain.java:78)
         at com.sap.engine.services.httpserver.filters.WebContainerInvoker.process(WebContainerInvoker.java:78)
         at com.sap.engine.services.httpserver.chain.HostFilter.process(HostFilter.java:9)
         at com.sap.engine.services.httpserver.chain.AbstractChain.process(AbstractChain.java:78)
         at com.sap.engine.services.httpserver.filters.ResponseLogWriter.process(ResponseLogWriter.java:60)
         at com.sap.engine.services.httpserver.chain.HostFilter.process(HostFilter.java:9)
         at com.sap.engine.services.httpserver.chain.AbstractChain.process(AbstractChain.java:78)
         at com.sap.engine.services.httpserver.filters.DefineHostFilter.process(DefineHostFilter.java:27)
         at com.sap.engine.services.httpserver.chain.ServerFilter.process(ServerFilter.java:12)
         at com.sap.engine.services.httpserver.chain.AbstractChain.process(AbstractChain.java:78)
         at com.sap.engine.services.httpserver.filters.MonitoringFilter.process(MonitoringFilter.java:29)
         at com.sap.engine.services.httpserver.chain.ServerFilter.process(ServerFilter.java:12)
         at com.sap.engine.services.httpserver.chain.AbstractChain.process(AbstractChain.java:78)
         at com.sap.engine.services.httpserver.filters.MemoryStatisticFilter.process(MemoryStatisticFilter.java:43)
         at com.sap.engine.services.httpserver.chain.ServerFilter.process(ServerFilter.java:12)
         at com.sap.engine.services.httpserver.chain.AbstractChain.process(AbstractChain.java:78)
         at com.sap.engine.services.httpserver.filters.DSRHttpFilter.process(DSRHttpFilter.java:42)
         at com.sap.engine.services.httpserver.chain.ServerFilter.process(ServerFilter.java:12)
         at com.sap.engine.services.httpserver.chain.AbstractChain.process(AbstractChain.java:78)
         at com.sap.engine.services.httpserver.server.Processor.chainedRequest(Processor.java:428)
         at com.sap.engine.services.httpserver.server.Processor$FCAProcessorThread.process(Processor.java:247)
         at com.sap.engine.services.httpserver.server.rcm.RequestProcessorThread.run(RequestProcessorThread.java:45)
         at com.sap.engine.core.thread.execution.Executable.run(Executable.java:122)
         at com.sap.engine.core.thread.execution.Executable.run(Executable.java:101)
         at com.sap.engine.core.thread.execution.CentralExecutor$SingleThread.run(CentralExecutor.java:327)
    Caused by: com.sap.engine.services.wssec.policy.exception.VerifyException: [ASJ.wssec.020441] Authentication failed. For details see log entry logID=68B5996B863C332C00000000000010A8 in security log.
         at com.sap.engine.services.wssec.srt.protocols.ProviderSecurityProtocol.authenticate(ProviderSecurityProtocol.java:258)
         at com.sap.engine.services.wssec.srt.protocols.ProviderSecurityProtocol.afterDeserialization(ProviderSecurityProtocol.java:687)
         ... 47 more
    #2.0 #2011 04 01 16:15:46:836#+0800#Error#com.sap.engine.services.webservices.espbase.server.runtime.RuntimeProcessingEnvironment#
    #BC-ESI-WS-JAV-RT#webservices_lib#68B5996B863C332E00000001000010A8#1859650000000005#sap.com/me~ear#com.sap.engine.services.webservices.espbase.server.runtime.RuntimeProcessingEnvironment#Guest#0##3A5373A25C3811E0BEB70000001C6042#3a5373a25c3811e0beb70000001c6042#3a5373a25c3811e0beb70000001c6042#0#Thread[HTTP Worker [@1423449306],5,Dedicated_Application_Thread]#Plain##
    process()
    [EXCEPTION]
    com.sap.engine.interfaces.webservices.runtime.ProtocolException: Authentication failed. For details see log entry logID=68B5996B863C332E00000000000010A8 in security log.
         at com.sap.engine.services.wssec.srt.protocols.ProviderSecurityProtocol.logThrowable(ProviderSecurityProtocol.java:1103)
         at com.sap.engine.services.wssec.srt.protocols.ProviderSecurityProtocol.afterDeserialization(ProviderSecurityProtocol.java:719)
         at com.sap.engine.services.webservices.espbase.server.runtime.ProtocolProcessor.protocolsAfterDeserialization(ProtocolProcessor.java:156)
         at com.sap.engine.services.webservices.espbase.server.runtime.RuntimeProcessingEnvironment.preProcess(RuntimeProcessingEnvironment.java:439)
         at com.sap.engine.services.webservices.espbase.server.runtime.RuntimeProcessingEnvironment.process(RuntimeProcessingEnvironment.java:260)
         at com.sap.engine.services.webservices.runtime.servlet.ServletDispatcherImpl.doPostWOLogging(ServletDispatcherImpl.java:178)
         at com.sap.engine.services.webservices.runtime.servlet.ServletDispatcherImpl.doPostWithLogging(ServletDispatcherImpl.java:114)
         at com.sap.engine.services.webservices.runtime.servlet.ServletDispatcherImpl.doPost(ServletDispatcherImpl.java:72)
         at com.sap.engine.services.webservices.servlet.SOAPServletExt.doPost(SOAPServletExt.java:90)
    Edited by: Ivan_liu_tw on Apr 1, 2011 10:30 AM

    Hello.
    I experienced initial version of WSRM but as I know.....
    Basically FSCM data is based on PI and WSRM is just kind of cover using web service.
    So you can see sync, async messages in tcode SXI_MONITOR even if WSRM configured.
    As you see when set up in SOAMANAGER, WSRM just cover web service on existing PI interface and it's transfered through bgRFC, scheduler, ICM etc... but PI interface architecture is still used and only PI server is not used.
    Hope it helps.

  • Thread: Could not generate the XML in single thread mode

    Hi all,
    I have created a report using PLSQL Procedure method after submitting the request I am getting the following Error.Couldn't sort out why I am getting the error while running the report.
    Error in "Multi threaded or single threaded execution block" of XXRX_REPORT_OUTPUT_PKG.insert_into_nested_table procedure
    ERROR :ORA-20005: Could not generate the XML in single thread mode
    XXRXERROR: XXRX_REPORT_OUTPUT_PKG.run_report SQLERROR: ORA-20005: ORA-20005: Could not generate the XML in single thread mode
    Can someone help me out finding the issue
    Thanks in Advance

    Hi,
    Please read SQL and PL/SQL FAQ
    We cannot guess what is the error if you don't post any part of your code.
    Additionally when you put some code or output please enclose it between two lines starting with {noformat}{noformat}
    i.e.:
    {noformat}{noformat}
    SELECT ...
    {noformat}{noformat}
    Regards.
    Al                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

  • Lack of randomness in my threads

    Hi, I have the following code:
    import java.util.Collections;
    import java.util.List;
    import java.util.LinkedList;
    import java.util.Iterator;
    public class ThreadSafeCollection {
         public static void main(String args[]) throws Exception {
              List queue = Collections.synchronizedList(new LinkedList());
              LinkedList threads = new LinkedList();
              int i = 0;
              while(i < 25) {
                   threads.add(new InsertMessages("Thread" + i, queue));
                   i++;
              Iterator iterator = threads.iterator();
              while(iterator.hasNext()) {
                   ((InsertMessages)iterator.next()).start();
              Thread.sleep(2000);
              System.out.println("threads contains " + threads.size());
              System.out.println("queue contains " + queue.size() + " items.");
    class InsertMessages extends Thread {
         List queue;
         final static int maxIterations = 10;
         public InsertMessages(String threadName, List queue) {
              super(threadName);
              this.queue = queue;
         public void run() {
              int iterations = 0;
              try {
                   Thread.sleep((int)Math.random() * 1000);
              catch(InterruptedException e) {
                   System.err.println("something");               
              while(iterations < maxIterations) {
                   queue.add(getName() + " at iteration " + iterations);
                   iterations++;                    
    This above code produce the following results for the queue:
    Thread0 at iteration 0, Thread0 at iteration 1, Thread0 at iteration 2, Thread0 at iteration 3, Thread0 at iteration 4, Thread0 at iteration 5, Thread0 at iteration 6, Thread0 at iteration 7, Thread0 at iteration 8, Thread0 at iteration 9, Thread1 at iteration 0, Thread1 at iteration 1, Thread1 at iteration 2, Thread1 at iteration 3, Thread1 at iteration 4, Thread1 at iteration 5.....
    My problem is that the Thread execute in order from 1 to 10. This seems very deterministic. I expected more randomness. i.e. I expected the order of thread execution to be something like this: Thread3, Threads8, Thread1, Thread7... Any ideas why this is happening?
    Thanks,
    Paul0al

    This is happening because you are inserting the threads into this list, then you are starting them in the same order. So one starts, runs, sleeps, the second starts, runs, sleeps, etc... So of course they go in order. However, if you left it running a long time, it's not impossible that due to factors beyond your control, one thread might sleep a little longer or shorter and therefore cause the threads to start running in different orders, but even that will likely remain in the same different order for some period of time.
    If you really are wanting to start them in any order, then put the threads in a collection that doesn't guaranty an order (like Hashtable) and then get an iterator and start them. The other thing to do would be to start threads and have the sleep time be some random value each time to.

  • Is this roughly how the labVIEW Execution Systems work?

    I've not taken a class in OS design, so I don't know the strategies used to implement multitasking, preemptive or cooperative. The description below is a rough guess.
    LabVIEW compiles Vis to execute within its own multitasking execution environment. This execution environment is composed of 6 execution systems. Each execution system has 5 priority queues (say priorities 0->4). Vis are compiled to one or more tasks which are posted for execution in these queues.
    An execution system may either have multiple threads assigned to execute tasks from each priority queue, or may have a single thread executing all tasks from all priority queues. The thread priorities associated with a multithreaded execution system are assigned according to the queue that they service. There are therefore 5 available thread priority levels, one for each of the 5 priority level queues.
    In addition to the execution queues, there are additional queues that are associated with tasks suspended in various wait states. (I don't know whether there are also threads associated with these queues. It seems there is.)
    According to app. note 114, the default execution environment provides 1 execution system with 1 thread having a priority level of 1, and 5 execution systems with 10 prioritized threads, 2 threads per priority queue. NI has titled the single threaded execution system "user interface" and also given names to the other 5. Here they will be called either "user interface" or "other".
    The "user interface" system is responsible for all GUI actions. It monitors the keyboard and mouse, as well as drawing the controls. It is also used to execute non-thread-safe tasks; tasks whose shared objects are not thread mutex protected.
    Vis are composed of a front panel and diagram. The front panel provides an interface between the vi diagram, the user, and the calling vi. The diagram provides programmatic data flow between various nodes and is compiled into one or more machine coded tasks. In addition to it own tasks, a diagram may also call other vis. A vi that calls another vi does not actually programmatically branch to that vi. Rather, in most cases the call to another vi posts the tasks associated with the subvi to the back of one of the labVIEW execution system�s queues.
    If a vi is non-reentrant, its tasks cannot run simultaneously on multiple threads. This implies a mutex like construction around the vi call to insure only one execution system is executing the vi. It doesn�t really matter where or how this happens, but somehow labVIEW has to protect an asynchronous vi from simultaneous execution, somehow that has to be performed without blocking an execution queue, and somehow a mutex suspended vi has to be returned to the execution queue when the mutex is freed. I assume this to be a strictly labVIEW mutex and does not involve the OS. If a vi is reentrant, it can be posted/ran multiple times simultaneously. If a vi is a subroutine, its task (I think there is always only one) will be posted to the front of the caller's queue rather than at the back of the queue (It actually probably never gets posted but is simply mutex tested at the call.) A reentrant-subroutine vi may be directly linked to its caller since it has no restrictions. (Whether in fact labVIEW does this, I don�t know. In any event, it would seem in general vis that can be identified as reentrant should be specified as such to avoid the overhead of mutexing. This would include vis that wrap reentrant dll calls.)
    The execution queue to which a vi's tasks are posted depends upon the vi execution settings and the caller's execution priority. If the caller's execution priority is less than or equal the callee's execution settings, then the callee's tasks are posted to the back of the callee's specified execution queue. If the caller's execution priority is greater than the callee's specifications, then the callee's tasks are posted to the back of the caller's queue. Under most conditions, the vi execution setting is set to "same as caller" in which case the callee�s tasks are always posted to the back of the caller's execution queue. This applies to cases where two vis are set to run either in the other execution systems or two vis are set to run in the user interface execution system. (It�s not clear what happens when one vi is in the �user interface� system and the other is not. If the rule is followed by thread priority, any background tasks in the �other� systems will be moved to the user interface system. Normal task in the �other� systems called by a vi in the �user interface� system will execute in their own systems and vice versa. And �user interface� vis will execute in the caller�s �other� system if the caller has a priority greater than normal.)
    Additionally, certain nodes must execute in the "user interface" execution system because their operations are not thread-safe. While the above generally specifies where a task will begin and end execution, a non-thread safe node can move a task to the �user interface� system. The task will continue to execute there until some unspecified event moves it back to its original execution system. Note, other task associated to the vi will be unaffected and will continue to execute in the original system.
    Normally, tasks associated with a diagram run in one of the �other� execution systems. The tasks associated with drawing the front panel and monitoring user input always execute in the user interface execution system. Changes made by a diagram to it own front panel are buffered (the diagram has its own copy of the data, the front panel has its own copy of the data, and there seems to be some kind of exchange buffer that is mutexed), and the front panel update is posted as a task to the user interface execution system. Front panel objects also have the advanced option of being updated sequentially; presumably this means the diagram task that modifies the front panel will be moved to the user interface execution system as well. What this does to the data exchanged configuration between the front panel and diagram is unclear as presumably both the front panel and diagram are executing in the same thread and the mutex and buffer would seem to be redundant. While the above is true for a control value it is not clear whether this is also true for the control properties. Since a referenced property node can only occur on the local diagram, it is not clear it forces the local diagram to execute in the user interface system or whether they too are buffered and mutexed with the front panel.
    If I were to hazard a guess, I would say that only the control values are buffered and mutexed. The control properties belong exclusively to the front panel and any changes made to them require execution in the �user interface� system. If diagram merely reads them, it probably doesn�t suffer a context switch.
    Other vis can also modify the data structure defining the control appearance and values remotely using un-reference property nodes. These nodes are required to run in the user interface system because the operation is not thread-safe and apparently the diagram-front-panel mutex is specifically between the user interface execution system and the local diagram thread. Relative to the local diagram, remote changes by other vis would appear to be user entries.
    It is not clear how front panels work with reentrant vis. Apparently every instance gets its own copy of the front panel values. If all front panel data structures were unique to an instance, and if I could get a vi reference to an instance of a reentrant vi, I could open multiple front panels, each displaying its own unique data. It might be handy, sort of like opening multiple Word documents, but I don�t think that it�s available.
    A note: It is said that the front panel data is not loaded unless the front panel is opened. Obviously the attributes required to draw an object are not required, nor the buffer that interfaces with the user. This rule doesn�t apply though that if property references are made to front panel objects, and/or local variables are used. In those cases at least part of the front panel data has to be present. Furthermore, since all data is available via a control reference, if used, the control�s entire data structure must be present.
    I use the vi server but haven�t really explored it yet, nor vi reference nodes, but obviously they too make modifications to unique data structures and hence are not thread-safe. And in general, any node that accesses a shared object is required to run in the user interface thread to protect the data associated with the object. LabVIEW, does not generally create OS level thread mutexes to protect objects probably because it becomes to cumbersome... Only a guess...
    Considering the extra overhead of dealing with preemptive threading, I�m wondering if my well-tuned single threaded application in LV4.1 won�t out perform my well-tuned multithreaded application in LV6.0, given a single processor environment�
    Please modify those parts that require it.
    Thanks�
    Kind Regards,
    Eric

    Ben,
    There are two types of memory which would be of concern. There is temporary and persistent. Generally, if a reentrant vi has persistent memory requirements, then it is being used specifically to retain those values at every instance. More generally, reentrant code requires no persistent memory. It is passed all the information it needs to perform its function, and nothing is retained. For this type of reentrant vi, memory concern to which you refer could become important if the vis are using several MBytes of temporary storage for intermediate results. In that case, as you could have several copies executing at once, your temporary storage requirements have multiplied by the number of simultaneous copies executing. Your max memory use is going to rise, and as labview allocates memory rather independently and freely, the memory use of making them reentrant might be a bit of a surprise.
    On the other hand, the whole idea of preemtive threading is to give those tasks which require execution in a timely fashion the ability to do so regardless of what other tasks might be doing. We are, after all, suffering the computational overhead of multithreading to accomplish this. If memory requirements are going to defeat the original objective, then we really are traversing a circle.
    Anyway, as Greg has advised, threads are supposed to be used judiciously. It isn't as though your going to have all 51 threads up at the same time. In general I think, overall coding stategy should be to minimize the number of threads while protecting those tasks that absolutely require timely execution.
    In that sense, it would have been nice if NI had retained two single threaded systems, one for the GUI and one for the GUI interface diagrams. I've noticed that control drawing is somewhat slower under LV6.0 than LV4.1. I cannot, for example, make a spreadsheet scroll smoothly anymore, even using buffered graphics. This makes me wonder how many of my open front panel diagrams are actually running on the GUI thread.
    And, I wonder if threads go to sleep when not in use, for example, on a wait, or wait multiple node. My high priority thread doesn't do a lot of work, but the work that it does is critical. I don't know what it's doing the rest of the time. From some of Greg's comments, my impression is it in some kind of idle mode: waking up and sleeping, waking up and sleeping,..., waking up, doing something and sleeping... etc. I suppose I should try to test this.
    Anyway that's all an aside...
    With regard to memory, your right, there are no free lunches... Thanks for reminding me. If I try this, I might be dismayed by the additional memory use, but I won't be shocked.
    Kind Regards,
    Eric

  • Exception in execution of web service (Adaptative web service model)

    Hi,
    I have a WSDL which is working fine in WS Navigator, but if I import it as model in WD JAVA and apply the template on component controller to read the service and execute the method wdDoInit, I am getting a run time error.
    the error occurs on the method wdDoInit, in the following line of code
    Modelwsres modelwsresModel = new Modelwsres();
    <h6>public void wdDoInit()
        //@@begin wdDoInit()
        //$$begin Service Controller6(825011426)
        Modelwsres modelwsresModel = new Modelwsres();
        Request_ObtenerEntidades request_ObtenerEntidades = new Request_ObtenerEntidades(modelwsresModel);
        wdContext.nodeRequest_ObtenerEntidades().bind(request_ObtenerEntidades);
        //$$end
       //@@end
      }</h6>
    Enviroment:
    SAP Netweaver CE 7.1 EHP1
    SAP Enhancement Package 1 for SAP NetWeaver Developer Studio 7.1 SP04 PAT0000
    Windows 2003 Server
    Error that I am getting is as follows
    <h6> java.lang.NoSuchMethodError: com.sap.tc.webdynpro.model.webservice.gci.WSTypedModel.(Ljava/lang/String;Ljava/lang/String;Ljavax/xml/namespace/QName;Ljava/lang/String;Ljava/util/Map;Ljava/lang/String;Lcom/sap/tc/webdynpro/model/webservice/gci/IWSTypedModelInfo;Ljava/util/Map;Ljava/util/Map;)V
    java.lang.NoSuchMethodError: com.sap.tc.webdynpro.model.webservice.gci.WSTypedModel.<init>(Ljava/lang/String;Ljava/lang/String;Ljavax/xml/namespace/QName;Ljava/lang/String;Ljava/util/Map;Ljava/lang/String;Lcom/sap/tc/webdynpro/model/webservice/gci/IWSTypedModelInfo;Ljava/util/Map;Ljava/util/Map;)V
      at com.ayesa.app.pruebadirpers.modelwsres.Modelwsres.<init>(Modelwsres.java:466)
      at com.ayesa.app.pruebadirpers.dpapp.comp.ModelwsController.wdDoInit(ModelwsController.java:123)
      at com.ayesa.app.pruebadirpers.dpapp.comp.wdp.InternalModelwsController.wdDoInit(InternalModelwsController.java:300)
      at com.sap.tc.webdynpro.progmodel.generation.DelegatingCustomController.doInit(DelegatingCustomController.java:48)
      at com.sap.tc.webdynpro.progmodel.controller.Controller.initController(Controller.java:227)
      at com.sap.tc.webdynpro.progmodel.controller.Controller.init(Controller.java:206)
      at com.sap.tc.webdynpro.progmodel.components.Component.getCustomControllerInternal(Component.java:663)
      at com.sap.tc.webdynpro.progmodel.components.Component.getMappableContext(Component.java:629)
      at com.sap.tc.webdynpro.progmodel.context.MappingInfo.getDataNode(MappingInfo.java:134)
      at com.sap.tc.webdynpro.progmodel.context.MappingInfo.init(MappingInfo.java:171)
      at com.sap.tc.webdynpro.progmodel.context.MappedNodeInfo.doInit(MappedNodeInfo.java:193)
      at com.sap.tc.webdynpro.progmodel.context.NodeInfo.init(NodeInfo.java:968)
      at com.sap.tc.webdynpro.progmodel.context.NodeInfo.init(NodeInfo.java:972)
      at com.sap.tc.webdynpro.progmodel.context.Context.init(Context.java:69)
      at com.sap.tc.webdynpro.progmodel.controller.Controller.init(Controller.java:205)
      at com.sap.tc.webdynpro.progmodel.window.ViewManager.getView(ViewManager.java:667)
      at com.sap.tc.webdynpro.progmodel.window.ViewManager.bindRoot(ViewManager.java:562)
      at com.sap.tc.webdynpro.progmodel.window.ViewManager.init(ViewManager.java:182)
      at com.sap.tc.webdynpro.progmodel.window.InterfaceView.manageEmbeddedViewManager(InterfaceView.java:141)
      at com.sap.tc.webdynpro.progmodel.window.InterfaceView.initController(InterfaceView.java:55)
      at com.sap.tc.webdynpro.progmodel.controller.Controller.init(Controller.java:206)
      at com.sap.tc.webdynpro.clientserver.window.WebDynproWindow.doOpen(WebDynproWindow.java:364)
      at com.sap.tc.webdynpro.clientserver.window.ApplicationWindow.show(ApplicationWindow.java:183)
      at com.sap.tc.webdynpro.clientserver.window.ApplicationWindow.open(ApplicationWindow.java:178)
      at com.sap.tc.webdynpro.clientserver.cal.ClientApplication.init(ClientApplication.java:557)
      at com.sap.tc.webdynpro.clientserver.cal.ClientApplication.doPreprocessing(ClientApplication.java:1338)
      at com.sap.tc.webdynpro.serverimpl.core.sessionctx.AbstractExecutionContextDispatcher.delegateToApplicationDoPreprocessing(AbstractExecutionContextDispatcher.java:146)
      at com.sap.tc.webdynpro.serverimpl.wdc.sessionctx.DispatchHandlerForAppPreprocessing.doService(DispatchHandlerForAppPreprocessing.java:35)
      at com.sap.tc.webdynpro.serverimpl.wdc.sessionctx.AbstractDispatchHandler.service(AbstractDispatchHandler.java:127)
      at com.sap.engine.services.servlets_jsp.server.deploy.impl.module.IRequestDispatcherImpl.dispatch(IRequestDispatcherImpl.java:95)
      at com.sap.tc.webdynpro.serverimpl.wdc.sessionctx.ExecutionContextDispatcher.dispatchToApplicationDoPreprocessing(ExecutionContextDispatcher.java:100)
      at com.sap.tc.webdynpro.serverimpl.core.sessionctx.AbstractExecutionContextDispatcher.dispatch(AbstractExecutionContextDispatcher.java:74)
      at com.sap.tc.webdynpro.clientserver.session.ApplicationSession.dispatch(ApplicationSession.java:571)
      at com.sap.tc.webdynpro.clientserver.session.ApplicationSession.dispatch(ApplicationSession.java:602)
      at com.sap.tc.webdynpro.clientserver.session.ApplicationSession.doPreprocessing(ApplicationSession.java:252)
      at com.sap.tc.webdynpro.clientserver.session.ClientSession.doPreprocessing(ClientSession.java:677)
      at com.sap.tc.webdynpro.clientserver.session.ClientSession.doProcessing(ClientSession.java:239)
      at com.sap.tc.webdynpro.clientserver.session.RequestManager.doProcessing(RequestManager.java:258)
      at com.sap.tc.webdynpro.serverimpl.core.sessionctx.AbstractExecutionContextDispatcher.delegateToRequestManager(AbstractExecutionContextDispatcher.java:202)
      at com.sap.tc.webdynpro.serverimpl.wdc.sessionctx.DispatchHandlerForRequestManager.doService(DispatchHandlerForRequestManager.java:38)
      at com.sap.tc.webdynpro.serverimpl.wdc.sessionctx.AbstractDispatchHandler.service(AbstractDispatchHandler.java:127)
      at com.sap.engine.services.servlets_jsp.server.deploy.impl.module.IRequestDispatcherImpl.dispatch(IRequestDispatcherImpl.java:95)
      at com.sap.tc.webdynpro.serverimpl.wdc.sessionctx.ExecutionContextDispatcher.dispatchToRequestManager(ExecutionContextDispatcher.java:140)
      at com.sap.tc.webdynpro.serverimpl.core.sessionctx.AbstractExecutionContextDispatcher.dispatch(AbstractExecutionContextDispatcher.java:92)
      at com.sap.tc.webdynpro.serverimpl.core.sessionctx.AbstractExecutionContextDispatcher.dispatch(AbstractExecutionContextDispatcher.java:104)
      at com.sap.tc.webdynpro.serverimpl.core.AbstractDispatcherServlet.doContent(AbstractDispatcherServlet.java:87)
      at com.sap.tc.webdynpro.serverimpl.core.AbstractDispatcherServlet.doGet(AbstractDispatcherServlet.java:54)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:707)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
      at com.sap.engine.services.servlets_jsp.server.Invokable.invoke(Invokable.java:140)
      at com.sap.engine.services.servlets_jsp.server.Invokable.invoke(Invokable.java:37)
      at com.sap.engine.services.servlets_jsp.server.HttpHandlerImpl.runServlet(HttpHandlerImpl.java:466)
      at com.sap.engine.services.servlets_jsp.server.HttpHandlerImpl.handleRequest(HttpHandlerImpl.java:291)
      at com.sap.engine.services.httpserver.server.RequestAnalizer.startServlet(RequestAnalizer.java:396)
      at com.sap.engine.services.httpserver.server.RequestAnalizer.startServlet(RequestAnalizer.java:385)
      at com.sap.engine.services.servlets_jsp.filters.DSRWebContainerFilter.process(DSRWebContainerFilter.java:48)
      at com.sap.engine.services.httpserver.chain.AbstractChain.process(AbstractChain.java:78)
      at com.sap.engine.services.servlets_jsp.filters.ServletSelector.process(ServletSelector.java:76)
      at com.sap.engine.services.httpserver.chain.AbstractChain.process(AbstractChain.java:78)
      at com.sap.engine.services.servlets_jsp.filters.ApplicationSelector.process(ApplicationSelector.java:240)
      at com.sap.engine.services.httpserver.chain.AbstractChain.process(AbstractChain.java:78)
      at com.sap.engine.services.httpserver.filters.WebContainerInvoker.process(WebContainerInvoker.java:78)
      at com.sap.engine.services.httpserver.chain.HostFilter.process(HostFilter.java:9)
      at com.sap.engine.services.httpserver.chain.AbstractChain.process(AbstractChain.java:78)
      at com.sap.engine.services.httpserver.filters.ResponseLogWriter.process(ResponseLogWriter.java:60)
      at com.sap.engine.services.httpserver.chain.HostFilter.process(HostFilter.java:9)
      at com.sap.engine.services.httpserver.chain.AbstractChain.process(AbstractChain.java:78)
      at com.sap.engine.services.httpserver.filters.DefineHostFilter.process(DefineHostFilter.java:27)
      at com.sap.engine.services.httpserver.chain.ServerFilter.process(ServerFilter.java:12)
      at com.sap.engine.services.httpserver.chain.AbstractChain.process(AbstractChain.java:78)
      at com.sap.engine.services.httpserver.filters.MonitoringFilter.process(MonitoringFilter.java:29)
      at com.sap.engine.services.httpserver.chain.ServerFilter.process(ServerFilter.java:12)
      at com.sap.engine.services.httpserver.chain.AbstractChain.process(AbstractChain.java:78)
      at com.sap.engine.services.httpserver.filters.MemoryStatisticFilter.process(MemoryStatisticFilter.java:43)
      at com.sap.engine.services.httpserver.chain.ServerFilter.process(ServerFilter.java:12)
      at com.sap.engine.services.httpserver.chain.AbstractChain.process(AbstractChain.java:78)
      at com.sap.engine.services.httpserver.filters.DSRHttpFilter.process(DSRHttpFilter.java:42)
      at com.sap.engine.services.httpserver.chain.ServerFilter.process(ServerFilter.java:12)
      at com.sap.engine.services.httpserver.chain.AbstractChain.process(AbstractChain.java:78)
      at com.sap.engine.services.httpserver.server.Processor.chainedRequest(Processor.java:425)
      at com.sap.engine.services.httpserver.server.Processor$FCAProcessorThread.process(Processor.java:250)
      at com.sap.engine.services.httpserver.server.rcm.RequestProcessorThread.run(RequestProcessorThread.java:45)
      at com.sap.engine.core.thread.execution.Executable.run(Executable.java:109)
      at com.sap.engine.core.thread.execution.CentralExecutor$SingleThread.run(CentralExecutor.java:314)</h6>
    Please suggest some solution.
    Regards

    Hi,
    I had not written all the code because they considered it important:
    public void wdDoInit()
        //@@begin wdDoInit()
        //$$begin Service Controller6(825011426)
         Modelwsres modelwsresModel = new Modelwsres();
        Request_ObtenerEntidades request_ObtenerEntidades = new Request_ObtenerEntidades(modelwsresModel);
        ObtenerEntidades obtenerEntidades = new ObtenerEntidades(modelwsresModel);
        request_ObtenerEntidades.setObtenerEntidades(obtenerEntidades);
        Response_ObtenerEntidades response_2 = new Response_ObtenerEntidades(modelwsresModel);
        request_ObtenerEntidades.setResponse(response_2);
        ObtenerEntidadesResponse obtenerEntidadesResponse = new ObtenerEntidadesResponse(modelwsresModel);
        response_2.setObtenerEntidadesResponse(obtenerEntidadesResponse);
        java.util.List<Entidad> return_2 = new ArrayList<Entidad>();
        obtenerEntidadesResponse.setReturn(return_2);
        wdContext.nodeRequest_ObtenerEntidades().bind(request_ObtenerEntidades);
      //$$end
    //@@end
    but the error occurs on the first line of method:
    Modelwsres modelwsresModel = new Modelwsres();
    Thanks.
    Regards

  • Multi-Thread application and common data

    I try to make a multi-Thread application. All the Threads will update some common data.
    How could I access the variable �VALUE� with the Thread in the following code:
    public class Demo {
    private static long VALUE;
    public Demo(long SvId) {
    VALUE = 0;
    public static class makeThread extends Thread {
    public void run() {
    VALUE++;
    public static long getVALUE() {
    return VALUE;
    The goal is to get the �VALUE� updated by the Thread with �getVALUE()�
    Thanks for your reply
    Benoit

    That code is so wrong in so many ways......
    I know you're just experimenting here, learning what can and can't be done with Threads, but bad habits start early, and get harder to kick as time goes on. I am going to give a little explanation here about what's wrong, and what's right.. If you're going to do anything serious though, please, read some books, and don't pick up bad habits.
    Alright, The "answer" code. You don't use Thread.sleep() to wait for Threads to finish. That's just silly, use the join() method. It blocks until the threads execution is done. So if you have a whole bunch of threads in an array, and you want to start them up, and then do something once they finish. Do this.
    for(int k=0; k<threads.length; k++) {
      threads[k].start();
    for(int k=0; k<threads.length; k++) {
      threads[k].join();
    System.out.println("All Threads Done");Now that's the simple problem. No tears there.
    On to the java memory model. Here where the eye water starts flowing. The program you have written is not guarenteed to do what you expect it to do, that is, increment VALUE some amount of time and then print it out. The program is not "Thread Safe".
    Problem 1) - Atomic Operations and Synchronization
    Incrementing a 'long' is not an atomic operation via the JVM spec, icrementing an int is, so if you change the type of VALUE to an int you don't have to worry about corruption here. If a long is required, or any method with more then one operation that must complete without another thread entering. Then you must learn how to use the synchronized keyword.
    Problem 2) - Visiblity
    To get at this problem you have to understand low level computing terms. The variable VALUE will NOT be written out to main memory every time you increment it. It will be stored in the CPUs cache. If you have more then one CPU, and different CPUs get those threads you are starting up, one CPU won't know what the other is doing. You get memory overwrites, and nothing you expect. If you solve problem 1 by using a synchronized block, you also solve problem 2, because updating a variable under a lock will cause full visiblity of the change. However, there is another keyword in java.. "volatile".. A field modified with this keyword will always have it's changes visible.
    This is a very short explaination, barely scratching the surface. I won't even go into performance issues here. If you want to know more. Here's the resources.
    Doug Lea's book
    http://java.sun.com/docs/books/cp/
    Doug Lea's Site
    http://g.cs.oswego.edu
    -Spinoza

  • Thread problem.. help

    I have a thread execution of my program which reading a text file and in the same time giving the priority to the GUI.
    My problem is, if I comment the:
          m_Support.firePropertyChange("", null, null);in the method "setWorkingInstances", my GUI will display the content of the file, otherwise if it's uncomment, my GUI is processing something, and never displays the output but busy. Can anybody help me to solve this problem? I'm headache of this..
    m_Support is the object that tells another class that the owner of the m_Support propertychange has been invoked (i hope i'm rite).
    public void setBaseInstancesFromFile(final File f) {
        if (m_IOThread == null) {
          m_IOThread = new Thread() {
            public void run() {
              try {
                Reader r = new BufferedReader(new FileReader(f));
                // call the function
                setBaseInstances(new Instances(r));
                r.close();
              catch (Exception ex) {
                //..bla..
              m_IOThread = null;
          m_IOThread.setPriority(Thread.MIN_PRIORITY); // GUI has most priority
          m_IOThread.start();
        } else {
          //..bla..bla..
    public void setBaseInstances(Instances inst) {
        m_BaseInstances = inst;
        try {
          Runnable r = new Runnable() {
            public void run() {
              ... bla.. bla..
              // call again another function
              setWorkingInstances(m_BaseInstances);
          if (SwingUtilities.isEventDispatchThread()) {
            r.run();
          } else {
            SwingUtilities.invokeAndWait(r);
        } catch (Exception ex) {
           ..bla.. bla..     
    public void setWorkingInstances(Instances inst) {
        if (m_WorkingInstances != inst) {
          m_WorkingInstances = inst;
          ... bla.. bla.. bla..     
          // Fire a propertychange event
          m_Support.firePropertyChange("", null, null);
      }

    This seems kind of a strange way of doing things... but maybe I misunderstand what you are trying to do.
    Here's what I think you are trying to do:
    Read a file in a worker thread
    While the worker thread is running, send update notifications to GUI objects in the Swing GUI thread.
    Is that correct?
    If so, then all you have to do is start the worker thread from the Swing GUI thread, then have the worker thread send periodic notifications to the GUI object - let's say in a method called textContentsChanged().
    In textContentsChanged, you would then wrap up the notification into a simple Runnable object, and pass it in to invokeAndWait().
    Is that what you are trying to do??
    - K

  • Problem Getting Thread to Stop

    Hello,
    I am simulating a race. When the winner has been determined, I need to stop the other threads since the race is over. Here is the code that I have with regards to stopping the threads:
    public void simulateTravelTime() {
    try {
    Thread.sleep((int)(Math.random() * distance * 10));
    //Terminate thread execution if the thread is interrupted.
    catch (InterruptedException e) {
    requestStop();
    public void requestStop() {
    stopThread = true;
    public void run() {
    while (!stopThread && (waterInBucket < fullBucket)) {
    //Code to simulate the race and determine if there is a winner.
    //If there's a winner, stop all threads.
    if (winner == true) {
    int n = group.activeCount();
    Thread[] activeThreads = new Thread[n];
    group.enumerate(activeThreads);
    for(int i=0; i<n; i++)
    activeThreads.requestStop();
    //Interrupt the other threads in case they're sleeping.
    group.interrupt();
    It doesn't like the activeThreads[i].requestStop(); line. Anyone know how to alter my code to fix the problem?
    Thx.

    Ahh, I see. Didn't notice that before.
    Okay, I gotta run, but off the top of my head, I think one of the following should work. I prefer the first:
    * When you create the threads, give each one a name that matches it up to your class. Your clas needs to have a name field to match on, or else a separate map maps the name to the Runnable (your class).
    OR
    * Have your class extend Thread.

Maybe you are looking for

  • Oracle 10g Installation Problem on SUSE Linux 10

    Hello Friends, I want to install SAP Solution Manager 7.0 with Oracle 10g on SUSE Linux 10.0. But, while starting the Installation i am getting following Errors. Starting Oracle Universal Installer... Checking installer requirements... Checking opera

  • Focusrite USB 2.0 Audio Driver Scarlett 2i2 in Premiere CC2014 not working

    Hi everybody. I just recently upgraded to CC and cannot use my Audio Interface with it. Info: i7 Windows 7 Ultimate Focusrite Scarlett 2i2, drivers up to date Premiere Pro CC 2014 up do date GeForce GTX Titan In CS6 i have set the audio hardware to F

  • Cannot get Message_ID in process

    Hi all In the process I create a Transformation to get the message_id with the code: <b> java.util.Map map = container.getTransformationParameters(); String msgid = (String) map.get ( StreamTransformationConstants.MESSAGE_ID); return msgid; </b> the

  • Linux Migration 11.5.10.2

    We are planing moving our 11.5.10 with 10g RAC from Solaris to Linux, and I would like to hear from anyone who's done it already this kind of OS-OS migration, or knows of any good white papers which discuss it. I have gone through my Threads in this

  • Add PA_NON_LABOR_RESOURCES.DESCRIPTION in Invoice Report

    I need to modify the Invoice Report by adding the PA_NON_LABOR_RESOURCES.DESCRIPTION for each line in the invoice (q_lines query). I'm not sure how to tie a record in ra_customer_trx_lines back to pa_expenditure_items (also ensuring a one-to-one mapp