Thread handling on RMI

Once exported the object to RMI service, it allows many client object to invoke the methods on RMI object.
It can allow multiple invoke at the same time. Does it mean that RMI service handle multiple request by multi-thread?
Can we control the number of request on RMI object? or It should be done by developer?

You can do that because the previous answer was flat 100% 180 degrees wrong. RMI is and always has been multithreaded in all versions and implementations I have ever seen or heard of in over ten years.
This bizarre rumour to the contrary surfaces occasionally. It frankly baffles me how anybody could believe it for a moment. Such a system would be almost completely useless.

Similar Messages

  • Exception in thread "main" java.rmi.NotBoundException: commandService

    Hello,
    I want to deploy two SNs on one machine, and I chose different port(5030,5031), when I run "runadmin", the exceptions happened.
    [sunyao@datanode1:~/oracle_nosql/tools]$ jps -m
    25392 Jps -m
    25145 kvstore-1.2.123.jar start -root KVROOT_2
    23099 kvstore-1.2.123.jar start -root KVROOT
    23265 ManagedService -root KVROOT/mystore/sn2 -store mystore -class RepNode -service rg1-rn2
    25220 ManagedService -root KVROOT_2/mystore2/sn1 -store mystore2 -class Admin -service admin1
    [sunyao@datanode1:~/oracle_nosql/tools]$ java -jar kv-1.2.123/lib/kvstore-1.2.123.jar ping -port 5030 -host datanode1
    SNA at hostname: datanode1 registry port: 5030 has no available Admins or RNs registered.
    [sunyao@datanode1:~/oracle_nosql/tools]$ java -jar kv-1.2.123/lib/kvstore-1.2.123.jar runadmin -port 5030 -host datanode1
    Exception in thread "main" java.rmi.NotBoundException: commandService
    at sun.rmi.registry.RegistryImpl.lookup(RegistryImpl.java:106)
    at sun.rmi.registry.RegistryImpl_Skel.dispatch(Unknown Source)
    at sun.rmi.server.UnicastServerRef.oldDispatch(UnicastServerRef.java:386)
    at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:250)
    at sun.rmi.transport.Transport$1.run(Transport.java:159)
    at java.security.AccessController.doPrivileged(Native Method)
    at sun.rmi.transport.Transport.serviceCall(Transport.java:155)
    at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:535)
    at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(TCPTransport.java:790)
    at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:649)
    at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
    at java.lang.Thread.run(Thread.java:662)
    at sun.rmi.transport.StreamRemoteCall.exceptionReceivedFromServer(StreamRemoteCall.java:255)
    at sun.rmi.transport.StreamRemoteCall.executeCall(StreamRemoteCall.java:233)
    at sun.rmi.server.UnicastRef.invoke(UnicastRef.java:359)
    at sun.rmi.registry.RegistryImpl_Stub.lookup(Unknown Source)
    at oracle.kv.impl.util.registry.RegistryUtils.getAdmin(RegistryUtils.java:197)
    at oracle.kv.impl.admin.client.KVAdmin.connect(KVAdmin.java:883)
    at oracle.kv.impl.admin.client.KVAdmin.main(KVAdmin.java:2131)
    at oracle.kv.impl.util.KVStoreMain$6.run(KVStoreMain.java:188)
    at oracle.kv.impl.util.KVStoreMain.main(KVStoreMain.java:319)

    hi ,
    I have started two admin service in one group:
    but one admin service can't access from 5001, and the log is below:
    [sunyao@datanode1:~/oracle_nosql/tools/KVROOT/mystore/log]$ cat admin2_0.log
    02-09-12 17:48:46:696 CST INFO [admin2] Starting service process: admin2, Java command line arguments: [-XX:+DisableExplicitGC, -Xms96M, -Xmx96M]
    02-09-12 17:48:46:720 CST INFO [admin2] Starting AdminService
    02-09-12 17:48:46:881 CST INFO [admin2] Initializing Admin for store: mystore
    02-09-12 17:48:46:883 CST INFO [admin2] Created new admin environment dir: KVROOT/mystore/sn2/admin2/env
    02-09-12 17:48:46:884 CST INFO [admin2] JVM Runtime maxMemory (bytes): 96468992
    02-09-12 17:48:46:889 CST INFO [admin2] Non-default JE properties for environment: {je.rep.vlsn.logCacheSize=128, je.rep.envUnknownStateTimeout=10 s, je.tree.maxDelta=10, je.log.faultReadSize=4096, je.rep.vlsn.distance=1000000, je.env.runEvictor=true, je.cleaner.minUtilization=40, je.rep.replicaAckTimeout=5 s, je.cleaner.threads=2, je.evictor.lruOnly=false, je.rep.replayMaxOpenDbHandles=100, je.log.writeQueueSize=2097152, je.evictor.criticalPercentage=105, je.log.iteratorReadSize=1048576, je.log.numBuffers=16, je.nodeMaxEntries=128, je.evictor.nodesPerScan=200, je.rep.preHeartbeatTimeoutMs=5000000000, je.checkpointer.bytesInterval=200000000, je.cleaner.lazyMigration=false, je.txn.durability=write_no_sync,write_no_sync,simple_majority, je.cleaner.readSize=1048576, je.rep.txnRollbackLimit=10, je.log.fileCacheSize=2000, je.log.fileMax=1073741824}
    02-09-12 17:48:48:390 CST INFO [admin2] State change event: Thu Feb 09 17:48:47 CST 2012, State: REPLICA, Master: 1
    02-09-12 17:48:48:852 CST INFO [admin2] Shutting down monitor collector
    02-09-12 17:48:48:853 CST INFO [admin2] Replicated environment handle established. Cache size: 57881395, State: REPLICA
    02-09-12 17:48:48:854 CST INFO [admin2] Starting Command service on rmi://datanode1:5000/commandService
    02-09-12 17:48:48:950 CST INFO [admin2] Starting Web service on port 5001
    02-09-12 17:48:49:183 CST INFO [admin2] jetty-7.4.0.v20110414
    02-09-12 17:48:49:350 CST INFO [admin2] Extract jar:file:/home/sunyao/oracle_nosql/tools/kv-1.2.123/lib/kvstore-1.2.123.jar!/war/KVAdminUI/ to /tmp/jetty-0.0.0.0-5001-KVAdminUI-_-any-/webapp
    02-09-12 17:48:50:65 CST INFO [admin2] NO JSP Support for /, did not find org.apache.jasper.servlet.JspServlet
    02-09-12 17:48:50:120 CST INFO [admin2] started o.e.j.w.WebAppContext{,file:/tmp/jetty-0.0.0.0-5001-KVAdminUI-_-any-/webapp/},jar:file:/home/sunyao/oracle_nosql/tools/kv-1.2.123/lib/kvstore-1.2.123.jar!/war/KVAdminUI
    02-09-12 17:48:50:201 CST INFO [admin2] Started [email protected]:5001 STARTING
    02-09-12 17:48:50:203 CST INFO [admin2] Started AdminService
    02-09-12 17:49:04:408 CST INFO [admin2] Redirect to master at http://namenode:5001
    02-09-12 17:49:24:427 CST INFO [admin2] Redirect to master at http://namenode:5001
    02-09-12 17:49:28:432 CST INFO [admin2] Redirect to master at http://namenode:5001
    02-09-12 17:52:16:974 CST INFO [admin2] Redirect to master at http://namenode:5001
    02-09-12 17:52:29:844 CST INFO [admin2] Redirect to master at http://namenode:5001
    02-09-12 17:54:03:343 CST INFO [admin2] Redirect to master at http://namenode:5001
    02-09-12 18:00:48:854 CST INFO [admin2] Redirect to master at http://namenode:5001
    02-09-12 18:02:10:25 CST INFO [admin2] Redirect to master at http://namenode:5001
    02-09-12 18:02:55:400 CST INFO [admin2] Redirect to master at http://namenode:5001
    02-09-12 18:02:59:708 CST INFO [admin2] Redirect to master at http://namenode:5001
    02-09-12 18:03:02:127 CST INFO [admin2] Redirect to master at http://namenode:5001
    02-09-12 18:03:05:644 CST INFO [admin2] Redirect to master at http://namenode:5001
    namenode is the hostname of 192.168.7.200, and I can access the admin service from http://192.168.7.200:5001
    and the topology is
    Pinging components of store mystore based upon topology sequence #612
    mystore comprises 300 partitions and 3 Storage Nodes
    Storage Node [sn1] on namenode:5000 Datacenter: Boston [dc1] Status: RUNNING Ver: 11gR2.1.2.123
    Rep Node [rg1-rn1] Status: RUNNING,REPLICA at sequence number: 625 haPort: 5011
    Storage Node [sn2] on datanode1:5000 Datacenter: Boston [dc1] Status: RUNNING Ver: 11gR2.1.2.123
    Rep Node [rg1-rn2] Status: RUNNING,REPLICA at sequence number: 625 haPort: 5010
    Storage Node [sn3] on datanode2:5000 Datacenter: Boston [dc1] Status: RUNNING Ver: 11gR2.1.2.123
    Rep Node [rg1-rn3] Status: RUNNING,MASTER at sequence number: 625 haPort: 5010
    Edited by: 912068 on 2012-2-9 上午2:06
    and when I shutdown namenode SN and admin service , and access 185:5001, the exceptions are belowed:
    Error
    Dismiss
    The Admin instance is unable to service this request, as it is not the master Admin instance. Furthermore, its state is such that it does not know the master Admin's forwarding address.
    Edited by: 912068 on 2012-2-9 上午2:24

  • Creative Cloud Leaks Thread Handles

    I have Creative Cloud version 1.8.0.447 running on windows 7, and I notice that it leaks a Thread Handle, about 4 times, or so, per minute.  Since I leave my computer on most of the time, after a few days, the number of leaked Thread Handles is up in the tens of thousands.
    I can see the thread handles leaking using Process Explorer.
    Generally when a thread ends, its handle needs to be closed, or else the handle will stay active forever, or until the process ends.  It looks like the programming team is not closing these handles after the threads end.
    Please, adobe, fix this problem in a future release of creative cloud.
    -Todd

    Some 10.9.x links
    -next link says After Effects, but check YOUR permissions !!!
    -http://blogs.adobe.com/aftereffects/2014/06/permissions-mac-os-start-adobe-applications.ht ml
    -Mac 10.9.4 and OpenCL issue https://forums.adobe.com/thread/1514717
    -Mac 10.9.3 workaround https://forums.adobe.com/thread/1489922
    -more Mac 10.9.3 https://forums.adobe.com/thread/1491469
    -and https://forums.adobe.com/thread/1507936
    or
    A chat session where an agent may remotely look inside your computer may help
    Creative Cloud chat support (all Creative Cloud customer service issues)
    http://helpx.adobe.com/x-productkb/global/service-ccm.html

  • 404 error Exception in thread "main" java.rmi.RemoteException: HTTP �������� 4

    I have Install Sun Application Server PE and JWSDP,when I run asant run-sample,an error below:
    run-sample:
    [echo] Running the simple.TestClient program....
    [java] Service URL=http://localhost:8080/securesimple/Ping
    [java] 2005-11-11 1:03:11 com.sun.xml.wss.impl.filter.DumpFilter process
    [java] ����: ==== Sending Message Start ====
    [java] <?xml version="1.0" encoding="UTF-8"?>
    [java] <env:Envelope xmlns:env="http://schemas.xmlsoap.org/soap/envelope/"
    xmlns:enc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:ns0="http://xmlsoap.
    org/Ping" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.
    org/2001/XMLSchema-instance">
    [java] <env:Body>
    [java] <ns0:Ping>
    [java] <ns0:ticket>SUNW</ns0:ticket>
    [java] <ns0:text>Hello !</ns0:text>
    [java] </ns0:Ping>
    [java] </env:Body>
    [java] </env:Envelope>
    [java] ==== Sending Message End ====
    [java] Exception in thread "main" java.rmi.RemoteException: HTTP �������� 4
    04: ������ - /securesimple/Ping; nested exception is:
    [java] HTTP �������� 404: ������ - /securesimple/Ping
    [java] at simple.PingPort_Ping_Stub.ping(PingPort_Ping_Stub.java:146)
    [java] at simple.TestClient.main(TestClient.java:34)
    [java] Caused by: HTTP �������� 404: ������ - /securesimple/Ping
    [java] at com.sun.xml.rpc.client.http.HttpClientTransport.checkResponse
    Code(HttpClientTransport.java:302)
    [java] at com.sun.xml.rpc.client.http.HttpClientTransport.connectForRes
    ponse(HttpClientTransport.java:252)
    [java] at com.sun.xml.rpc.client.http.HttpClientTransport.invoke(HttpCl
    ientTransport.java:88)
    [java] at com.sun.xml.rpc.client.StreamingSender._send(StreamingSender.
    java:96)
    [java] at simple.PingPort_Ping_Stub.ping(PingPort_Ping_Stub.java:130)
    [java] ... 1 more
    [java] Java Result: 1

    Hi,
    Before connecting through your main program, you have to keep ready your catching object. Mean to say first you have to run local method which will be waiting for remote method to catch.
    Regards,
    Ravi Maheshwari

  • 404 :Exception in thread "main" java.rmi.RemoteException

    I have Install Sun Application Server PE and JWSDP,when I run asant run-sample,an error below:
    run-sample:
    [echo] Running the simple.TestClient program....
    [java] Service URL=http://localhost:8080/securesimple/Ping
    [java] 2005-11-11 1:03:11 com.sun.xml.wss.impl.filter.DumpFilter process
    [java] ����: ==== Sending Message Start ====
    [java] <?xml version="1.0" encoding="UTF-8"?>
    [java] <env:Envelope xmlns:env="http://schemas.xmlsoap.org/soap/envelope/"
    xmlns:enc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:ns0="http://xmlsoap.
    org/Ping" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.
    org/2001/XMLSchema-instance">
    [java] <env:Body>
    [java] <ns0:Ping>
    [java] <ns0:ticket>SUNW</ns0:ticket>
    [java] <ns0:text>Hello !</ns0:text>
    [java] </ns0:Ping>
    [java] </env:Body>
    [java] </env:Envelope>
    [java] ==== Sending Message End ====
    [java] Exception in thread "main" java.rmi.RemoteException: HTTP �������� 4
    04: ������ - /securesimple/Ping; nested exception is:
    [java] HTTP �������� 404: ������ - /securesimple/Ping
    [java] at simple.PingPort_Ping_Stub.ping(PingPort_Ping_Stub.java:146)
    [java] at simple.TestClient.main(TestClient.java:34)
    [java] Caused by: HTTP �������� 404: ������ - /securesimple/Ping
    [java] at com.sun.xml.rpc.client.http.HttpClientTransport.checkResponse
    Code(HttpClientTransport.java:302)
    [java] at com.sun.xml.rpc.client.http.HttpClientTransport.connectForRes
    ponse(HttpClientTransport.java:252)
    [java] at com.sun.xml.rpc.client.http.HttpClientTransport.invoke(HttpCl
    ientTransport.java:88)
    [java] at com.sun.xml.rpc.client.StreamingSender._send(StreamingSender.
    java:96)
    [java] at simple.PingPort_Ping_Stub.ping(PingPort_Ping_Stub.java:130)
    [java] ... 1 more
    [java] Java Result: 1

    Hi,
    Before connecting through your main program, you have to keep ready your catching object. Mean to say first you have to run local method which will be waiting for remote method to catch.
    Regards,
    Ravi Maheshwari

  • Secondary Indices and free-threaded handles

    As per the BerkeleyDB documentation, BDB manages synchronization if the db_handle is free-threaded (i.e opened with flag DB_CREATE).
    Example: Consider a free-threaded handle 'dbp' to the primary index and a free-threaded handle 'dbs' to the secondary index associated with 'dbp'. If one thread is trying to write using 'dbp' and another thread is trying to read using 'dbs', then does BDB maintain synchronization ?

    As per the BerkeleyDB documentation, BDB manages
    synchronization if the db_handle is free-threaded
    (i.e opened with flag DB_CREATE).
    Example: Consider a free-threaded handle 'dbp' to
    the primary index and a free-threaded handle 'dbs'
    to the secondary index associated with 'dbp'. If one
    thread is trying to write using 'dbp' and another
    thread is trying to read using 'dbs', then does BDB
    maintain synchronization ?Would you please clarify your question especially if my guess at what you are asking is incorrect?
    I can't tell if you are really talking about a handle or a cursor and you also mentioned a secondary index. .
    DB handles are free-threaded if the DB_THREAD flag is specified to the DB->open method when the database is opened or if the database environment in which the database is opened is free-threaded. The handle should not be closed while any other handle that refers to the database is in use; for example, database handles must not be closed while cursor handles into the database remain open, or transactions that include operations on the database have not yet been committed or aborted.
    You will also want to configure locking, see the DB_INIT_LOCK flag. Therefore you will likely want to configure a Berkeley DB Environment with the DB_INIT_LOCK | DB_THREAD flags added to your environment.
    If that was NOT what you were asking about please clarify your question or tell us what you are trying to accomplish?
    Ron Cohen
    Oracle Corporation

  • Exception handling in rmi in client side

    Hello everybody, I'm developing a small client-server application using JDBC and RMI .
    I would like to ask if any body can help to know how handle exceptions thrown in the server side and show them for the client.
    Any help will be appreciated

    I prefer not to have the server's exceptions known to the client. The client only gets the exceptions the client expects. This is part of the server interface which is defined and owned by the client.
    So any exception thrown on the server I would handle and rethrow a different appropriate exception up to the client.

  • Swing Thread handling

    Dear all,
    The question is as the follow:
    Condition
    Class A purpose: Get Data from SQL server 2000 e.g.
    SQLDB transaction = new SQLDB();
    transaction.getData();
    Now, I would like to handle the transaction time in order to show that it is processing with Swing component: JLabel, JButton and JFrame. How to write a swing program? Please help me or give me some reference. Thank you so much for your help!
    Regards,
    kzyo

    If java 6, this is an article which I think will probably help you immensely:
    http://java.sun.com/developer/technicalArticles/javase/swingworker/
    It's all about how to implement SwingWorker, a background threader that can among other things give progress reports to the GUI.
    Message was edited by:
    petes1234

  • Thread Handling

    Hello. I'm having a bit of a problem with the way I'm handling threads, quite obviously. At the moment, it appears that each thread I have running in my program uses a little over 10MG of memory. Is this normal? Assuming it is, is there any common and good method of handling threads that might reduce this?
    My program currently requires a new thread to be created every time a new user logs in... which I believe is the only way it can be written because it requires input from each user on an unpredictable basis. That being said, even so much as 10 users would require 100MG plus my other executing threads... looking at 100 is thus rather rediculous... and I'm trying to create my program to allow for far more than 100. I know it can be done, so I'm rather confused as to why it is that I'm not doing it.
    Thank you so much for your time,
    -Jess

    Thanks so much everyone for the replies. I started up a thread pool, as suggested, and that seems to be working well, so thanks for the idea... it doesn't, however, seem to account for the memory problems. this leads me to believe that perhaps there's something about Java I'm not understanding...
    When I run my program, and then enter a ps from the command line, I get the following output: (which, is essentially 10 processes that each use up 0.6% of my host's memory... which is a total of 100MB. Thus accounting for 10 MB per process)
    PID TTY      STAT   TIME  MAJFL   TRS   DRS   RSS %MEM COMMAND
    26088 pts/2    S      0:00      1    56 260499 13636  0.6 java -classpath /home/src/classes engine.Server
    26089 pts/2    S      0:00      0    56 260499 13636  0.6 java -classpath /home/src/classes engine.Server
    26090 pts/2    S      0:00      0    56 260499 13636  0.6 java -classpath /home/src/classes engine.Server
    26091 pts/2    S      0:00      0    56 260499 13636  0.6 java -classpath /home/src/classes engine.Server
    26092 pts/2    S      0:00      0    56 260499 13636  0.6 java -classpath /home/src/classes engine.Server
    26093 pts/2    S      0:00      0    56 260499 13636  0.6 java -classpath /home/src/classes engine.Server
    26094 pts/2    S      0:00      0    56 260499 13636  0.6 java -classpath /home/src/classes engine.Server
    26095 pts/2    S      0:00      0    56 260499 13636  0.6 java -classpath /home/src/classes engine.Server
    26096 pts/2    S      0:00      0    56 260499 13636  0.6 java -classpath /home/src/classes engine.Server
    26100 pts/2    S      0:00      0    56 260499 13636  0.6 java -classpath /home/src/classes engine.ServerPreviously, whenever a new user logged in, a new process would be created identical to the above, which is why I assumed that each process was a thread. So, in preliminary testing, I created a command which runs through the ThreadGroups of my main class (engine.Server), and then prints out the listing. The code is something like:
    ThreadGroup group = server.getThreadGroup();
    ThreadGroup parent = group.getParent();
    while ( parent!=null )
         group = parent;
         parent = group.getParent();
    group.list();This gives me a result of 6 threads:
    java.lang.ThreadGroup[name=system,maxpri=10]
        Thread[Reference Handler,10,system]
        Thread[Finalizer,8,system]
        Thread[Signal Dispatcher,9,system]
        java.lang.ThreadGroup[name=main,maxpri=10]
            Thread[main,5,main]
            Thread[UpdateHandler,5,main]
            Thread[pool-1-thread-1,5,main]However I have ten processes running, which are consuming a pretty large amount of memory. I previously assumed that there were four other threads from a different thread group which were unaccounted for... but I'm not entirely sure that this is the case anymore.
    Is there anything that strikes someone out there that could be accounting for 10 processes consuming 10MB each? I apologize for my ignorance, as I come from a C background where there was only ever one process when I ran (more or less) this same program... so I'm rather lost.
    As well, I have a few statistics from my Runtime, but I think that is unneccesary. If it would help, I will post it, however.
    Thanks so much for your help,
    -Jess

  • Doubt in thread handling

    I have a doubt in the thread mechanism.....
    Below is a sample of the class
    public class SimpleThread extends Thread {
    private int countDown = 5;
    private static int threadCount = 0;
    public SimpleThread() {
    super("" + ++threadCount); // Store the thread name
    start();
    public String toString() {
    return "#" + getName() + ": " + countDown;
    public void run() {
    while(true) {
    System.out.println(this);
    if(--countDown == 0) return;
    public static void main(String[] args) {
    for(int i = 0; i < 5; i++)
    new SimpleThread();
    There is a while loop checks for true.... I am not able to understand which it is referring to .
    and i want to run the thread 5 times .... is it possible to run this using while loop... Because when i use while the loop never end...
    Your guidance is much more appreciated...
    Thankyou
    Shasi

    Hi,
    sorry, but your question seems to be a little confusing.
    shasi wrote:
    I have a doubt in the thread mechanism.....Do you actually have a doubt or more something of a question? To me, it seems to be more of a question...
    Below is a sample of the classPlease use the code tags to format your code for better readability...
    public class SimpleThread extends Thread {
         private int countDown = 5;
         private static int threadCount = 0;
         public SimpleThread() {
              super("" + ++threadCount); // Store the thread name
              start();
         public String toString() {
              return "#" + getName() + ": " + countDown;
         public void run() {
              while(true) {
                   System.out.println(this);
                   if(--countDown == 0) return;
         public static void main(String[] args) {
              for(int i = 0; i < 5; i++)
                   new SimpleThread();
    There is a while loop checks for true.... I am not able to understand which it is referring to .What should it be referring to? The while loop has to be given some statement that evaluates to a boolean. This could either be something like a > 10 or simply true.
    and i want to run the thread 5 times .... is it possible to run this using while loop... Because when i use while the loop never end...You do run the Thread five times. Or are you talking about executing the loop in your run() method for five times (which you also happen to do already)?
    What do you want to run using a while loop?
    The while loop will end: with each iteration, your countdown variable is being decremented, and as soon as it reaches zero, the return statement is executed breaking out of the while loop.
    Bye.

  • How do you dispose a thread-handled modal dialog not thru some actions?

    The code almost looks like this:
    /* Thread that disposes the dialog when the time in seconds is "9" */
    class AboutThread extends Thread {
    private volatile Thread about;
    AboutDialog ad;
    AboutThread(AboutDialog ad) {
    this.ad = ad;
    public void stopped() {
    about = null;
    ad.dispose();
    ad = null;
    System.gc();
    public synchronized void run() {
    Thread thisThread = Thread.currentThread();
    about = thisThread;
    System.out.println("About thread is running!");
    ad.start();
    while (about == thisThread) {
    try {
    Thread.sleep(1000);
    } catch (InterruptedException ex) {
         System.err.println("Thread.sleep error: " + ex);
    String s = new String(getCurrentDateTime("s"));
    if (s.equals("9")) {
    ad.setVisible(false);
    ad.setModal(false);
    ad.setVisible(true);
    System.out.println(9);
    this.stop();
    /* Shows a dialog describing the User Log application */
    public class AboutDialog extends Dialog implements ActionListener {
    public AboutDialog(Frame parent, String title) {
         super(parent, title, false);
         Panel labelPanel = new Panel();
         labelPanel.setLayout(new BorderLayout());
         labelPanel.setBackground(Color.gray);
    JLabel jlab = new JLabel("User Log 1.0");
    jlab.setHorizontalAlignment(SwingConstants.CENTER);
    jlab.setFont(new Font("Monospaced", Font.BOLD, 28));
    JLabel jlab1 = new JLabel("Copyright(c) 2001 Soft Wares. All Rights Reserved.");
    jlab1.setHorizontalAlignment(SwingConstants.CENTER);
    labelPanel.add(jlab, "Center");
         labelPanel.add(jlab1, "South");
         add(labelPanel, "Center");
         Panel buttonPanel = new Panel();
    buttonPanel.setBackground(Color.gray);
         Button okButton = new Button("OK");
         okButton.addActionListener(this);
         buttonPanel.add(okButton);
         add(buttonPanel, "South");
         setSize(400, 130);
         setLocation(parent.getLocationOnScreen().x + 200,
              parent.getLocationOnScreen().y + 200);
    public void start() {
    show();
    public void actionPerformed(ActionEvent e) {
         setVisible(false);
         dispose();
    at.stopped();
    }

    ooops! i'm sorry. in the AboutDialog Class, it should be "super(parent, title, true)" for it to be modal.
    anyway, it seemed that posting the partial code above of the whole app is not so understandable.
    what i like to address here is that: how do i dispose or get rid of the thread-dispatched modal dialog by not making mouse clicks or any other user intervention? i wanted it to be disposed by the same thread, which dispatched it, when a certain variable value (global or local) is met. is this possible?

  • Java Thread Handling

    Hi,
    I've been poking around in the site but haven't been able to find the answer: does Java dispatch threads to different cores when it has control of the processor(s) or does the JVM internally decide which thread gets control of the processor(s)?
    Thanks.

    Thanks...I seemed to remember that Java decided but I wasn't sure and was in fact correct.
    Speaking of which - can you perhaps link me or tell me what terms to search under so I can get some Sun documentation on this and read up about it? I am most interested in the details.
    Thanks !

  • How to handle threading for TCP communicat​ion?

    Hi,
    I've a project to control two separate applications (C++ and LabView) and both of them are implemented as server. Another client program (C++) is used to control those application. The communication among them are implemented using TCP socket. The client program sends message to start or stop some tasks on the servers. The client program also sends time (hh:mm:ss) with the start and stop message to determine when to start or stop.
    In C++ application (server): The application listens for connection and when gets  one, it creates a communication thread to handle that and again listen for another connection. The communication thread handles message passing and when it receives start or stop message, it creates a timer thread with the received time to trigger a task at specified time. And after that it waits for message from the client. So, here, when thread (communication, timer) is needed, it is created.
    In LabView (server): I've tried to create same thing as the C++ server. But, from LabView manual and others forum threads, I got that LabView is multithreading and it can be done using independent loop. So, I'd to create four loops in a diagram:
    1. Listen for new connection
    2. Handle communication for already received connection
    3. Start timer
    4. Stop timer
    and they are run at the beginning of the execution and communication among them are managed using local variables. But, 2,3 and 4th loop can handle only one connection and it can handle another if the current is closed. But, the C++ application can handle more than one connection by creating thread when it is necessary but not at the beginning of the execution of the application.
    Is there a better way to implement this in LabView?
    Is it possible to handle multiple connections and create diagram node/block (like thread) dynamically like C++?
    Thanks.
    Using LabVIEW 2010, Visual C#, Visual C++ (2005, 2008, 2010)
    Solved!
    Go to Solution.

    There are several ways to do this in modern LabVIEW and you should probably search the Example Finder for some TCP examples. The classic way is to transfer the connection refnum from the listen loop to a communication loop that adds it to an array of connection IDs and then continously iterates over this array to do the communication. It works since about LabVIEW 4.0 perfectly for me even for applications with HTTP based communication protocol. But you need to make sure of course that the communciation handling for one connection isn't delaying its work for some reasons as that would delay the handling of the other connections too, as they are really worked on sequentially. If you encounter an error, the connection ID is closed and removed from the array.
    The other is that you create a VI that does your whole communication and terminates itself on an error or when getting the quit command. Make this VI to be reentrant and then launch it through VI server as reentrant instance, passing it the newly received connection refnum form the listen loop. Then use the Run method to let it start and operate like an independant thread.
    For all of these you should be able to find an example in the Example Finder when searching for TCP.
    Rolf Kalbermatter
    CIT Engineering Netherlands
    a division of Test & Measurement Solutions

  • Full thread dump Java HotSpot(TM) Server VM (1.4.2_05-b04 mixed mode):

    Hi All,
    I am getting below error message when i am starting JBoss
    Anyone has any idea, why it is happening?
    Full thread dump Java HotSpot(TM) Server VM (1.4.2_05-b04 mixed mode):
    "RMI ConnectionExpiration-[127.0.0.1:33030]" daemon prio=1 tid=0x2a375e90 nid=0xcf9 waiting on condition [2820d000..2820d86c]
         at java.lang.Thread.sleep(Native Method)
         at sun.rmi.transport.tcp.TCPChannel$Reaper.run(TCPChannel.java:447)
         at java.lang.Thread.run(Thread.java:534)
    "RMI TCP Connection(1681)-127.0.0.1" daemon prio=1 tid=0x2cc3e008 nid=0xcf9 runnable [27b7b000..27b7b86c]
         at java.net.SocketInputStream.socketRead0(Native Method)
         at java.net.SocketInputStream.read(SocketInputStream.java:129)
         at java.io.BufferedInputStream.fill(BufferedInputStream.java:183)
         at java.io.BufferedInputStream.read(BufferedInputStream.java:201)
         - locked <0x2ed63640> (a java.io.BufferedInputStream)
         at java.io.FilterInputStream.read(FilterInputStream.java:66)
         at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:442)
         at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:701)
         at java.lang.Thread.run(Thread.java:534)
    "RMI RenewClean-[127.0.0.1:33030]" daemon prio=1 tid=0x2ca76ad0 nid=0xcf9 in Object.wait() [29dcd000..29dcd86c]
         at java.lang.Object.wait(Native Method)
         - waiting on <0x2ed61c50> (a java.lang.ref.ReferenceQueue$Lock)
         at java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:111)
         - locked <0x2ed61c50> (a java.lang.ref.ReferenceQueue$Lock)
         at sun.rmi.transport.DGCClient$EndpointEntry$RenewCleanThread.run(DGCClient.java:500)
         at java.lang.Thread.run(Thread.java:534)
    "JNP Server" prio=1 tid=0x082dd9c0 nid=0xcf9 runnable [27afa000..27afa86c]
         at java.net.PlainSocketImpl.socketAccept(Native Method)
         at java.net.PlainSocketImpl.accept(PlainSocketImpl.java:353)
         - locked <0x3d145770> (a java.net.PlainSocketImpl)
         at java.net.ServerSocket.implAccept(ServerSocket.java:448)
         at java.net.ServerSocket.accept(ServerSocket.java:419)
         at org.jnp.server.Main.run(Main.java:257)
         at java.lang.Thread.run(Thread.java:534)
    "RMI TCP Connection(1680)-127.0.0.1" daemon prio=1 tid=0x2ca55d80 nid=0xcf9 runnable [27f88000..27f8886c]
         at java.net.SocketInputStream.socketRead0(Native Method)
         at java.net.SocketInputStream.read(SocketInputStream.java:129)
         at java.io.BufferedInputStream.fill(BufferedInputStream.java:183)
         at java.io.BufferedInputStream.read(BufferedInputStream.java:201)
         - locked <0x2ecd1e40> (a java.io.BufferedInputStream)
         at java.io.FilterInputStream.read(FilterInputStream.java:66)
         at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:442)
         at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:701)
         at java.lang.Thread.run(Thread.java:534)
    "RMI ConnectionExpiration-[127.0.0.1:33030]" daemon prio=1 tid=0x2df71458 nid=0xcf9 waiting on condition [29e4e000..29e4e86c]
         at java.lang.Thread.sleep(Native Method)
         at sun.rmi.transport.tcp.TCPChannel$Reaper.run(TCPChannel.java:447)
         at java.lang.Thread.run(Thread.java:534)
    "Thread-36" daemon prio=1 tid=0x08541f10 nid=0xcf9 runnable [279f8000..279f886c]
         at java.net.SocketInputStream.socketRead0(Native Method)
         at java.net.SocketInputStream.read(SocketInputStream.java:129)
         at java.io.BufferedInputStream.fill(BufferedInputStream.java:183)
         at java.io.BufferedInputStream.read1(BufferedInputStream.java:222)
         at java.io.BufferedInputStream.read(BufferedInputStream.java:277)
         - locked <0x3d8dbc38> (a java.io.BufferedInputStream)
         at com.sun.jndi.ldap.Connection.run(Connection.java:780)
         at java.lang.Thread.run(Thread.java:534)
    "Thread-35" daemon prio=1 tid=0x0811fd00 nid=0xcf9 runnable [27a79000..27a7986c]
         at java.net.SocketInputStream.socketRead0(Native Method)
         at java.net.SocketInputStream.read(SocketInputStream.java:129)
         at java.io.BufferedInputStream.fill(BufferedInputStream.java:183)
         at java.io.BufferedInputStream.read1(BufferedInputStream.java:222)
         at java.io.BufferedInputStream.read(BufferedInputStream.java:277)
         - locked <0x3d8d7d50> (a java.io.BufferedInputStream)
         at com.sun.jndi.ldap.Connection.run(Connection.java:780)
         at java.lang.Thread.run(Thread.java:534)
    "Thread-34" daemon prio=1 tid=0x08bc3588 nid=0xcf9 in Object.wait() [27e86000..27e8686c]
         at java.lang.Object.wait(Native Method)
         - waiting on <0x3d8d6050> (a org.jboss.mx.util.ThreadPool$Worker)
         at java.lang.Object.wait(Object.java:429)
         at org.jboss.mx.util.ThreadPool$Worker.run(ThreadPool.java:243)
         - locked <0x3d8d6050> (a org.jboss.mx.util.ThreadPool$Worker)
    "Thread-33" daemon prio=1 tid=0x08bc47b8 nid=0xcf9 in Object.wait() [27f07000..27f0786c]
         at java.lang.Object.wait(Native Method)
         - waiting on <0x3d8d4780> (a org.jboss.mx.util.ThreadPool$Worker)
         at java.lang.Object.wait(Object.java:429)
         at org.jboss.mx.util.ThreadPool$Worker.run(ThreadPool.java:243)
         - locked <0x3d8d4780> (a org.jboss.mx.util.ThreadPool$Worker)
    "Thread-32" daemon prio=1 tid=0x08407010 nid=0xcf9 in Object.wait() [2d2af000..2d2af86c]
         at java.lang.Object.wait(Native Method)
         - waiting on <0x3d895fa8> (a org.jboss.mx.util.ThreadPool$Worker)
         at java.lang.Object.wait(Object.java:429)
         at org.jboss.mx.util.ThreadPool$Worker.run(ThreadPool.java:243)
         - locked <0x3d895fa8> (a org.jboss.mx.util.ThreadPool$Worker)
    "Thread-31" prio=1 tid=0x084065d0 nid=0xcf9 in Object.wait() [27bfc000..27bfc86c]
         at java.lang.Object.wait(Native Method)
         - waiting on <0x3d895bd8> (a java.lang.Object)
         at java.lang.Object.wait(Object.java:429)
         at org.jboss.system.server.ServerImpl$LifeThread.run(ServerImpl.java:731)
         - locked <0x3d895bd8> (a java.lang.Object)
    "Thread-30" prio=1 tid=0x082ef440 nid=0xcf9 in Object.wait() [27c7d000..27c7d86c]
         at java.lang.Object.wait(Native Method)
         - waiting on <0x3d852290> (a org.jboss.mx.util.RunnableScheduler)
         at org.jboss.mx.util.RunnableScheduler.waitOutstanding(RunnableScheduler.java:188)
         - locked <0x3d852290> (a org.jboss.mx.util.RunnableScheduler)
         at org.jboss.mx.util.RunnableScheduler.run(RunnableScheduler.java:93)
         at java.lang.Thread.run(Thread.java:534)
    "Thread-29" prio=1 tid=0x085357c0 nid=0xcf9 in Object.wait() [27cfe000..27cfe86c]
         at java.lang.Object.wait(Native Method)
         - waiting on <0x3d8502e8> (a org.jboss.mx.util.RunnableScheduler)
         at org.jboss.mx.util.RunnableScheduler.waitOutstanding(RunnableScheduler.java:188)
         - locked <0x3d8502e8> (a org.jboss.mx.util.RunnableScheduler)
         at org.jboss.mx.util.RunnableScheduler.run(RunnableScheduler.java:93)
         at java.lang.Thread.run(Thread.java:534)
    "Thread-28" prio=1 tid=0x08fc8d58 nid=0xcf9 in Object.wait() [27d7f000..27d7f86c]
         at java.lang.Object.wait(Native Method)
         - waiting on <0x3d84d6b0> (a org.jboss.mx.util.RunnableScheduler)
         at org.jboss.mx.util.RunnableScheduler.waitOutstanding(RunnableScheduler.java:188)
         - locked <0x3d84d6b0> (a org.jboss.mx.util.RunnableScheduler)
         at org.jboss.mx.util.RunnableScheduler.run(RunnableScheduler.java:93)
         at java.lang.Thread.run(Thread.java:534)
    "Thread-27" daemon prio=1 tid=0x08a3c5f0 nid=0xcf9 runnable [27e05000..27e0586c]
         at java.net.SocketInputStream.socketRead0(Native Method)
         at java.net.SocketInputStream.read(SocketInputStream.java:129)
         at java.io.BufferedInputStream.fill(BufferedInputStream.java:183)
         at java.io.BufferedInputStream.read1(BufferedInputStream.java:222)
         at java.io.BufferedInputStream.read(BufferedInputStream.java:277)
         - locked <0x3d8494b8> (a java.io.BufferedInputStream)
         at com.sun.jndi.ldap.Connection.run(Connection.java:780)
         at java.lang.Thread.run(Thread.java:534)
    "Thread-26" daemon prio=1 tid=0x08829d80 nid=0xcf9 in Object.wait() [2bf3a000..2bf3a86c]
         at java.lang.Object.wait(Native Method)
         - waiting on <0x3d83f190> (a java.util.TaskQueue)
         at java.util.TimerThread.mainLoop(Timer.java:429)
         - locked <0x3d83f190> (a java.util.TaskQueue)
         at java.util.TimerThread.run(Timer.java:382)
    "RMI LeaseChecker" daemon prio=1 tid=0x08d475b0 nid=0xcf9 waiting on condition [29bff000..29bff86c]
         at java.lang.Thread.sleep(Native Method)
         at sun.rmi.transport.DGCImpl$LeaseChecker.run(DGCImpl.java:307)
         at java.lang.Thread.run(Thread.java:534)
    "SessionScavenger" daemon prio=1 tid=0x08b8c420 nid=0xcf9 waiting on condition [2a1ff000..2a1ff86c]
         at java.lang.Thread.sleep(Native Method)
         at org.mortbay.jetty.servlet.AbstractSessionManager$SessionScavenger.run(AbstractSessionManager.java:428)
    "SessionScavenger" daemon prio=1 tid=0x082f2760 nid=0xcf9 waiting on condition [2ab72000..2ab7286c]
         at java.lang.Thread.sleep(Native Method)
         at org.mortbay.jetty.servlet.AbstractSessionManager$SessionScavenger.run(AbstractSessionManager.java:428)
    "UILServerILService Accept Thread" prio=1 tid=0x2cc3e9c0 nid=0xcf9 runnable [2abfb000..2abfb86c]
         at java.net.PlainSocketImpl.socketAccept(Native Method)
         at java.net.PlainSocketImpl.accept(PlainSocketImpl.java:353)
         - locked <0x3d63d830> (a java.net.PlainSocketImpl)
         at java.net.ServerSocket.implAccept(ServerSocket.java:448)
         at java.net.ServerSocket.accept(ServerSocket.java:419)
         at org.jboss.mq.il.uil2.UILServerILService.run(UILServerILService.java:118)
         at java.lang.Thread.run(Thread.java:534)
    "OIL2 Worker Server" prio=1 tid=0x2dfe0df0 nid=0xcf9 runnable [2ac7c000..2ac7c86c]
         at java.net.PlainSocketImpl.socketAccept(Native Method)
         at java.net.PlainSocketImpl.accept(PlainSocketImpl.java:353)
         - locked <0x3d63d958> (a java.net.PlainSocketImpl)
         at java.net.ServerSocket.implAccept(ServerSocket.java:448)
         at java.net.ServerSocket.accept(ServerSocket.java:419)
         at org.jboss.mq.il.oil2.OIL2ServerILService.run(OIL2ServerILService.java:366)
         at java.lang.Thread.run(Thread.java:534)
    "UIL Worker" prio=1 tid=0x2ccfca90 nid=0xcf9 runnable [2acfd000..2acfd86c]
         at java.net.PlainSocketImpl.socketAccept(Native Method)
         at java.net.PlainSocketImpl.accept(PlainSocketImpl.java:353)
         - locked <0x3d63da18> (a java.net.PlainSocketImpl)
         at java.net.ServerSocket.implAccept(ServerSocket.java:448)
         at java.net.ServerSocket.accept(ServerSocket.java:419)
         at org.jboss.mq.il.uil.UILServerILService.run(UILServerILService.java:184)
         at java.lang.Thread.run(Thread.java:534)
    "OIL Worker Server" prio=1 tid=0x2bab0a70 nid=0xcf9 runnable [2ad7e000..2ad7e86c]
         at java.net.PlainSocketImpl.socketAccept(Native Method)
         at java.net.PlainSocketImpl.accept(PlainSocketImpl.java:353)
         - locked <0x3d63dad8> (a java.net.PlainSocketImpl)
         at java.net.ServerSocket.implAccept(ServerSocket.java:448)
         at java.net.ServerSocket.accept(ServerSocket.java:419)
         at org.jboss.mq.il.oil.OILServerILService.run(OILServerILService.java:471)
         at java.lang.Thread.run(Thread.java:534)
    "Thread-25" prio=1 tid=0x2cc9ef88 nid=0xcf9 in Object.wait() [2adff000..2adff86c]
         at java.lang.Object.wait(Native Method)
         - waiting on <0x3d63db88> (a java.util.LinkedList)
         at java.lang.Object.wait(Object.java:429)
         at org.jboss.resource.connectionmanager.PoolFiller$1.run(PoolFiller.java:75)
         - locked <0x3d63db88> (a java.util.LinkedList)
         at java.lang.Thread.run(Thread.java:534)
    "Thread-24" prio=1 tid=0x2dfe0268 nid=0xcf9 in Object.wait() [2afc4000..2afc486c]
         at java.lang.Object.wait(Native Method)
         - waiting on <0x3d52f320> (a java.util.ArrayList)
         at org.jboss.resource.connectionmanager.IdleRemover$1.run(IdleRemover.java:66)
         - locked <0x3d52f320> (a java.util.ArrayList)
         at java.lang.Thread.run(Thread.java:534)
    "Thread-23" daemon prio=1 tid=0x2dfce680 nid=0xcf9 in Object.wait() [2b045000..2b04586c]
         at java.lang.Object.wait(Native Method)
         - waiting on <0x3d52f390> (a org.jboss.util.timeout.TimeoutFactory)
         at org.jboss.util.timeout.TimeoutFactory.doWork(TimeoutFactory.java:503)
         - locked <0x3d52f390> (a org.jboss.util.timeout.TimeoutFactory)
         at org.jboss.util.timeout.TimeoutFactory.access$300(TimeoutFactory.java:27)
         at org.jboss.util.timeout.TimeoutFactory$1.run(TimeoutFactory.java:542)
    "Thread-22" prio=1 tid=0x2ccef150 nid=0xcf9 runnable [2b0c6000..2b0c686c]
         at java.net.PlainSocketImpl.socketAccept(Native Method)
         at java.net.PlainSocketImpl.accept(PlainSocketImpl.java:353)
         - locked <0x3d52f400> (a java.net.PlainSocketImpl)
         at java.net.ServerSocket.implAccept(ServerSocket.java:448)
         at java.net.ServerSocket.accept(ServerSocket.java:419)
         at org.jboss.invocation.pooled.server.PooledInvoker.run(PooledInvoker.java:216)
         at java.lang.Thread.run(Thread.java:534)
    "JBossMQ Cache Reference Softner" daemon prio=1 tid=0x2dfe1a28 nid=0xcf9 in Object.wait() [2b147000..2b14786c]
         at java.lang.Object.wait(Native Method)
         - waiting on <0x3d411a00> (a java.lang.ref.ReferenceQueue$Lock)
         at java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:111)
         - locked <0x3d411a00> (a java.lang.ref.ReferenceQueue$Lock)
         at org.jboss.mq.server.MessageCache.run(MessageCache.java:233)
         at java.lang.Thread.run(Thread.java:534)
    "RMI TCP Accept-0" daemon prio=1 tid=0x2c388ff0 nid=0xcf9 runnable [2b1ef000..2b1ef86c]
         at java.net.PlainSocketImpl.socketAccept(Native Method)
         at java.net.PlainSocketImpl.accept(PlainSocketImpl.java:353)
         - locked <0x3d2c0f90> (a java.net.PlainSocketImpl)
         at java.net.ServerSocket.implAccept(ServerSocket.java:448)
         at java.net.ServerSocket.accept(ServerSocket.java:419)
         at sun.rmi.transport.tcp.TCPTransport.run(TCPTransport.java:334)
         at java.lang.Thread.run(Thread.java:534)
    "SessionScavenger" daemon prio=1 tid=0x2c3864e0 nid=0xcf9 waiting on condition [2b270000..2b27086c]
         at java.lang.Thread.sleep(Native Method)
         at org.mortbay.jetty.servlet.AbstractSessionManager$SessionScavenger.run(AbstractSessionManager.java:428)
    "PoolThread-4" prio=1 tid=0x2c384e10 nid=0xcf9 in Object.wait() [2b2f1000..2b2f186c]
         at java.lang.Object.wait(Native Method)
         - waiting on <0x3d2c10c8> (a org.mortbay.util.ThreadPool$PoolThread)
         at org.mortbay.util.ThreadPool$PoolThread.run(ThreadPool.java:450)
         - locked <0x3d2c10c8> (a org.mortbay.util.ThreadPool$PoolThread)
    "PoolThread-3" prio=1 tid=0x2ba1d4b0 nid=0xcf9 in Object.wait() [2b372000..2b37286c]
         at java.lang.Object.wait(Native Method)
         - waiting on <0x3d2c1120> (a org.mortbay.util.ThreadPool$PoolThread)
         at org.mortbay.util.ThreadPool$PoolThread.run(ThreadPool.java:450)
         - locked <0x3d2c1120> (a org.mortbay.util.ThreadPool$PoolThread)
    "PoolThread-2" prio=1 tid=0x2ba1c960 nid=0xcf9 in Object.wait() [2b3f3000..2b3f386c]
         at java.lang.Object.wait(Native Method)
         - waiting on <0x3d2c1178> (a org.mortbay.util.ThreadPool$PoolThread)
         at org.mortbay.util.ThreadPool$PoolThread.run(ThreadPool.java:450)
         - locked <0x3d2c1178> (a org.mortbay.util.ThreadPool$PoolThread)
    "PoolThread-1" prio=1 tid=0x2ba1be10 nid=0xcf9 in Object.wait() [2b474000..2b47486c]
         at java.lang.Object.wait(Native Method)
         - waiting on <0x3d2c11d0> (a org.mortbay.util.ThreadPool$PoolThread)
         at org.mortbay.util.ThreadPool$PoolThread.run(ThreadPool.java:450)
         - locked <0x3d2c11d0> (a org.mortbay.util.ThreadPool$PoolThread)
    "PoolThread-0" prio=1 tid=0x2ba1b2c0 nid=0xcf9 in Object.wait() [2b4f5000..2b4f586c]
         at java.lang.Object.wait(Native Method)
         - waiting on <0x3d2c1228> (a org.mortbay.util.ThreadPool$PoolThread)
         at org.mortbay.util.ThreadPool$PoolThread.run(ThreadPool.java:450)
         - locked <0x3d2c1228> (a org.mortbay.util.ThreadPool$PoolThread)
    "Acceptor ServerSocket[addr=0.0.0.0/0.0.0.0,port=0,localport=8009]" prio=1 tid=0x2ba1af70 nid=0xcf9 runnable [2b576000..2b57686c]
         at java.net.PlainSocketImpl.socketAccept(Native Method)
         at java.net.PlainSocketImpl.accept(PlainSocketImpl.java:353)
         - locked <0x3d2c12d8> (a java.net.PlainSocketImpl)
         at java.net.ServerSocket.implAccept(ServerSocket.java:448)
         at java.net.ServerSocket.accept(ServerSocket.java:419)
         at org.mortbay.util.ThreadedServer.acceptSocket(ThreadedServer.java:346)
         at org.mortbay.util.ThreadedServer$Acceptor.run(ThreadedServer.java:507)
    "PoolThread-9" prio=1 tid=0x2ba1a420 nid=0xcf9 in Object.wait() [2b5f7000..2b5f786c]
         at java.lang.Object.wait(Native Method)
         - waiting on <0x3d2c13a8> (a org.mortbay.util.ThreadPool$PoolThread)
         at org.mortbay.util.ThreadPool$PoolThread.run(ThreadPool.java:450)
         - locked <0x3d2c13a8> (a org.mortbay.util.ThreadPool$PoolThread)
    "PoolThread-8" prio=1 tid=0x2ba198d0 nid=0xcf9 in Object.wait() [2b678000..2b67886c]
         at java.lang.Object.wait(Native Method)
         - waiting on <0x3d2c1400> (a org.mortbay.util.ThreadPool$PoolThread)
         at org.mortbay.util.ThreadPool$PoolThread.run(ThreadPool.java:450)
         - locked <0x3d2c1400> (a org.mortbay.util.ThreadPool$PoolThread)
    "PoolThread-7" prio=1 tid=0x2c3a4ad8 nid=0xcf9 in Object.wait() [2b6f9000..2b6f986c]
         at java.lang.Object.wait(Native Method)
         - waiting on <0x3d2c1458> (a org.mortbay.util.ThreadPool$PoolThread)
         at org.mortbay.util.ThreadPool$PoolThread.run(ThreadPool.java:450)
         - locked <0x3d2c1458> (a org.mortbay.util.ThreadPool$PoolThread)
    "PoolThread-6" prio=1 tid=0x2c3a4788 nid=0xcf9 in Object.wait() [2b77a000..2b77a86c]
         at java.lang.Object.wait(Native Method)
         - waiting on <0x3d2c14b0> (a org.mortbay.util.ThreadPool$PoolThread)
         at org.mortbay.util.ThreadPool$PoolThread.run(ThreadPool.java:450)
         - locked <0x3d2c14b0> (a org.mortbay.util.ThreadPool$PoolThread)
    "PoolThread-5" prio=1 tid=0x2c3a3c58 nid=0xcf9 in Object.wait() [2b7fb000..2b7fb86c]
         at java.lang.Object.wait(Native Method)
         - waiting on <0x3d2c1508> (a org.mortbay.util.ThreadPool$PoolThread)
         at org.mortbay.util.ThreadPool$PoolThread.run(ThreadPool.java:450)
         - locked <0x3d2c1508> (a org.mortbay.util.ThreadPool$PoolThread)
    "PoolThread-4" prio=1 tid=0x2ba8bfe8 nid=0xcf9 in Object.wait() [2b87c000..2b87c86c]
         at java.lang.Object.wait(Native Method)
         - waiting on <0x3d2c1560> (a org.mortbay.util.ThreadPool$PoolThread)
         at org.mortbay.util.ThreadPool$PoolThread.run(ThreadPool.java:450)
         - locked <0x3d2c1560> (a org.mortbay.util.ThreadPool$PoolThread)
    "PoolThread-3" prio=1 tid=0x2ba78040 nid=0xcf9 in Object.wait() [2b8fd000..2b8fd86c]
         at java.lang.Object.wait(Native Method)
         - waiting on <0x3d2c15b8> (a org.mortbay.util.ThreadPool$PoolThread)
         at org.mortbay.util.ThreadPool$PoolThread.run(ThreadPool.java:450)
         - locked <0x3d2c15b8> (a org.mortbay.util.ThreadPool$PoolThread)
    "PoolThread-2" prio=1 tid=0x2ba69c18 nid=0xcf9 in Object.wait() [2b97e000..2b97e86c]
         at java.lang.Object.wait(Native Method)
         - waiting on <0x3d2c1610> (a org.mortbay.util.ThreadPool$PoolThread)
         at org.mortbay.util.ThreadPool$PoolThread.run(ThreadPool.java:450)
         - locked <0x3d2c1610> (a org.mortbay.util.ThreadPool$PoolThread)
    "PoolThread-1" prio=1 tid=0x2ba69a08 nid=0xcf9 in Object.wait() [2b9ff000..2b9ff86c]
         at java.lang.Object.wait(Native Method)
         - waiting on <0x3d2c1668> (a org.mortbay.util.ThreadPool$PoolThread)
         at org.mortbay.util.ThreadPool$PoolThread.run(ThreadPool.java:450)
         - locked <0x3d2c1668> (a org.mortbay.util.ThreadPool$PoolThread)
    "PoolThread-0" prio=1 tid=0x2ba7ebc8 nid=0xcf9 in Object.wait() [2bb8e000..2bb8e86c]
         at java.lang.Object.wait(Native Method)
         - waiting on <0x3d2c16c0> (a org.mortbay.util.ThreadPool$PoolThread)
         at org.mortbay.util.ThreadPool$PoolThread.run(ThreadPool.java:450)
         - locked <0x3d2c16c0> (a org.mortbay.util.ThreadPool$PoolThread)
    "Acceptor ServerSocket[addr=0.0.0.0/0.0.0.0,port=0,localport=8020]" prio=1 tid=0x2ba7ea18 nid=0xcf9 runnable [2bc0f000..2bc0f86c]
         at java.net.PlainSocketImpl.socketAccept(Native Method)
         at java.net.PlainSocketImpl.accept(PlainSocketImpl.java:353)
         - locked <0x3d2c1770> (a java.net.PlainSocketImpl)
         at java.net.ServerSocket.implAccept(ServerSocket.java:448)
         at java.net.ServerSocket.accept(ServerSocket.java:419)
         at org.mortbay.util.ThreadedServer.acceptSocket(ThreadedServer.java:346)
         at org.mortbay.util.ThreadedServer$Acceptor.run(ThreadedServer.java:507)
    "SessionScavenger" daemon prio=1 tid=0x2ba8bb18 nid=0xcf9 waiting on condition [2bd90000..2bd9086c]
         at java.lang.Thread.sleep(Native Method)
         at org.mortbay.jetty.servlet.AbstractSessionManager$SessionScavenger.run(AbstractSessionManager.java:428)
    "Thread-4" daemon prio=1 tid=0x2ba8c6f0 nid=0xcf9 in Object.wait() [2beb9000..2beb986c]
         at java.lang.Object.wait(Native Method)
         - waiting on <0x3d23d438> (a java.util.TaskQueue)
         at java.util.TimerThread.mainLoop(Timer.java:429)
         - locked <0x3d23d438> (a java.util.TaskQueue)
         at java.util.TimerThread.run(Timer.java:382)
    "GC Daemon" daemon prio=1 tid=0x2c32cd20 nid=0xcf9 in Object.wait() [2bfbb000..2bfbb86c]
         at java.lang.Object.wait(Native Method)
         - waiting on <0x3d0b4b28> (a sun.misc.GC$LatencyLock)
         at sun.misc.GC$Daemon.run(GC.java:100)
         - locked <0x3d0b4b28> (a sun.misc.GC$LatencyLock)
    "RMI Reaper" prio=1 tid=0x2c325c88 nid=0xcf9 in Object.wait() [2c03c000..2c03c86c]
         at java.lang.Object.wait(Native Method)
         - waiting on <0x3d0b4078> (a java.lang.ref.ReferenceQueue$Lock)
         at java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:111)
         - locked <0x3d0b4078> (a java.lang.ref.ReferenceQueue$Lock)
         at java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:127)
         at sun.rmi.transport.ObjectTable$Reaper.run(ObjectTable.java:330)
         at java.lang.Thread.run(Thread.java:534)
    "Thread-3" daemon prio=1 tid=0x2c33be48 nid=0xcf9 in Object.wait() [2c0bd000..2c0bd86c]
         at java.lang.Object.wait(Native Method)
         - waiting on <0x3d0b4378> (a java.util.TaskQueue)
         at java.lang.Object.wait(Object.java:429)
         at java.util.TimerThread.mainLoop(Timer.java:403)
         - locked <0x3d0b4378> (a java.util.TaskQueue)
         at java.util.TimerThread.run(Timer.java:382)
    "RMI TCP Accept-0" daemon prio=1 tid=0x2c33b8e0 nid=0xcf9 runnable [2c13e000..2c13e86c]
         at java.net.PlainSocketImpl.socketAccept(Native Method)
         at java.net.PlainSocketImpl.accept(PlainSocketImpl.java:353)
         - locked <0x3d0b40d8> (a java.net.PlainSocketImpl)
         at java.net.ServerSocket.implAccept(ServerSocket.java:448)
         at java.net.ServerSocket.accept(ServerSocket.java:419)
         at sun.rmi.transport.tcp.TCPTransport.run(TCPTransport.java:334)
         at java.lang.Thread.run(Thread.java:534)
    "Thread-2" daemon prio=1 tid=0x2c340060 nid=0xcf9 runnable [2c1bf000..2c1bf86c]
         at java.net.PlainSocketImpl.socketAccept(Native Method)
         at java.net.PlainSocketImpl.accept(PlainSocketImpl.java:353)
         - locked <0x3d0b1730> (a java.net.PlainSocketImpl)
         at java.net.ServerSocket.implAccept(ServerSocket.java:448)
         at java.net.ServerSocket.accept(ServerSocket.java:419)
         at org.jboss.web.WebServer.run(WebServer.java:258)
         at org.jboss.web.ThreadPool$Worker.run(ThreadPool.java:163)
    "ScannerThread" daemon prio=1 tid=0x2c3403d8 nid=0xcf9 waiting on condition [2cdc7000..2cdc786c]
         at java.lang.Thread.sleep(Native Method)
         at org.jboss.deployment.scanner.AbstractDeploymentScanner$ScannerThread.loop(AbstractDeploymentScanner.java:217)
         at org.jboss.deployment.scanner.AbstractDeploymentScanner$ScannerThread.run(AbstractDeploymentScanner.java:190)
    "Thread-0" daemon prio=1 tid=0x2c327b00 nid=0xcf9 in Object.wait() [2c240000..2c24086c]
         at java.lang.Object.wait(Native Method)
         - waiting on <0x3d05d2d0> (a java.util.TaskQueue)
         at java.util.TimerThread.mainLoop(Timer.java:429)
         - locked <0x3d05d2d0> (a java.util.TaskQueue)
         at java.util.TimerThread.run(Timer.java:382)
    "DestroyJavaVM" prio=1 tid=0x2df28218 nid=0xcf9 waiting on condition [0..bfffccc4]
    "Signal Dispatcher" daemon prio=1 tid=0x080c33f8 nid=0xcf9 waiting on condition [0..0]
    "Finalizer" daemon prio=1 tid=0x080bed60 nid=0xcf9 in Object.wait() [2e3fc000..2e3fc86c]
         at java.lang.Object.wait(Native Method)
         - waiting on <0x3d0b5930> (a java.lang.ref.ReferenceQueue$Lock)
         at java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:111)
         - locked <0x3d0b5930> (a java.lang.ref.ReferenceQueue$Lock)
         at java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:127)
         at java.lang.ref.Finalizer$FinalizerThread.run(Finalizer.java:159)
    "Reference Handler" daemon prio=1 tid=0x080be9d0 nid=0xcf9 in Object.wait() [2e47d000..2e47d86c]
         at java.lang.Object.wait(Native Method)
         - waiting on <0x3d0b52f8> (a java.lang.ref.Reference$Lock)
         at java.lang.Object.wait(Object.java:429)
         at java.lang.ref.Reference$ReferenceHandler.run(Reference.java:115)
         - locked <0x3d0b52f8> (a java.lang.ref.Reference$Lock)

    have you checked bugs.sun.com to see if this has been reported?
    And if not, file one and attach your dump for them to look into it.

  • Interrupting a Thread in a Remote Object?

    HI,
    I am trying to get some thread synchronization to happen between a client and a remote RMI object. Essentially what I am trying to accomplish, is that if I interrupt a call on a blocking method in the remote object, I want the thread to throw the InterruptException. For example, the following code represents what I am trying to accomplish:
    package bca.test.rmi;
    import java.rmi.Naming;
    import java.rmi.Remote;
    import java.rmi.RemoteException;
    import java.rmi.server.UnicastRemoteObject;
    public class InterruptThreadApp {
    RemoteBlockingObjectInt remote = null;
    public static void main(String[] args) throws Exception {
    //Create the remote object
    RemoteBlockingObject obj = new RemoteBlockingObject();
    //bind it to the registry
    Naming.rebind("rmi://localhost/blocking", obj);
    //start the client, or the thread which will access the blocking call remotely
    InterruptThreadApp app = new InterruptThreadApp();
    Thread blocking = null;
    //wait for the thread to start
    synchronized ( app ) {
    blocking = app.startClient();
    app.wait();
    Thread.sleep(2000);
    //now interrupt the thread (note: the remote object should be blocking in
    //the blockingMethod().. this should produce an InterruptException?
    blocking.interrupt();
    public Thread startClient() {
    Thread t = new Thread("Client") {
    public void run() {
    try {
    //get a handle to the stub
    remote = (RemoteBlockingObjectInt) Naming.lookup("rmi://localhost/blocking");
    //now make a call to the blocking method, but first wake up the client
    synchronized ( InterruptThreadApp.this ) {
    InterruptThreadApp.this.notify();
    //now make the blocking call
    remote.blockingMethod();
    catch (InterruptedException e) {
    System.out.println("WooHoo! This is what we want! But it never gets thrown :(");
    catch (Exception e) {
    e.printStackTrace();
    t.start();
    return t;
    package bca.test.rmi;
    import java.rmi.server.UnicastRemoteObject;
    import java.rmi.RemoteException;
    import java.rmi.Remote;
    public class RemoteBlockingObject extends UnicastRemoteObject implements RemoteBlockingObjectInt {
    Object obj = new Object();
    public RemoteBlockingObject() throws RemoteException {
    super();
    public void blockingMethod() throws RemoteException, InterruptedException {
    synchronized (obj) {
    System.out.println("About to block.. so we can be interrupted later");
    obj.wait();
    interface RemoteBlockingObjectInt extends Remote {
    public void blockingMethod() throws RemoteException, InterruptedException;
    When I make a call to "remote.blockingMethod()", it blocks in the remote object (buy just "wait" ing). I want to interrupt this thread, by issuing an Thread.interrupt(). When I do so (I call "blocking.interrupt()"), nothing happens... no exception is thrown.. it just silently fails.
    Ok, so I suppose that we can not interrupt a remote thread.. that is fine. But what if I want to interrupt the RMI thread making the remote call? I don't want it to block forever. How can I "cancel" the remote call?
    Ideally, I would like the remote.blockingMethod() call to throw an InterruptException when I issue an "interrupt()" on the blocking thread. Any suggestions on how I might accomplish this?
    Thanks,
    Bryan

    While you can interrupt the RMI call, you cannot stop the active processing. That is, you cannot force a thread to stop (see the Java API documentation on Thread.stop().)
    Since the Client RMI call is a waiting thread, you need another Client thread to do a secondary RMI call. The trick is to have the new RMI endpoint connection thread on the RMI Server interrupt the original RMI endpoint connection thread.
    The only way you can interrupt an RMI call is to have the endpoint connection thread that runs on the RMI Server be aware that the user may wish to interrupt it.
    The best means of interruption is for the endpoint connection thread to use "worker threads". The endpoint connection thread waits for the workers to finish and is interruptible by both the workers and other endpoint connection threads.
    Another means of interruption is for the endpoint connection thread to segment the task into units of work and check for an interruption between those units of work.
    There are two ways I've done RMI call interruption.
    One is for the Client to pass a unique id (UID -- that uniquely identifies the request) to the Server with the original call. When the Client wishes to interrupt the original call, using the separate thread, it does a new RMI call to the Server passing the UID.
    The new endpoint connection thread, using the UID, interrupts the original endpoint connection thread.
    The major problem with this is the unique id. It absolutely, positively must be unique. Otherwise you run the risk of Client_A purging Client_B's request.
    The second method requires callback. If your Client is behind a firewall then RMI callback is near impossible. In such a case you must come up with a way for the Server to call the Client that is secure (the firewall problem.)
    The Client must export a remote object and pass that remote object to the Server with the original call.
    The endpoint connection thread recognizes the remote object and does a call back to the Client passing information that uniquely identifies itself (UID). Since the Server generates the UID, it can guarantee uniqueness.
    The Client callback implementation runs as a separate thread since the Client is in fact an RMI Server itself (when it did the export.) The Client must save the UID. The Client must start a new thread for the interrupt procedure or inform a waiting thread that the Server called back.
    Just like method one, above, when the Client wishes to interrupt the original call, using the separate thread, it does a new RMI call to the Server passing the UID.
    The new endpoint connection thread, using the UID, interrupts the original endpoint connection thread. Simple.
    For an academic example using call back go over to Jini.org. They have an example called "Cancellation" at:
    http://starterkit-examples.jini.org/
    For a professional, open source implementation of both these methods go over to CoopSoft.com. The Tymeac (Java) projects support canceling both waiting and autonomous requests at:
    http://www.coopsoft.com/JavaProduct.html

Maybe you are looking for

  • Why is the "Sign-in" for iCloud dimmed in settings?

    Had to restore my iPad 2 and when clicking on Settings>iCloud the "Sign-in" is dimmed.  Only "Forgot Apple ID or Password" and "Create a new Apple ID" is shown.  I know my Apple ID and password but can't enter this data.  Everything else has worked f

  • Error installing BAM tp4 in ubuntu how to correct?

    Hello I m trying to install BAM tp4 in Ubuntu and I m getting this error and I dont know how to deal with that because I m very new using Ubuntu. [echo] Changing oc4j ports with following values: HTTP Port : 8988 -> 8988 RMI Port : 23891 -> 23891 RMI

  • How can I format my computer?, How can I format my computer?

    So my computer is super slow lately and I have been trying to figure out why. It has all the new updates. I wanted to try to fully reformat it and see if that will correct the problem.

  • "Shutting down" Freeze

    Have black screen with the words "Shutting down" on it.  What can I do to fix this?

  • Adobe Captivate Quiz Results - Grading

    Hi All, I was wondering if anyone can help me with the quiz feature of captivate. I have created a quiz with a dozen questions, there is also a results slide which works fine. What i need is the user to be given a grade based on these results. Eg. If