Thread Concurrency problem

Hello
i have an application where i have about 6 threads....I have each of this thread working independently ..i.e each thread has its publis static main method.....they are continuously running..... and they are working correctly.... but the problem is that i have run each thread explicitly....
But now i want to combine all these threads into one thread so that when i run my java application all these threads will start running.....I tried doing it but the problem is that the first thread itself runs...the other threads do not run...... how do i do this????
The code of the program where i clubbed the threads is
public class MainThread
public static void main(String arg[])
NewThread n= new NewThread() ;
System.out.println("in psvm") ;
class NewThread extends Thread
String name; // name of thread
Thread t;
NewThread()
System.out.println("in newthread") ;
SMSSendThread sms=new SMSSendThread() ;
UsernameThread user=new UsernameThread() ;
user.start() ;
SendInbox inbox=new SendInbox() ;
inbox.start() ;
DeleteSMS delete=new DeleteSMS() ;
delete.start();
My start method of each of these thread contains ie.deleteSMS,SendInbox
public void start()
HashSet<Socket> clients = new HashSet<Socket>() ;
try
Boolean listening=true ;
ServerSocket ss=new ServerSocket(2345) ;
Socket socket=new Socket() ;
int id=0;
while(listening)
System.out.println("Detecting Client please Wait in send thread:=") ;
socket = ss.accept();
clients.add(socket);
System.out.println("clients display:="+clients) ;
if(clients.contains(socket))
InetAddress clientIP=socket.getInetAddress() ;
System.out.println("the ip addrss of the client:="+clientIP) ;
new ConnectionHandlerdelete(socket).start() ;
The problem is that only the Username thread exceutes priopely the other two are not running!!!!

Then why are the other threads not runningIf that is your code you are mistaken about this.
> the newthread class runs as it is supposed to
The newthread class constructor runs as it is supposed to , and it starts the other threads. You never call start on it so it never executes its run() method. It doesn't even appear to have a run() method.
So either this is not your real code or your observations are mistaken.

Similar Messages

  • Thread concurrency problem - how to know when thread is dead?

    My applet uses a thread to draw an iteration graph step by step.
    The user as the option of pressing two buttons:
    - PLAY button - iteration Points are stored in an arrayList and drawn step by step (a sleeping time follows each step) (drawIterations thread)
    - TO_END button - iteration Points are all stored in the arrayList (swingworker thread) and after all of them have been stored the graph is drawn instantly.
    I have problems in this situation:
    When executing the PLAY-button thread, if the user presses TO_END button, the remaining graph lines should draw instantly. Sometimes I get more points on the graph than I should. It seems that the PLAY thread, which I stop when TO_END buton is pressed, still remains storing new points into the arrayList concurrently to the new thread created after TO_END button was pressed .
    Any ideas?
    I'm already using synchronization.
    private volatile Thread drawIterations;
    public void playButtonClick(JToggleButton btn) {
         pointSet1 = new ArrayList<Point2D.Double>();
         if (drawIterations == null) drawIterations = new Thread(this,   "drawIterations");
         drawIterations.start();
    public void toEndButtonClick(JToggleButton btn) {
         stopThread() ;
         pointSet1 = new ArrayList<Point2D.Double>();
         computeIterationGraphPointsAndRefreshGraph();
    public synchronized void stopThread() {
         drawIterations = null;
         notify();
    private void computeIterationGraphPointsAndRefreshGraphs() {
         SwingWorker worker = new SwingWorker() {
              public Object construct() {
                   // compute all iteration points
                         //repaint graph
         worker.start();
    }Is there a way of testing if a thread is actually dead after setting the thread object to null??

    In general, a Thread keeps running until it's run
    method completes. Threads don't stop when their
    handle is set to null. Your run method should
    constantly be checking on a variable to know when to
    stop running and exit the run method. In this case,
    you could check on the drawIterations variable to see
    if it's null.<br>
    <br>Even using the following line on my run method I get the the same problem:
    <br>
    <br>while (myThread == drawIterations && drawIterations!=null && halfStep < 2 * totalIterations) {
    <br>...
    <br>
    <br>Here's the whole method:
    <br>(actually there are 2 graphs being drawn and the second is only refreshed every 2 steps:)
    <br>
    <br>     <br>public void run() {
         <br>  Thread myThread = Thread.currentThread();
         <br>  int totalIterations = transientIterations +iterationsToDraw ;
              <br>  while (myThread == drawIterations && drawIterations!=null && halfStep < 2 * totalIterations) {
              <br>     computeNextHalfIterationGraphPoint( );
              <br>      if (!TRANSIENT_IS_ENABLED || halfStep >= 2*transientIterations ) {// is     not in transient calculations
              <br>                       graphArea1.repaint();
              <br>                       if (halfStep%2 ==0 ) graphArea2.repaint();
              <br>                       if (halfStep < 2*totalIterations){//no need to execute the following block if at last iteration point
                   <br>                         if (lastIterationPointsFallOutsideGraphArea(toEndCPButtonActive)) break;
                        <br>          try {
                             <br>                      Thread.sleep(sleepingTimeBetweenHalfIterationRendering);
                             <br>                      if (threadInterrupted ){//if clause included to avoid stepping into a synchronized block if unnecessary
                                  <br>                        synchronized (this) {
                                       <br>                          while (threadInterrupted && myThread==drawIterations ) wait();
                                                      <br>    }
    <br>                                               }
         <br>                                   } catch (InterruptedException e) {
              <br>                                     break;
                   <br>                         }     
                        <br>               }
    <br>                            }
         <br>        stopThread();
         <br>     }
    <br>

  • Concurrency Problem: Does it exist in following situation?

    Hi All
    Please consider the following problem:
    There are 100 systems connected through LAN. 99 systems have a tool in local drive that reads and writes certain files at 100th system.
    As the tool will work in local JVM, and each JVM will try to read & write the same file. is there any concurrency problem?
    OR
    i should ask how to solve this concurrency problem?
    Please provide your advice, suggestion or comments.
    --Azodious_                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

    It means it's not possible without having a server? please answer.
    one more thing, if i have a server and doesn't use J2EE at all, is there goin to be some problem? can this be imlements using core java only.
    All JVM interacts with one JVM at server. is it a good idea?
    --Azodious_                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

  • Session concurrency problems on using IFrame

    Hi All,
    I am working on internationalization , i've used session level for differnt languages . In a jsp page there is one IFrame
    when i opend jsp page for english, content of IFrame is also english
    But when i open arbic version simultaneously Content of IFrame are not arabic those are english.
    When i print the session ID inside IFrame then i found that sessionID are overlapped inside IFrame.
    But everything is working fine for outer jsp page.There is no concurrency problem.
    Note : I track this error while setting the page referesh time one second
    using meta tag.
    Please help me for this issue.If you need any code for that please tell me.
    Thanks & Regards
    Himanshu

    is the url of your iframe the same as your outer page?
    if your outer page is http://127.0.0.1 and the iframe is http://localhost, you will have 2 sessions

  • Concurrency problem

    Hi,
    If we have our logic of updating a balance in a table written in front end, there's possibility that 2 person may select and update at the same time.
    eg. balance is 100, and Mr.A wants to deduct 10, same as Mr. B.
    When Mr.A selects to read the balance then update, he reads 100, same as Mr. B.
    At the end, the balance will not be accurate.
    So, I am now shifting the logic for updating the balance to database triggers, will this solve the concurrency problems?
    Please advise.
    Thanks.

    Hi,
    Since I have my code written in trigger already, I don't really have the time to change it to select for update clause yet.
    What I need to know is if I put the following code in my trigger, will the database trigger take care of the concurrency issue?
    /* inside the trigger */
    select balance
    from mytable
    where mt_id = 100;
    update mytable
    set balance := balance - 10
    where mt_id = 100;
    Notice I don't have the for update clause in my trigger, is it ok? or the trigger will still face the concurrency problem only if I use for update even in trigger?
    Please advise.
    Thanks.

  • Need some design idea for a multi- thread  concurrent system

    I am totally new to this area. Hope ppl can give me some suggestion for the following project.
    The project is using socket to deal with huge concurrent data. Server will send me more than 50K (maybe more) XML strings in a short time.
    I need parse strings and save them in the data structure.
    What I have done is using ExecutorService to deal with this problem. Unfortunately, it's already too slow even I don't save data into data structure.(data structure will cause synchronization problem, and make system even worse).
    I was required to develop this software in a single machine and windows based OS.
    Should I only use single thread to do this project? or some other strategy?
    Can anybody give me some suggestion.
    Thanks so much.

    Peter. Thanks again.
    Could you help me to take a look at this code. Appreciate that.
    ThreadPool class:
    protected ExecutorService threadPool = Executors.newFixedThreadPool(5);
       incoming = new Socket("127.0.0.1", port1);
       outcoming = new Socket("127.0.0.1", port2);
       out = new PrintWriter(outcoming.getOutputStream(), true);
       isr = new InputStreamReader(incoming.getInputStream());
       is = new BufferedReader(isr);
    while (true) {
         String str;
         str = is.readLine();
         if (str == null) {
                 cleanup();
                 closeSocket();
                 printout();
            } else {        
                             this.threadPool.submit(new WorkerRunnable(str,          
                                                             "Thread Pooled Server"));
           }WorkerRunnable class:
    public void run() {
    try {
                SAXBuilder builder = new SAXBuilder();
                InputSource is = new InputSource( );
                is.setCharacterStream(new StringReader(xmlString));
                org.jdom.Document doc = builder.build(is);
                org.jdom.Element root = doc.getRootElement();
                org.jdom.Element order = root.getChild("Changes");
                List orderList = order.getChildren("OrderChange");
                if (orderList.size() != 0) {
                               org.jdom.Element orderchange = (org.jdom.Element) orderList.get(0);
                               String price = orderchange.getAttribute("orderPrice").getValue();
                               String quantity = bookchange.getAttribute("orderQuantity").getValue();
                               String symbol = bookchange.getAttribute("orderName").getValue();
                                } catch(Exception e)
                              {}

  • Stored Procedure Concurrency Problem 10g

    dear all,
    Please any one could help on this my problem is appreciated.......
    i'm generating ticket numbers using stored procedure as below .
    i need to know followings .....(i'm using oracle 10g)
    1 .Does oracle stored procedure handle concurrency by default or does db manage concurrency when we using sps or do we have handle concurrency inside a stored procedure?
    2.when i generating ticket no using this stored procedure is there any concurrency issue when 100 clients are access it concurrently???
    3. Is there issue or bug in my java code??????????
    4.I have already used select for update statement but when i used that in db rowlocks are hanging and db become stuck .........
    SELECT serial_no into newSerial FROM SERIAL_TAB WHERE BR_CODE=xbranch AND SCH_CODE = xscheme for update;
    5. and in my where clause i pass branch and scheme eg:SELECT serial_no into newSerial FROM SERIAL_TAB WHERE BR_CODE=xbranch AND SCH_CODE =
    xscheme;
    when i run this sp oracle return the error 'more than one row return by query'
    but when run query seperately it will return exactly one row for same brach code and scheme code no duplicates.
    why this happen and it also happen to update statement it will ignore branch code and update for all schemes
    UPDATE SERIAL_TAB SET serial_no=newSerial WHERE BR_CODE=xbranch AND SCH_CODE = xscheme;
    what should i do ? sorry for my long question since i'm in deep trouble.....................
    could any one can help please................................
    in my java code i use transaction and setAutoCommit(false) when calling this sp
    public String getTicketNo(String br,String sch){
    //getconnection
    //setAutoCommit(False);
    //call sp get return value ;
    //commit;
    //if error rollback transaction
    create or replace PROCEDURE sp_generate_ticket (
    xbranch in varchar,
    xscheme in varchar ,
    xresult OUT VARCHAR
    ) AS
    BEGIN
    newSerial:=0;
    SELECT serial_no into newSerial FROM SERIAL_TAB WHERE BR_CODE=xbranch AND SCH_CODE = xscheme;
    newSerial:=newSerial+1;
    UPDATE SERIAL_TAB SET serial_no=newSerial WHERE BR_CODE=xbranch AND SCH_CODE = xscheme;
    --- do other operations -------------------------------------------------------------------------------------
    END;
    Best Regards,
    Pradeep.
    Edited by: user8958520 on Jan 1, 2012 10:02 PM

    user8958520 wrote:
    i need to know followings .....(i'm using oracle 10g)
    1 .Does oracle stored procedure handle concurrency by default or does db manage concurrency when we using sps or do we have handle concurrency inside a stored procedure?Oracle is a multi-user and multi-process system. It supports concurrency. It also requires the developer to design and write "+thread safe+" code. Its concurrency cannot address and fix design flaws in application code.
    2.when i generating ticket no using this stored procedure is there any concurrency issue when 100 clients are access it concurrently???That depends entirely on WHAT that procedure code does. And whether that code is thread safe.
    4.I have already used select for update statement but when i used that in db rowlocks are hanging and db become stuck .........
    SELECT serial_no into newSerial FROM SERIAL_TAB WHERE BR_CODE=xbranch AND SCH_CODE = xscheme for update;Horrible and utterly flawed approach. This forces serialisation. This means if that procedure is call by a 100 clients, only a SINGLE client can be serviced at a time. ALL OTHERS need to queue and WAIT.
    Serialisation kills database performance.
    What you have is a serious design flaw. Not an Oracle issue. And there is no magic solution to make this flawed approach work in a performant and scalable manner. This flaw introduces artificial contention. This flaw enforces serialisation. This flaw means that your application code WILL step on its own toes time and time again.
    The proper solution is to fix this design flaw - and not use poorly conceived procedures such as sp_generate_ticket that violates fundamental concurrency principles.

  • SwingWorker JavaDB Concurrency problems

    I have an application that computes statistics from values stored in a JavaDB database. I am trying to implement batch job functionality that will allow users to quickly run multiple analyses without the point-and-click of the GUI. Each analysis extends SwingWorker, which adds text to a JTextArea when the done() method is called. My problem is that I get a "java.sql.SQLException: No suitable driver found for jdbc:derby:C:/mydatabase" SQL exception sometimes. the code below illustrates my problem. I'm guessing that this is a concurrency issue, but I don't know how to fix it. Any suggestion?
    The GUI class is:
    import java.awt.BorderLayout;
    import java.awt.Dimension;
    import java.awt.GridLayout;
    import javax.swing.JFrame;
    import javax.swing.JPanel;
    import javax.swing.JTextField;
    public class MyGui extends JFrame{
         private static final long serialVersionUID = 1L;
         JTextField text = null;
         JPanel main = null;
         String connectionString = "jdbc:derby:C:/mydatabase";
         String tableName="MYTABLE";
         String selectStatement = "SELECT * FROM " + tableName;
         public MyGui(){
              super("Concurrency Test");
              this.setPreferredSize(new Dimension(300,100));
              getContentPane().add(getPanel());
         public JPanel getPanel(){
              JPanel main = new JPanel();
              main.setLayout(new GridLayout(1,1));
              text = new JTextField(30);
              text.setText("Start");
              main.add(text, BorderLayout.CENTER);
              return main;
         public void readDatabase(){     
              int count=0;
              for(int i=0;i<10000;i++){
                   count++;
                   try{
                        ConnectAndRead reader =  new ConnectAndRead(connectionString, selectStatement, text, count);
                        reader.execute();
                   }catch(Exception ex){
         public static void main(String[] args) {
              MyGui gui = new MyGui();
              gui.pack();
              gui.setVisible(true);
              gui.setResizable(false);
              gui.readDatabase();
    }And the Database connection class is:
    import java.sql.Connection;
    import java.sql.DriverManager;
    import java.sql.ResultSet;
    import java.sql.SQLException;
    import java.sql.Statement;
    import javax.swing.JTextField;
    import javax.swing.SwingWorker;
    public class ConnectAndRead extends SwingWorker<String, Void>{
         String connectionString="";
         String selectStatement="";
         JTextField text=null;
         int count = 0;
         public ConnectAndRead(String connectionString, String selectStatement, JTextField text, int count){
              this.connectionString=connectionString;
              this.selectStatement=selectStatement;
              this.text=text;
              this.count=count;
         public String connectAndRead()throws SQLException{
              Connection conn = null;
              try{
                   conn = DriverManager.getConnection(connectionString);
                   Statement stmt=conn.createStatement(ResultSet.CONCUR_READ_ONLY, ResultSet.TYPE_SCROLL_INSENSITIVE);
                   ResultSet rs = stmt.executeQuery(selectStatement);
                   rs.close();
                   stmt.close();
                   conn.close();
                   String text = "Database access " + count + "(should be 10,000)";
                   return text;
              }catch(SQLException ex){
                   count--;
                   throw new SQLException(ex);
         protected String doInBackground() {
              String s = "";
              try{
                   s = connectAndRead();
              }catch(SQLException ex){
                   ex.printStackTrace();
              return s;
         @Override
         protected void done(){
              try{
                   text.setText(get());
              }catch(Exception ex){
                   ex.printStackTrace();
    }

    I believe I found the solution to my problem. It is posted here [http://forum.java.sun.com/thread.jspa?threadID=5298060&tstart=0] . Sorry for the cross posting.

  • Java Threads compilation problem

    Hi everyone,
    I've having problems getting a simple thread program to compile, the programs says " ; " expected when there is already one present. I've gone through the program many times and still can't put my finger on whats going wrong. If someone could take a quick look and if possible tell me where I am going wrong.
    Many Thanks
    Its class ThreadA that will not compile
    ***code********************************************
    public class ThreadA extends Thread
    private int id;
    public ThreadA(int i) (id = i);
    public void run()
    for (int i=0}; i < 10; i++);
    try {sleep(1000};)catch (InterruptedException e)();
    System.out.println("Output from Thread " + id);
    import java.io.*;
    public class TestThreads1
    public static void main (String args [] )
    Thread t1 = new ThreadA (1);
    Thread t2 = new ThreadA (2);
    Thread t3 = new ThreadA (3);
    t1.start();
    t2.start();
    t3.start();
    **code***********************************************************

    public class ThreadA extends Thread
    private int id;
    public ThreadA(int i) (id = i); // <-- problem
    public void run()
    for (int i=0}; i < 10; i++); // <-- two problems
    try {sleep(1000};)catch (InterruptedException e)(); // <-- more problems
    System.out.println("Output from Thread " + id);
    }

  • 64-bit JNI C++ to JAVA invocation multiple threads classloader problem

    Hi ALL,
    I have a C++ app that invokes Java classes on 64-bit Solaris 10 with 64-bit JVM.
    Here is the problem:
    The native non-main (not the thread that initializes the JVM) threads would not be able to find any user-define class.
    Here are the symptoms and observations:
    1. JNIEnv::ExceptionDescribe() showed the following StackOverflowError:
    Exception in thread "Thread-0" java.lang.StackOverflowError
            at java.util.Arrays.copyOf(Arrays.java:2734)
            at java.util.Vector.ensureCapacityHelper(Vector.java:226)
            at java.util.Vector.addElement(Vector.java:573)
            at java.lang.ClassLoader.addClass(ClassLoader.java:173)
            at java.lang.ClassLoader.defineClass1(Native Method)
            at java.lang.ClassLoader.defineClass(ClassLoader.java:621)
            at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:124)
            at java.net.URLClassLoader.defineClass(URLClassLoader.java:260)
            at java.net.URLClassLoader.access$000(URLClassLoader.java:56)
            at java.net.URLClassLoader$1.run(URLClassLoader.java:195)
            at java.security.AccessController.doPrivileged(Native Method)
            at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
            at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
            at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
            at java.lang.ClassLoader.loadClass(ClassLoader.java:252)
            at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:320)2. The "main thread" that instantiates the JVM has no problem finding and loading any class or method
    3. But the other threads (non-main threads) would not be able to find the user-defined classes unless the classes were already loaded by the main thread.
    4. The non-main threads can find the "standard" java classes with no problem
    5. The same app ran fine on 32-bit system.
    6. Except for the JVM reference is global, each thread acquired JNIEnv by either GetEnv() or AttachCurrentThread().
    Any idea why it is a problem with 64-bit?
    I have the sample program to reproduce this issue in this thread: http://forums.sun.com/thread.jspa?messageID=10885363&#10885363. That was the original thread I raised but I have narrowed it down to a more concrete scenario. That's why I am creating this new thread. I hope this does not break any rule on this forum. If it does, I apologize.
    I really appreciate it if anyone can provide any help/suggestion.
    Regards,
    - Triet

    Here is the sample program. Again, this works on 32-bit but not 64-bit.
    #include <string>
    #include "jni.h"
    #include "TestThread.h"
    static JavaVM *g_pjvm = NULL;  /* denotes a Java VM */
    static JNIEnv *g_penv = NULL;  /* pointer to native method interface */
    void initJVM(char** jvmOptions) {
        printf("RJniTest init starts...\n");
        JavaVMInitArgs vm_args; /* JDK/JRE 6 VM initialization arguments */
        JavaVMOption* poptions;
        int optionLen = 0;
        while (jvmOptions[optionLen]) {
            optionLen++;
        printf("RJniTest::init len=%d\n", optionLen);
        if (optionLen > 0) {
            printf("RJniWrapper::init jvmOptions\n");
            poptions = new JavaVMOption[optionLen];
            //poptions[0].optionString = "-Djava.class.path=/usr/lib/java";
            int idx = 0;
            while (jvmOptions[idx]) {
                poptions[idx].optionString = jvmOptions[idx];
                idx++;
        printf("RJniTest::init vm_args: version(%x), nOptions(%d)\n",
                JNI_VERSION_1_6, optionLen);
        vm_args.version = JNI_VERSION_1_6;
        vm_args.nOptions = optionLen;
        vm_args.options = poptions;
        vm_args.ignoreUnrecognized = JNI_FALSE;
        // load and initialize a Java VM, return a JNI interface
        // pointer in env
        printf("RJniTest::init creates JVM\n");
        JNI_CreateJavaVM(&g_pjvm, (void**)&g_penv, &vm_args);
        printf("RJniTest init ends\n");
    void findClass(const char* classname) {
        static const char* fname = "justFindClasses";
        printf("%s: findClass: %s\n", fname, classname);
        JNIEnv* jenv;
        jint ret = g_pjvm->GetEnv((void**)&jenv, JNI_VERSION_1_6);
        if (ret == JNI_EDETACHED) {
            ret = g_pjvm->AttachCurrentThread((void**)&jenv, NULL);
            if (ret != JNI_OK || jenv == NULL) {
                printf("%s: get env error: ret=%d\n", ret, fname);
            } else {
                printf("%s: got new env\n", fname);
        } else if (ret == JNI_OK) {
            printf("%s: env already there\n");
        jclass classref;
        classref = jenv->FindClass(classname);
        if (classref == NULL) {
            printf("%s: %s class not found!\n", fname, classname);
            if (jenv->ExceptionOccurred()) {
                jenv->ExceptionDescribe();
                jenv->ExceptionClear();
        printf("%s: found class: %s\n", fname, classname);
    class RJniTestThread : public TestThread {
    public:
        void threadmain();
    void RJniTestThread::threadmain() {
        printf("RJniTestThread::threadmain: Starting testing\n");
        findClass("org/apache/commons/logging/Log");
        findClass("java/util/List");
        printf("RJniTestThread::threadmain: done.\n");
    int main(int argc, char** argv) {
        char **jvmOptions = NULL;
        printf("RJniTestDriver starts...\n");
        if (argc > 1) {
            jvmOptions = new char*[argc];
            for (int i = 0; i < argc ; i ++) {
                jvmOptions[i] = argv[i + 1];
            jvmOptions[argc - 1] = NULL;
        } else {
            int size = 8;
            int i = 0;
            jvmOptions = new char*[size];
            jvmOptions[i++] = (char*) "-Djava.class.path=<list of jar files and path here>";
            jvmOptions[i++] = (char*) "-Djava.library.path=/sandbox/mxdev/3rdparty/java/unix/jdk1.6.0_14/jre/lib/sparc";
            jvmOptions[i++] = (char*) "-Djava.compiler=NONE";
            jvmOptions[i++] = (char*) "-verbose:jni";
            jvmOptions[i++] = (char*) "-Xcheck:jni";
            jvmOptions[i++] = NULL;
        printf("init JVM\n");
        initJVM(jvmOptions);
        // UNCOMMENT HERE
        // findClass("org/apache/commons/logging/Log");
        // findClass("java/util/List");
        // UNCOMMENT END
        printf("start test thread\n");
        RJniTestThread testThread;
        ThreadId tid = testThread.launch();
        printf("wait for test thread\n");
        int ret = pthread_join(tid, NULL);
        printf("RJniTestDriver ends\n");
    }

  • Regarding Receiver Communication Channel (Concurrency problem)

    Hi Masters ,
    In Receiver Communication Channel which is connected to oracle data base ..while updating records Status from N to C . i am getting following errors :
    **Message processing failed. Cause: com.sap.aii.af.ra.ms.api.RecoverableException: Channel has reached maximum concurrency (5,000 concurrent messages) and no free resource found within 5,000 milliseconds; increase the maximum concurrency level**
    Actually we are updating 10000 records status from N to C....... earlier it was updating in 30min now its hanging and giving above error ...... after 3 hrs its automatically displays updated succesfully message .
    Can you help me to understand wht exactly happening and at wht level i have to do settings in communication channel so tht it should work properly..
    Thanks in Advance.............
    Jagannath.

    Hi Jagannath
    you can specify the maximum concurrency for receiver adapters.  This defines the number of messages an adapter can process in parallel on a cluster node.
    Enter the number of messages to be processed in parallel by the receiver channel. For example, if you enter the value 2, then two messages are processed in parallel. Default value is 1 and this means only one message can be processed at a time by the receiver channel.
    http://help.sap.com/saphelp_nw70/helpdata/EN/64/ce4e886334ec4ea7c2712e11cc567c/frameset.htm
    http://help.sap.com/saphelp_nw70/helpdata/EN/bc/bb79d6061007419a081e58cbeaaf28/frameset.htm
    increase this parameter from 1000 to a higher value you required and you would not be facing such problem
    Regards
    sandeep
    If helpful kindly reward points

  • Error thread java : problem with the function "resume 0x***"  (forum sun)

    One problem with the function of jdb occured when I tried to use it to
    pilot the processor with differents threads. In fact, I use a simple example with 2 threads.
    I stop the two threads with two breakpoint, and I want to resume one or the other (with the function "resume 0x****"), the one wich I resumed stop again on the breackpoint and I decide again to resume one or the other. All of that to obtain a tree of execution.
    I give you the code of the class and the code of jdb.
    CLASS: (it's just a object Room with a variable degre that I increment and decrement with two threads increase and decrease)
    public class Test{
         public static void main(String[] args){
              Room r = new Room();
              decrease de = new decrease(r);
              increase in = new increase(r);
              de.start();
              in.start();
    class Room {
         private volatile int degre=20;
         public void more(){
         degre += 4;
         public void less(){      
         degre -= 3;
    class decrease extends Thread{
    private Room room;
    public decrease(Room r){
              room =r;
    public void run(){
    try{ 
         while (!interrupted()){ 
              room.less();
    catch(InterruptedException e) {}
    class increase extends Thread{
    private Room room;
    public increase(Room r){
         room =r;
    public void run(){ 
         try{ 
              while (!interrupted()){
                   room.more();
    catch(InterruptedException e) {}
    JDB:
    Initializing jdb ...
    stop at Test:7Deferring breakpoint Test:7.
    It will be set after the class is loaded.
    runrun Test
    Set uncaught java.lang.Throwable
    Set deferred uncaught java.lang.Throwable
    >
    VM Started: Set deferred breakpoint Test:7
    Breakpoint hit: "thread=main", Test.main(), line=7 bci=30
    7 in.start();
    main[1] stop at room:16
    Set breakpoint room:16
    main[1] stop at room:20
    Set breakpoint room:20
    main[1] resume
    All threads resumed.
    >
    Breakpoint hit: "thread=Thread-0", room.less(), line=20 bci=0
    20 degre -= 3;
    Thread-0[1] threads
    Group system:
    (java.lang.ref.Reference$ReferenceHandler)0x10d Reference Handler cond. waiting
    (java.lang.ref.Finalizer$FinalizerThread)0x10c Finalizer cond. waiting
    (java.lang.Thread)0x10b Signal Dispatcher running
    Group main:
    (decrease)0x146 Thread-0 running (at breakpoint)
    (increase)0x147 Thread-1 running (at breakpoint)
    (java.lang.Thread)0x148 DestroyJavaVM running
    Thread-0[1] resume 0x147
    Thread-0[1]
    Breakpoint hit: "thread=Thread-1", room.more(), line=16 bci=0
    16 degre += 4;
    Thread-1[1] resume 0x147
    Thread-1[1]
    Breakpoint hit: "thread=Thread-1", room.more(), line=16 bci=0
    16 degre += 4;
    Thread-1[1] print degre
    degre = 24
    Thread-1[1] resume 0x146 //It's here the problem, thread 0x146 have to stop on the //next breakpoint of decrease but nothing happen
    Thread-1[1] resume 0x147
    Thread-1[1]
    Breakpoint hit: "thread=Thread-1", room.more(), line=16 bci=0
    16 degre += 4;
    Thread-1[1] clear
    Breakpoints set:
    breakpoint Test:7
    breakpoint room:16
    breakpoint room:20
    PS: I tried many other examples with other class and other kind of breakpoints, but, in any cases, on thread doesn't manage to resume. When I try with general resume (no specification of the thread), It works but it isn't interresting for me because I want to decide wich thread continue his execution.

    Hi,
    I have read the FAQ of the JMF.
    The problem was the jar files of the JMF were not in the JRE\BIN\EXT
    folder of the Java runtime!
    now it works!
    thanks
    Reg

  • Killing a thread ( runnable ) - problem

    Hi,
    I already posted about this, and got a good answer.
    But, I still have a probalem :
    Here is a piece of my code :
    // this is the bean which is in the EPN and I want it to create a thread that prints something :
    public class EventListener implements StreamSink,com.bea.wlevs.ede.api.DisposableBean ,InitializingBean {
    // the relevant methods:
    RunnableTestBean runnableTestBean; // this is the thread which suppose to print ..
    public void destroy() throws Exception {
              System.out.println("destroydestroydestroydestroydestroydestroydestroy");
              runnableTestBean.suspend();
         public void afterPropertiesSet() throws Exception {
              runnableTestBean=new RunnableTestBean();
              runnableTestBean.run();
              //System.out.println("afterPropertiesSetafterPropertiesSetafterPropertiesSet");
    and the class RunnableTestBean :
    public class RunnableTestBean implements RunnableBean {
         boolean stopped=false;
         public void run() {
              while ( !stopped){
                   System.out.println(" printing...");
                   try {
                   wait(5000);
                        //Thread.sleep(1000);
                   } catch (InterruptedException e) {
                        System.out.println(" Stoping thread ??");
                        e.printStackTrace();
         public void suspend() throws Exception {
              stopped=true;
    The thing is that when I use the method as above :
    public void run() {
              while ( !stopped){
                   System.out.println(" printing...");
                   try {
                   wait(5000);
                        //Thread.sleep(1000);
                   } catch (InterruptedException e) {
                        System.out.println(" Stoping thread ??");
                        e.printStackTrace();
    When I undeploy the application , the destoy method ( in EventListener class ) is not called !
    but,
    if I implement the run "run" method like this :
    public void run() {
    System.out.println(" Something ");
    than everything is fine!
    The differrence as you can see , is that when I use an infinite loop - the destroy method never called ( seems that the caller waits for it to stop , and that's why the
    destroy method not called )
    When i don't use the infinaie loop- it's OK.
    So, any help ?
    Thanks ..

    Looking at the code that you have posted, the problem is that you are calling runnablebean.run() method in afterPropertiesSet (instead of starting a thread in which the run method is called). So, it looks like it will get stuck in afterPropertiesSet for ever.
    The recommended approach for what you are trying to do is to make the EventListener class implement RunnableBean (instead of having a separate class that implements RunnableBean that gets called from afterPropertiesSet). This means that at application startup time, this EventListener's run() method will be called by OCEP framework code in a separate thread. You can still use the suspend() method to stop the thread similar to how you are doing in your code now.

  • Thread pools problem

    How do we know that a given task(implementing Callable) in a thread pool (ThreadPoolExecutor) is completed ?
    I know that we can use the get( ) method of Future class... but for that the current thread has to wait until the Task given to the Thread pool completed.
    But I want to know ..Is it possible to get (asynchronus)notification from Thread pool when one of the submitted task finish.

    What about using the isDone() method of Future or even get(timeout, TimeUnit.SECONDS).
    http://java.sun.com/j2se/1.5.0/docs/api/java/util/concurrent/Future.html

  • Nokia 603 SMS thread view problem

    Hi All, My nokia 603 is unable to display the message in thread view. whenever the SMS is sent or recieved it will show some random integers. but if i enter to the folder view I am able to view the entire message. This is happening all of a sudden without any change done in the phone. Some one pls clarify whether it is the known issue, if so please gimme the solution. Thanks, Muralids

    Hi muralids,
    Thank you for your post. 
    We haven't confirmed if this is a known bug as it's not included in the list of Nokia 603 reported issues posted here: Firmware change logs for Symbian (S60) devices.
    However, you may try these troubleshooting steps to fix the problem:
    1. Check if the conversation view is still activated. Go to Menu, tap on Messaging, and then hit Options ( ≡ ). After that, choose View folders, hit Options ( ≡ ) again, and then select Message View. Set it to Conversations View.
    2. If the first option didn't work, try the steps provided in this link: Nokia 603 - Need help in fixing a problem?
    Hope this information helps. Cheers! 

Maybe you are looking for

  • Links breaking when converting from word docs to PDFs in Acrobat X Pro

    I have experienced this same problem when trying to convert word documents to PDFs in Preview: For hyperlinks that are active in MS Word (2011 version for Mac), but take up more than one line (they include a line break), the same links in the convert

  • ECC 6.0 Installation Steps

    Hi i want to install IDES ECC 6.0.Can anyone provide installation steps? Pls help me to go ahead with installation.

  • Adobe CS6 Trial

    Hi, I have Adobe CS6 Master Collection installed on my master image in trial mode. I serialize CS6 after sysprep is complete using the serialization .exe. All works well. The question I have is: 1. When the trial period expires for Adobe CS6 on my ma

  • How to delete inbound delivery

    Hi guru's, How can I delete an inbound delivery, who's GRN is processed in migo, & who's sale has also been taken place, hence there is no stock in mmbe for that batch. but in vl06if list it is there, how to delete it, please its urgent thanks tuljas

  • Weird folder opens when i open new project or import media?

    Hi there. I'm using ilife 11 with iDVD, and everytime i open a project, new or old, or import media, a folder opens in my dock like an app would called "MultiMediaImporter.oxygene" what is it? and is something wrong?