Need an idea in threads

Dear all, hello.
Would someone tell me how the following is done?
MyThread is a class that extends Thread.
MyThread t1 = new MyThread().start();
MyThread t2 = new MyThread().start();
// Wait until EITHER t1 or t2 returns.
//Execute the rest of the program.
How that waiting part can be done?
Using
t1.join();
t2.join();
will wait for both threads to return.
But I need to proceed as soon as one of them completes its run() method.
Thank you.

.. but you need to make sure the lock is the same you use for wait(), so maybe something more like
public static final Object LOCK = new Object();
t1.start();
t2.start();
synchronized(LOCK) {
LOCK.wait();
run() {
synchronized(LOCK) {   
LOCK.notify(); //or notifyAll
see also http://java.sun.com/docs/books/tutorial/essential/threads/index.html

Similar Messages

  • I need some idea for my last project about Java

    Hi my name is suzanna from Indonesia. I have lots of interest with Java programming and I want make something about it for my last project. It's very important and I need some idea...could u give me some topic? I'm sorry if my english is very bad.thx,bye

    Here's some popular ideas:
    image steganography, chat client/server, spyware, client/server file transfer, forum content management/enforcement, anything with reflection, anything with communicating with an external device such as camera or modem or robot, writing your own replacement for the java.util.Calendar class, anything with custom class loaders, splitting a string into a string[]
    And for an extra challenge:
    dominition-based repetition, implementing a JVM which represents 'null' values internally using some other integer value than 0

  • Need some Idea for my final year project to increase buffer size

    hi...i need some idea from someone to give some idea, advice or some excersice/toturial about " how to increase buffer size" on my final year project, i have try find the solution..but it's still have problem on my oscilloscope.VI. I was design my final year project using LabVIEW 8.6 and now i state my design for someone to refer my project.
    Thank You  
    Attachments:
    Oscilloscope A.llb ‏166 KB

    Don't know if this is what you're searching for, and I don't know if there is such a function in LV 8.6, but I'm using LV 2010 and under DAQmx Pallete, you go to "Advanced Task Options", there is a function "Configure Output Buffer", in which you can configure the buffer size you want.

  • Need help with java thread program

    Hi
    I have an applet which does some painting etc, i need to write a thread which runs in background, and if there is no user activity for 30 min will refresh the screen.
    I have one good thing that all user options go from one program so i know when user does some thing.
    How do i write this thread program?
    1. I need this program to start counter as soon as some activity is done by user
    2. When user does some thing stop this thread
    3. when user completes his action restart the thread with 30 min timer.
    4. when there is no activity for 30 min refresh the screen
    Any help will be really good
    Ashish

    Not sure what the problem is. Your pseudo code looks good to me.
    The only suggestion I would make is that your use a Timer so you don't have to worry about creating your own Thread. You schedule a Timer to fire in 30 minutes. Everytime you have activiity you cancel the timer and reschedule it.

  • I need some ideas

    I do not know if this is the right place to ask for but i need some ideas and help.I need to work on a project to develop a Web Service, that receives data from 2 remote machines at different places , compare them and then return the result to first one.I am not a good java programmer so could anybody tell me please which part of the Java i must learn and what areother topics i must know.
    thanks

    Well I would say:
    Java Server Pages + Struts
    and maybe even
    J2EEJSP/Struts are probably unnecessary for this project. Other J2EE (a superset of JSP/Struts) may be overkill as well, depending your needs. I'd recommend starting here:
    The Java™ Tutorial - Lesson: All About Sockets
    Sockets programming in Java: A tutorial
    If, however, you're "not a good Java programmer", network programming may be a bit challenging, and you may want to start at a lower level of difficulty before diving in. To that end, I recommend the following resources:
    The Java™ Tutorial - A practical guide for programmers
    Essentials, Part 1, Lesson 1: Compiling & Running a Simple Program
    New to Java Center
    How To Think Like A Computer Scientist
    Introduction to Computer Science using Java
    The Java Developers Almanac 1.4
    JavaRanch: a friendly place for Java greenhorns
    jGuru
    Bruce Eckel's Thinking in Java
    Joshua Bloch's Effective Java
    Bert Bates and Kathy Sierra's Head First Java

  • Need some help killing threads (not in the way already mentioned..)

    I have read the ways in which we should safely kill a thread - and for the most part i understand that. But my question is HOW to implement it in the way that I need.
    Basically I have a multithreaded (ewww) app that really is a large job scheduler running 24/7. It can run anywhere from 1 to 15 jobs at a given time. This is fine. What i need is to have the ability to 'kill' a job when I need to. When the app daemon decides its time to run a certain job (based on business logic) it kicks one off, which is a class I made that implements Runnable.
    public class SchedulerProcessThread extends SOQBase implements Runnable{}
    when its time to start a job i do the usual:
    SchedulerProcessThread spt = new SchedulerProcessThread(blah);
    Thread t = new Thread(spt, "fooname");
    t.start();
    Now, this comes to my problem of where/how to kill the job (if needed). A SchedulerProcessThread is linear and finite so it will always have a termination point - it never loops. And when one is kicked off - i do not have a reference to it anymore - I mean, I couldnt if i am constantly running new jobs, potentially hundreds every hour. And jobs can be started in various places in the app, depending upon whether others are already running, etc.
    I wish to implement the do-while (alive) logic on the job thread. So in the 'run()' method of my SPT class, I would like the:
    while (alive) {
    doProcessing();
    But how can i invoke a method on my class [SPT] so that it changes the alive var from true to false when i do not have a reference to it?
    As a side note, I have a command prompt on the app whereby i can call up all the running 'jobs' which is a list of the running threads under a threadgroup called 'soqjob' (all new Threads that are started with a passing param of and SPT object are under the 'soqjob' threadgroup). So now i can see all those 'soqjob' threads which are currently running Thread objects that have been passed new instances of an SPT class.
    Is there anyway i can grab the 'soqjob' thread of my choice and somehow access my SPT class that was originally passed to it in the Thread constructor? if so, then I could pass in the command to stop the do-while loop.
    Hmm - does any of this make sense? If i can sum up, the problem is i do not know how to access my own SPT class once I have passed it into a thread object and invoked that thread object's 'start()' method. if i can do that, then i can switch the ALIVE var from true to false and thereby kill the SPT job i need.
    Any ideas?
    Many thanks
    Ian

    I would add a Collection (synchronized) to the Scheduler that holds a reference to all the Processes. Pass a reference of the Scheduler to the Processes so that when a Process is done, it can remove itself from the Collection.
    public class Scheduler {
         private Collection threads;
         public void addProcess() {
              Runnable runnable = new ProcessThread(this);
              Thread thread = new Thread(runnable);
              thread.start();
              threads.add(thread);
         public void removeProcess(ProcessThread thread) {
              threads.remove(thread);
         private Thread getSelectedThread(Component c) {
              //Find Thread in Collection and return it
         private class Action implements ActionListener {
              public void actionPerformed(ActionEvent e) {
                   Thread thread = getSelectedThread(e.getSource());
                   thread.interrupt();
    class ProcessThread extends ... implements Runnable {
         private Scheduler scheduler;
         public ProcessThread(Scheduler s) {
              this.scheduler = s;
         public void run() {
              while (!Thread.interrupted()) {
                   try {
                        doProcessing();
                        Thread.yield();     //Give the other Threads a chance to do some work
                   } catch (InterruptedException e) {
                        Thread.currentThread().interrupt();
              this.scheduler.removeProcess(this);     //Remove this Thread from the Scheduler's Collection
    }Did you consider using the classes java.util.Timer and java.util.TimerTask?

  • Need some help with threads...

    Hello all,
    I am working on a project at work, and I am not the best programmer in the world. I have been trying to get my head around this for a couple of days and just cannot get it to work.
    I am writing an instrumentation control program that will have three threads. One is the GUI, one will receive control information and set up the hardware, and one will check the hardware status and report it to the GUI periodically. I plan on using the invokeLater() method to communicate the status to the GUI and change the status display in the GUI. Communication from the GUI to the controller thread and from the status thread to the controller thread I had planned on being piped input/output stream as appropriate. I have a control class and a status class that need to be communicated over these piped streams. In some trial code I have been unable to wrap the piped input/output streams with object input/output streams. I really need some help with this. Here is the main thread code:
    package playingwiththreads1;
    import java.io.*;*
    *public class PlayingWithThreads1 {*
    public static void main(String[] args) {*
    * PipedOutputStream outputPipe = new PipedOutputStream();*
    * ObjectOutputStream oos = null;*
    * ReceiverThread rt = new ReceiverThread(outputPipe);*
    // Start the thread -- First try*
    * Thread t = new Thread(rt);*
    t.start();*
    // Wrap the output pipe with an ObjectOutputStream*
    try*
    oos = new ObjectOutputStream(outputPipe);*
    catch (IOException e)*
    System.out.println(e);*
    // Start the thread -- Second try*
    //Thread t = new Thread(rt);*
    //t.start();*
    /** Send an object over the pipe. In reality this object will be a
    class that contains control or status information */
    try
    if (!oos.equals(null))
    oos.writeObject(new String ("Test"));
    catch (IOException e)
    try
    Thread.sleep(5000);
    catch (InterruptedException e)
    I read somewhere that it matters where you start the thread relative to where you wrap piped streams with the object streams. So, I tried the two places I felt were obvious to start the thread. These are noted in the comments. Here is the code for the thread.
    package playingwiththreads1;
    import java.io.*;
    public class ReceiverThread implements Runnable {
    private PipedInputStream inputPipe = new PipedInputStream();
    private ObjectInputStream inputObject;
    ReceiverThread (PipedOutputStream outputPipe)
    System.out.println("Thread initialization - start");
    try
    inputPipe.connect(outputPipe);
    inputObject = new ObjectInputStream(inputPipe);
    catch (IOException e)
    System.out.println(e);
    System.out.println("Thread initialization - complete");
    public void run()
    System.out.println("Thread started");
    try
    if (inputObject.available() > 0)
    System.out.println(inputObject.read());
    catch (IOException e)
    System.out.println(e);
    Through testing I have determined that no matter where I start the thread, the thread never gets past the "inputObject = new ObjectInputStream(inputPipe);" assignment.
    Could someone please help me with this? There are other ways for me to write this program, but this is the one that I would like to make work.
    Many thanks in advance,
    Rob Hix
    Edited by: RobertHix on Oct 6, 2009 3:54 AM

    Thanks for the help, but that did not work. I tried flushing the ObjectOutputStream and it is still hanging when initializing the thread.
    Here is a better look at the code since I was helped to figure out how to insert it:
    The main method:
    package playingwiththreads1;
    import java.io.*;
    public class PlayingWithThreads1 {
        public static void main(String[] args) {
            PipedOutputStream outputPipe = new PipedOutputStream();
            ObjectOutputStream oos = null;
            ReceiverThread rt = new ReceiverThread(outputPipe);
            // Start the thread -- First try
            //Thread t = new Thread(rt);
            //t.start();
            // Wrap the output pipe with an ObjectOutputStream
            try
                oos = new ObjectOutputStream(outputPipe);
                oos.flush();
            catch (IOException e)
                System.out.println(e);
            // Start the thread -- Second try
            Thread t = new Thread(rt);
            t.start();
            /* Send an object over the pipe.  In reality this object will be a
             * class that contains control or status information */
            try
                if (!oos.equals(null))
                    oos.writeObject(new String ("Test"));
                    oos.flush();
            catch (IOException e)
                System.out.pringln(e);
            try
                Thread.sleep(5000);
            catch (InterruptedException e)
    }The thread code:
    package playingwiththreads1;
    import java.io.*;
    public class ReceiverThread implements Runnable {
        private PipedInputStream inputPipe = new PipedInputStream();
        private ObjectInputStream inputObject;
        ReceiverThread (PipedOutputStream outputPipe)
            System.out.println("Thread initialization - start");
            try
                inputPipe.connect(outputPipe);
                inputObject = new ObjectInputStream(inputPipe);
            catch (IOException e)
                System.out.println(e);
            System.out.println("Thread initialization - complete");
        public void run()
            System.out.println("Thread started");
            try
                if (inputObject.available() > 0)
                    System.out.println(inputObject.read());
            catch (IOException e)
                System.out.println(e);
    }Does anyone else have and ideas?

  • Need help with STUCK Threads.  What's causing them?

    In our production environment, we have a soa suite cluster with 3 nodes. All 3 of the servers keep turning up stuck and hogging threads, and eventually they all grind to a halt where I can't even view composite instances through em. There is a bpel process that is using a dbadapter to poll for records every 5 seconds and then performs some service call outs and other dbadapters. This process is generating thousands of instances a day and I think it is the culprit. If I view the logs, I see one of the dbadapters that it calls out to fails occasionally with a PK violation. I looked at the developer's code, and they have no error handling in the process at all. In the logs, there will the a hit for the PK violation, then about 10 minutes later the a STUCK thread gets logged(the configured timeout is 600 seconds, or 10 minutes). Would not handling an error in a BPEL process hog/STUCK a thread? I need to be able to show what code is causing the issue so I can have a resolution path.
    I also see a note in the trace about something holding a lock:
    Holding lock: oracle.jdbc.driver.T4CConnection@1fbc3486[thin lock]....would that be an un-rolled back transaction?
    Here is the dump of the STUCK thread. Any help is greatly appreciated. Thanks!
    <Aug 5, 2011 10:30:02 AM EDT> <Error> <WebLogicServer> <BEA-000337> <[STUCK] ExecuteThread: '64' for queue: 'weblogic.kernel.Default (self-tuning)' has been busy for "634" seconds working on the request "oracle.soa.management.internal.ejb.impl.FacadeFinderBean_4vacyo_FacadeFinderBeanImpl", which is more than the configured time (StuckThreadMaxTime) of "600" seconds. Stack trace:
    Thread-517 "[STUCK] ExecuteThread: '64' for queue: 'weblogic.kernel.Default (self-tuning)'" <alive, in native, suspended, priority=1, DAEMON> {
    jrockit.net.SocketNativeIO.readBytesPinned(SocketNativeIO.java:???)
    jrockit.net.SocketNativeIO.socketRead(SocketNativeIO.java:24)
    java.net.SocketInputStream.socketRead0(SocketInputStream.java:???)
    java.net.SocketInputStream.read(SocketInputStream.java:107)
    oracle.net.nt.MetricsEnabledInputStream.read(TcpNTAdapter.java:553)
    oracle.net.ns.Packet.receive(Packet.java:249)
    oracle.net.ns.DataPacket.receive(DataPacket.java:94)
    oracle.net.ns.NetInputStream.getNextPacket(NetInputStream.java:168)
    oracle.net.ns.NetInputStream.read(NetInputStream.java:113)
    oracle.net.ns.NetInputStream.read(NetInputStream.java:96)
    oracle.net.ns.NetInputStream.read(NetInputStream.java:81)
    oracle.jdbc.driver.T4CSocketInputStreamWrapper.readNextPacket(T4CSocketInputStreamWrapper.java:120)
    oracle.jdbc.driver.T4CSocketInputStreamWrapper.read(T4CSocketInputStreamWrapper.java:75)
    oracle.jdbc.driver.T4CMAREngine.unmarshalUB1(T4CMAREngine.java:1081)
    oracle.jdbc.driver.T4CMAREngine.unmarshalSB1(T4CMAREngine.java:1062)
    oracle.jdbc.driver.T4C8Oall.receive(T4C8Oall.java:588)
    oracle.jdbc.driver.T4CPreparedStatement.doOall8(T4CPreparedStatement.java:70)
    oracle.jdbc.driver.T4CPreparedStatement.executeForDescribe(T4CPreparedStatement.java:854)
    oracle.jdbc.driver.T4CPreparedStatement.executeMaybeDescribe(T4CPreparedStatement.java:918)
    oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:1252)
    oracle.jdbc.driver.OraclePreparedStatement.executeInternal(OraclePreparedStatement.java:3541)
    oracle.jdbc.driver.OraclePreparedStatement.executeQuery(OraclePreparedStatement.java:3605)
    ^-- Holding lock: oracle.jdbc.driver.T4CConnection@1fbc3486[thin lock]
    oracle.jdbc.driver.OraclePreparedStatementWrapper.executeQuery(OraclePreparedStatementWrapper.java:1667)
    weblogic.jdbc.wrapper.PreparedStatement.executeQuery(PreparedStatement.java:123)
    org.eclipse.persistence.internal.databaseaccess.DatabaseAccessor.executeSelect(DatabaseAccessor.java:887)
    org.eclipse.persistence.internal.databaseaccess.DatabaseAccessor.basicExecuteCall(DatabaseAccessor.java:541)
    org.eclipse.persistence.internal.databaseaccess.DatabaseAccessor.executeCall(DatabaseAccessor.java:530)
    org.eclipse.persistence.sessions.server.ServerSession.executeCall(ServerSession.java:521)
    org.eclipse.persistence.internal.queries.DatasourceCallQueryMechanism.executeCall(DatasourceCallQueryMechanism.java:202)
    org.eclipse.persistence.internal.queries.DatasourceCallQueryMechanism.executeCall(DatasourceCallQueryMechanism.java:192)
    org.eclipse.persistence.internal.queries.DatasourceCallQueryMechanism.executeSelectCall(DatasourceCallQueryMechanism.java:254)
    org.eclipse.persistence.internal.queries.DatasourceCallQueryMechanism.executeSelect(DatasourceCallQueryMechanism.java:245)
    org.eclipse.persistence.queries.DataReadQuery.executeNonCursor(DataReadQuery.java:188)
    org.eclipse.persistence.queries.DataReadQuery.executeDatabaseQuery(DataReadQuery.java:141)
    org.eclipse.persistence.queries.DatabaseQuery.execute(DatabaseQuery.java:603)
    org.eclipse.persistence.queries.DataReadQuery.execute(DataReadQuery.java:115)
    org.eclipse.persistence.queries.DatabaseQuery.executeInUnitOfWork(DatabaseQuery.java:589)
    org.eclipse.persistence.internal.sessions.UnitOfWorkImpl.internalExecuteQuery(UnitOfWorkImpl.java:2898)
    org.eclipse.persistence.internal.sessions.AbstractSession.executeQuery(AbstractSession.java:1218)
    org.eclipse.persistence.internal.sessions.AbstractSession.executeQuery(AbstractSession.java:1190)
    org.eclipse.persistence.internal.sessions.AbstractSession.executeQuery(AbstractSession.java:1176)
    org.eclipse.persistence.internal.jpa.EJBQueryImpl.executeReadQuery(EJBQueryImpl.java:378)
    org.eclipse.persistence.internal.jpa.EJBQueryImpl.getSingleResult(EJBQueryImpl.java:701)
    weblogic.deployment.TransactionalEntityManagerProxyImpl$QueryImpl.getSingleResult(TransactionalEntityManagerProxyImpl.java:232)
    com.collaxa.cube.persistence.dao.impl.jpa.JpaCubeInstanceDaoImpl.getNumberOfInstances(JpaCubeInstanceDaoImpl.java:439)
    oracle.fabric.CubeServiceEngine.getNumberOfComponentInstances(CubeServiceEngine.java:1962)
    oracle.soa.management.internal.ejb.impl.FacadeFinderBeanImpl.getNumberOfComponentInstances(FacadeFinderBeanImpl.java:1618)
    oracle.soa.management.internal.ejb.impl.FacadeFinderBeanImpl.getComponentSnapShot(FacadeFinderBeanImpl.java:1653)
    sun.reflect.GeneratedMethodAccessor5852.invoke(Unknown Source)
    sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    java.lang.reflect.Method.invoke(Method.java:575)
    com.bea.core.repackaged.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:309)
    com.bea.core.repackaged.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:182)
    com.bea.core.repackaged.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:148)
    com.bea.core.repackaged.springframework.jee.intercept.MethodInvocationInvocationContext.proceed(MethodInvocationInvocationContext.java:104)
    oracle.security.jps.ee.ejb.JpsAbsInterceptor$1.run(JpsAbsInterceptor.java:88)
    oracle.security.jps.util.JpsSubject.doAsPrivileged(JpsSubject.java:299)
    oracle.security.jps.ee.util.JpsPlatformUtil.runJaasMode(JpsPlatformUtil.java:406)
    oracle.security.jps.wls.JpsWeblogicEjbInterceptor.runJaasMode(JpsWeblogicEjbInterceptor.java:61)
    oracle.security.jps.ee.ejb.JpsAbsInterceptor.intercept(JpsAbsInterceptor.java:81)
    oracle.security.jps.ee.ejb.JpsInterceptor.intercept(JpsInterceptor.java:101)
    sun.reflect.GeneratedMethodAccessor863.invoke(Unknown Source)
    sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    java.lang.reflect.Method.invoke(Method.java:575)
    com.bea.core.repackaged.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:309)
    com.bea.core.repackaged.springframework.jee.intercept.JeeInterceptorInterceptor.invoke(JeeInterceptorInterceptor.java:66)
    com.bea.core.repackaged.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:148)
    com.bea.core.repackaged.springframework.aop.support.DelegatingIntroductionInterceptor.doProceed(DelegatingIntroductionInterceptor.java:131)
    com.bea.core.repackaged.springframework.aop.support.DelegatingIntroductionInterceptor.invoke(DelegatingIntroductionInterceptor.java:102)
    com.bea.core.repackaged.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:148)
    com.bea.core.repackaged.springframework.jee.spi.MethodInvocationVisitorImpl.visit(MethodInvocationVisitorImpl.java:37)
    weblogic.ejb.container.injection.EnvironmentInterceptorCallbackImpl.callback(EnvironmentInterceptorCallbackImpl.java:22)
    com.bea.core.repackaged.springframework.jee.spi.EnvironmentInterceptor.invoke(EnvironmentInterceptor.java:49)
    com.bea.core.repackaged.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:148)
    com.bea.core.repackaged.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:86)
    com.bea.core.repackaged.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:148)
    com.bea.core.repackaged.springframework.aop.support.DelegatingIntroductionInterceptor.doProceed(DelegatingIntroductionInterceptor.java:131)
    com.bea.core.repackaged.springframework.aop.support.DelegatingIntroductionInterceptor.invoke(DelegatingIntroductionInterceptor.java:102)
    com.bea.core.repackaged.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:148)
    com.bea.core.repackaged.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:151)
    $Proxy309.getComponentSnapShot(Unknown Source)
    oracle.soa.management.internal.ejb.impl.FacadeFinderBean_4vacyo_FacadeFinderBeanImpl.getComponentSnapShot(FacadeFinderBean_4vacyo_FacadeFinderBeanImpl.java:1604)
    oracle.soa.management.internal.ejb.impl.FacadeFinderBean_4vacyo_FacadeFinderBeanImpl_WLSkel.invoke(Unknown Source)
    weblogic.rmi.internal.BasicServerRef.invoke(BasicServerRef.java:567)
    weblogic.rmi.internal.BasicServerRef$1.run(BasicServerRef.java:477)
    weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:350)
    weblogic.security.service.SecurityManager.runAs(SecurityManager.java:143)
    weblogic.rmi.internal.BasicServerRef.handleRequest(BasicServerRef.java:425)
    weblogic.rmi.internal.wls.WLSExecuteRequest.run(WLSExecuteRequest.java:117)
    weblogic.work.ExecuteThread.execute(ExecuteThread.java:198)
    weblogic.work.ExecuteThread.run(ExecuteThread.java:165)
    >
    <Aug 5, 2011 10:30:02 AM EDT> <Notice> <Diagnostics> <BEA-320068> <Watch 'StuckThread' with severity 'Notice' on server 'soa_server1' has triggered at Aug 5, 2011 10:30:02 AM EDT. Notification details:
    WatchRuleType: Log
    WatchRule: (SEVERITY = 'Error') AND (MSGID = 'BEA-000337')
    WatchData: DATE = Aug 5, 2011 10:30:02 AM EDT SERVER = soa_server1 MESSAGE = [STUCK] ExecuteThread: '64' for queue: 'weblogic.kernel.Default (self-tuning)' has been busy for "634" seconds working on the request "oracle.soa.management.internal.ejb.impl.FacadeFinderBean_4vacyo_FacadeFinderBeanImpl", which is more than the configured time (StuckThreadMaxTime) of "600" seconds. Stack trace:
    Thread-517 "[STUCK] ExecuteThread: '64' for queue: 'weblogic.kernel.Default (self-tuning)'" <alive, in native, suspended, priority=1, DAEMON> {
    jrockit.net.SocketNativeIO.readBytesPinned(SocketNativeIO.java:???)
    jrockit.net.SocketNativeIO.socketRead(SocketNativeIO.java:24)
    java.net.SocketInputStream.socketRead0(SocketInputStream.java:???)
    java.net.SocketInputStream.read(SocketInputStream.java:107)
    oracle.net.nt.MetricsEnabledInputStream.read(TcpNTAdapter.java:553)
    oracle.net.ns.Packet.receive(Packet.java:249)
    oracle.net.ns.DataPacket.receive(DataPacket.java:94)
    oracle.net.ns.NetInputStream.getNextPacket(NetInputStream.java:168)
    oracle.net.ns.NetInputStream.read(NetInputStream.java:113)
    oracle.net.ns.NetInputStream.read(NetInputStream.java:96)
    oracle.net.ns.NetInputStream.read(NetInputStream.java:81)
    oracle.jdbc.driver.T4CSocketInputStreamWrapper.readNextPacket(T4CSocketInputStreamWrapper.java:120)
    oracle.jdbc.driver.T4CSocketInputStreamWrapper.read(T4CSocketInputStreamWrapper.java:75)
    oracle.jdbc.driver.T4CMAREngine.unmarshalUB1(T4CMAREngine.java:1081)
    oracle.jdbc.driver.T4CMAREngine.unmarshalSB1(T4CMAREngine.java:1062)
    oracle.jdbc.driver.T4C8Oall.receive(T4C8Oall.java:588)
    oracle.jdbc.driver.T4CPreparedStatement.doOall8(T4CPreparedStatement.java:70)
    oracle.jdbc.driver.T4CPreparedStatement.executeForDescribe(T4CPreparedStatement.java:854)
    oracle.jdbc.driver.T4CPreparedStatement.executeMaybeDescribe(T4CPreparedStatement.java:918)
    oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:1252)
    oracle.jdbc.driver.OraclePreparedStatement.executeInternal(OraclePreparedStatement.java:3541)
    oracle.jdbc.driver.OraclePreparedStatement.executeQuery(OraclePreparedStatement.java:3605)
    ^-- Holding lock: oracle.jdbc.driver.T4CConnection@1fbc3486[thin lock]
    oracle.jdbc.driver.OraclePreparedStatementWrapper.executeQuery(OraclePreparedStatementWrapper.java:1667)
    weblogic.jdbc.wrapper.PreparedStatement.executeQuery(PreparedStatement.java:123)
    org.eclipse.persistence.internal.databaseaccess.DatabaseAccessor.executeSelect(DatabaseAccessor.java:887)
    org.eclipse.persistence.internal.databaseaccess.DatabaseAccessor.basicExecuteCall(DatabaseAccessor.java:541)
    org.eclipse.persistence.internal.databaseaccess.DatabaseAccessor.executeCall(DatabaseAccessor.java:530)
    org.eclipse.persistence.sessions.server.ServerSession.executeCall(ServerSession.java:521)
    org.eclipse.persistence.internal.queries.DatasourceCallQueryMechanism.executeCall(DatasourceCallQueryMechanism.java:202)
    org.eclipse.persistence.internal.queries.DatasourceCallQueryMechanism.executeCall(DatasourceCallQueryMechanism.java:192)
    org.eclipse.persistence.internal.queries.DatasourceCallQueryMechanism.executeSelectCall(DatasourceCallQueryMechanism.java:254)
    org.eclipse.persistence.internal.queries.DatasourceCallQueryMechanism.executeSelect(DatasourceCallQueryMechanism.java:245)
    org.eclipse.persistence.queries.DataReadQuery.executeNonCursor(DataReadQuery.java:188)
    org.eclipse.persistence.queries.DataReadQuery.executeDatabaseQuery(DataReadQuery.java:141)
    org.eclipse.persistence.queries.DatabaseQuery.execute(DatabaseQuery.java:603)
    org.eclipse.persistence.queries.DataReadQuery.execute(DataReadQuery.java:115)
    org.eclipse.persistence.queries.DatabaseQuery.executeInUnitOfWork(DatabaseQuery.java:589)
    org.eclipse.persistence.internal.sessions.UnitOfWorkImpl.internalExecuteQuery(UnitOfWorkImpl.java:2898)
    org.eclipse.persistence.internal.sessions.AbstractSession.executeQuery(AbstractSession.java:1218)
    org.eclipse.persistence.internal.sessions.AbstractSession.executeQuery(AbstractSession.java:1190)
    org.eclipse.persistence.internal.sessions.AbstractSession.executeQuery(AbstractSession.java:1176)
    org.eclipse.persistence.internal.jpa.EJBQueryImpl.executeReadQuery(EJBQueryImpl.java:378)
    org.eclipse.persistence.internal.jpa.EJBQueryImpl.getSingleResult(EJBQueryImpl.java:701)
    weblogic.deployment.TransactionalEntityManagerProxyImpl$QueryImpl.getSingleResult(TransactionalEntityManagerProxyImpl.java:232)
    com.collaxa.cube.persistence.dao.impl.jpa.JpaCubeInstanceDaoImpl.getNumberOfInstances(JpaCubeInstanceDaoImpl.java:439)
    oracle.fabric.CubeServiceEngine.getNumberOfComponentInstances(CubeServiceEngine.java:1962)
    oracle.soa.management.internal.ejb.impl.FacadeFinderBeanImpl.getNumberOfComponentInstances(FacadeFinderBeanImpl.java:1618)
    oracle.soa.management.internal.ejb.impl.FacadeFinderBeanImpl.getComponentSnapShot(FacadeFinderBeanImpl.java:1653)
    sun.reflect.GeneratedMethodAccessor5852.invoke(Unknown Source)
    sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    java.lang.reflect.Method.invoke(Method.java:575)
    com.bea.core.repackaged.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:309)
    com.bea.core.repackaged.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:182)
    com.bea.core.repackaged.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:148)
    com.bea.core.repackaged.springframework.jee.intercept.MethodInvocationInvocationContext.proceed(MethodInvocationInvocationContext.java:104)
    oracle.security.jps.ee.ejb.JpsAbsInterceptor$1.run(JpsAbsInterceptor.java:88)
    oracle.security.jps.util.JpsSubject.doAsPrivileged(JpsSubject.java:299)
    oracle.security.jps.ee.util.JpsPlatformUtil.runJaasMode(JpsPlatformUtil.java:406)
    oracle.security.jps.wls.JpsWeblogicEjbInterceptor.runJaasMode(JpsWeblogicEjbInterceptor.java:61)
    oracle.security.jps.ee.ejb.JpsAbsInterceptor.intercept(JpsAbsInterceptor.java:81)
    oracle.security.jps.ee.ejb.JpsInterceptor.intercept(JpsInterceptor.java:101)
    sun.reflect.GeneratedMethodAccessor863.invoke(Unknown Source)
    sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    java.lang.reflect.Method.invoke(Method.java:575)
    com.bea.core.repackaged.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:309)
    com.bea.core.repackaged.springframework.jee.intercept.JeeInterceptorInterceptor.invoke(JeeInterceptorInterceptor.java:66)
    com.bea.core.repackaged.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:148)
    com.bea.core.repackaged.springframework.aop.support.DelegatingIntroductionInterceptor.doProceed(DelegatingIntroductionInterceptor.java:131)
    com.bea.core.repackaged.springframework.aop.support.DelegatingIntroductionInterceptor.invoke(DelegatingIntroductionInterceptor.java:102)
    com.bea.core.repackaged.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:148)
    com.bea.core.repackaged.springframework.jee.spi.MethodInvocationVisitorImpl.visit(MethodInvocationVisitorImpl.java:37)
    weblogic.ejb.container.injection.EnvironmentInterceptorCallbackImpl.callback(EnvironmentInterceptorCallbackImpl.java:22)
    com.bea.core.repackaged.springframework.jee.spi.EnvironmentInterceptor.invoke(EnvironmentInterceptor.java:49)
    com.bea.core.repackaged.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:148)
    com.bea.core.repackaged.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:86)
    com.bea.core.repackaged.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:148)
    com.bea.core.repackaged.springframework.aop.support.DelegatingIntroductionInterceptor.doProceed(DelegatingIntroductionInterceptor.java:131)
    com.bea.core.repackaged.springframework.aop.support.DelegatingIntroductionInterceptor.invoke(DelegatingIntroductionInterceptor.java:102)
    com.bea.core.repackaged.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:148)
    com.bea.core.repackaged.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:151)
    $Proxy309.getComponentSnapShot(Unknown Source)
    oracle.soa.management.internal.ejb.impl.FacadeFinderBean_4vacyo_FacadeFinderBeanImpl.getComponentSnapShot(FacadeFinderBean_4vacyo_FacadeFinderBeanImpl.java:1604)
    oracle.soa.management.internal.ejb.impl.FacadeFinderBean_4vacyo_FacadeFinderBeanImpl_WLSkel.invoke(Unknown Source)
    weblogic.rmi.internal.BasicServerRef.invoke(BasicServerRef.java:567)
    weblogic.rmi.internal.BasicServerRef$1.run(BasicServerRef.java:477)
    weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:350)
    weblogic.security.service.SecurityManager.runAs(SecurityManager.java:143)
    weblogic.rmi.internal.BasicServerRef.handleRequest(BasicServerRef.java:425)
    weblogic.rmi.internal.wls.WLSExecuteRequest.run(WLSExecuteRequest.java:117)
    weblogic.work.ExecuteThread.execute(ExecuteThread.java:198)
    weblogic.work.ExecuteThread.run(ExecuteThread.java:165)
    SUBSYSTEM = WebLogicServer USERID = <WLS Kernel> SEVERITY = Error THREAD = [ACTIVE] ExecuteThread: '96' for queue: 'weblogic.kernel.Default (self-tuning)' MSGID = BEA-000337 MACHINE = soaprod TXID = CONTEXTID = f5d0b85a929630a2:6eada0f7:1304e0a2bdc:-7ffb-00000000017e1605 TIMESTAMP = 1312554602698
    WatchAlarmType: AutomaticReset
    WatchAlarmResetPeriod: 600000
    >
    Edited by: Brutus35 on Aug 5, 2011 8:04 AM

    my impression is that you have trouble on the DB,
    monitor the sessions to see if there is some table locked, and increase the number of processes on the DB
    you can use SQLDeveloper for that
    anyway your TX should rollback after some time, check that you have a timeout in place, it's better to rollback a TX than having the entire server crash

  • Help needed in recovering 2 threaded db

    Here we go, I had this working while ago, I have taken a backup of a db, full backup, all successful, this backup had 2 threads. Now the recovery.
    I recovered the controlfile, then recoevered the database like below,
    SET UNTIL SEQUENCE 3543 thread 2;
    recocer database;
    restore database;
    but I keep getting system file will be old if reset logs??
    I got the sequence from the highest seq by doing list backup of archivelogs. I chose the seq + 1.
    No idea what to do now.

    Hi kt1,
    First restore than recover.
    Can you try:
    SET UNTIL SEQUENCE 3543 thread 2;
    restore database;
    recover database;
    Regards,
    Tycho

  • Problem with check box need an idea

    hello i need some help.
    i am tring to make a attendence register as an assignment. what i am tring to do is that i can add student name in a file and then retrive them from a file and then mark there presents or absents.the part i cant get done is how do i mark the attendence. i want to display name and then the teacher can just click in the check box infront of the name to mark the present and when he clicks on the save button it would save the attendence in the file.
    now the problem is the check box have to increase and decrease if a name is add or deleted in the file
    SO does any one have any ideas what i can do to solve this problem

    lets suppose your file contains student name which are seperted by comma or space (what ever).then u can read it and open stringtokenizer with delimater you used to seperate names.count the number of tokens and create your check box on the count of tokens.There may be some good idea too and if any one have i would like to know.

  • MBP 13" womens case needed any ideas?

    it's for a gift for my wife... I was going to get a simple silicone case but I realized we travel a lot and she would need something she can carry with shoulder strap or handle..., the typical black leather cases are too masculine...
    Anyone have any other ideas? not looking to spend too much......

    Check these out for many choices of pretty, "feminine" bags:
    http://mobileoffice.about.com/od/packingyourmobilegear/tp/womensbags.htm
    http://www.squidoo.com/laptopbag
    http://www.coolcomputerbags.com/womens-laptop-bags
    Some are expensive, but there are also plenty on sale for around $50.

  • Need some idea on MDM,BI

    Hi Guys,
    we are planning to develop application using BI and MDM .Currently we are focusing on sustainiability thing but want some more.
    I just want you to share yr thoughts that help us developing more meaningful application .
    Just share  what  basic problem you are facing or what you want to enhance or what new application you want  on MDM and BI or any one of them.
    Please share your ideas.
    Thanks,
    Sudhanshu

    Hi markus,
    Thanks for answering my queation.
    Yes currently we are doing analysis on master data consolidation.
    This is small idea.
    We are trying to gather  suggestion from the guys on community  that what actually the problems they are facing and need solution on the problems above on MDM and BI or anyone.
    Like  we  have a requirement  give the supplier  a application that accpet the data from supplier  and before importing it to mdm first validate  the whole file and then import it as there is no solution to first validate the  the data provided by supplier that they are giving.
    so we are working on this application also.
    If you have any  good idea that we can work on it then please share with us.
    Thanks,
    Sudhanshu

  • Need help with the threads concept in java

    i need a good explanation for the threads concept in java.Explanation with an example would be better.

    JosAH wrote:
    BIJ001 wrote:
    Java still can't process them in real time because of its garbage collector.So real-time java is not conceivable \qu.e.d
    http://java.sun.com/javase/technologies/realtime/index.jsp
    http://jcp.org/en/jsr/detail?id=282
    Is that implementation ready yet? The first link talks about 'more real time'; that garbage collector really is a burden when it comes to the real ticks ...
    kind regards,
    JosSpoon!

  • Need help stopping a thread

    I have a thread that starts a file download. I tried using the following.
    On the mouse click event of a button
    thread.interrupt();
    in the file download method
    if(!thread.isInterrupted())
    do stuff
    else
    thread.interrupted();
    The way it stands now, the file download stops and everything seems fine. But I cant restart the thread. I read something about having to return from the run method but I cant get that to work.
    Thanks,
    Jason

    interrupt is not a replacement for the deprecated stop. It performs interruption of waits and blocks. And sets a flag the next time the code in the thread hits a wait or block.
    Your if else logic is unsafe wrt the use of interrupt.
    You need to change the code to depend on a synchronized object with wait and notify
    For example in the thread follow the motionObject:
        public LocateSampleThread(AerotechWrapper aerotechWrapper, double xScale, double yScale, double zScale, double &#966;Scale)
            this.aerotechWrapper=aerotechWrapper;
            //this.xScale=xScale;
            //this.yScale=yScale;
            //this.zScale=zScale;
            //this.&#966;Scale=&#966;Scale;
            this.motionObject=new Object();
            alarmEventListeners=new java.util.Vector();
            recoveredAlarmEventListeners=new java.util.Vector();
        public void run()
            int loopCount=0;
            while(!abort)
                try
                    synchronized(motionObject)
                        motionObject.wait();
                        stop=false;
                    if(abort) break;
                    StateModel.getInstance().setState(StateModel.MOVING);
                    try
                        StateModel.getInstance().setActive(StateModel.MOVING,true);
                    catch(PropertyVetoException pve)
                    StateModel.getInstance().incrementActiveThreadCount();
                    System.out.println("LocateSampleThread "+StateModel.getInstance().getActiveThreadCount());
                catch(InterruptedException ie)
    ...do activity here.
                synchronized(motionObject)
                    motionObject.notify();
                try
                    StateModel.getInstance().setActive(StateModel.MOVING,false);
                catch(PropertyVetoException pve)
                StateModel.getInstance().clearState(StateModel.MOVING);
                StateModel.getInstance().decrementActiveThreadCount();
                sendStageMotionEvent (new StageMotionEvent (this, false));
        public void moveAndWait () throws InterruptedException
            synchronized (motionObject)
                motionObject.notify();
                motionObject.wait();
        public void moveAndDontWait ()
            synchronized (motionObject)
                motionObject.notify();
        protected Object motionObject=null;in the controlling code
                                    try
                                        locateSampleThread.moveAndWait();
                                        //System.out.println("locateSampleThread notify/wait done");
                                        sleep(100);
                                    catch(InterruptedException ie)
                                    }Notice that the in moveAndWait the notify and wait ion the motionObject inside a synchronized is safe threading because the controlling code that calls moveAndWait will be waiting even before the thread's run(which is synchronized as well) starts going from being notified.

  • Web developer needed (big idea)

    like the title say's that im(jims) looking for a gifted coders or a coder with a bunch of experince to help me build my idea from ground up. i have the basic tools that's needed, i also have the skills to run this idea. but i need to build the fire before i can cook right just a joke.but my idea is the next big thing and social media networks,the next facebook,the next twitter the next big thing to come yes you dont belive me but you think im joking hmm, yes but the difference between me and facebook i came up with this idea on my own. and im guessing you thinking he wanna build a social network and my answers is yes and no my idea is very simply i want to connect people ideas together.
    my dream goals is to connect people ideas and to share thems with the world or the buyers. yes i just said buyer because this idea is almost like a (buysellads.com/)
    where people connect through ads. funny right enough talks let me fully explain my idea.
    what i have done already
    bought domain
    and will buy hosting ( a cloud hosting so we can handle the traffic.)
    when you start as my coder i wont be able to financial pay you right away because im very low and income at the moment but this will all be changing soon
    as the coder of this company you will  have 20% of all shares and stock when it go viral.
    what will happen when you finish coding.
    i will take it from there and handle all the dirty work of ranking the website and making it go viral for 100s and 10000s.
    how will i do this
    i have 2years of seo experince and i also work as a freelancer back and the days ranking website and ranking lawyers website and firm website for extremly hard keywords.
    why i think you should code for us
    i belive you should consider coding for us because you never know what lie ahead you never know you could of be the one that made this dream come true because with  out a coder this wont work as it should and if it happen to be the next thing you be the one that help it get there.
    [Personal details deleted by moderator]

    Do you kmow where you are posting this?  This is Adobe Business Catalyst  http://www.ez-1.net/partner  See that video?  The coding is done.  The hosting is included.  All you need to do is sign up and upgrade your account within 30 days to add your domain and go from there.

Maybe you are looking for