Running the Thread while working in Foreground

Hi Friends,
I m developing an application for that i have to use Threads.
Currently i m using a single thread for Socket Connection.
It works fine and the connection establishes successfully. Also it sends &
receives data well.
But my problem is that if while establishing connection if it takes more time
on slow network and if user pressed any key then i want to place a message.
I m not using Servlets in my application.
It gives message but after the completion of the Thread's work.
I want it should happen immediately...after key pressed and Thread must be
working in background simultaneously.
If anybody have any idea then plz suggest me.
I'll be highly grateful to u people.
Thanking you,
Ajit

Hi Samir Pro,
Check out the Settings menu (Wrench). You can change the playback resolution there. Does that work for you?
Thanks,
Kevin

Similar Messages

  • How to run the Thread twice

    Why the program only can print from 0 to 9 once, not twice?
    Thank you!
    Here is my program
    class TestThread extends Thread
         String name;
         public void run(){
              for(int i=0;i<10;i++){
              System.out.println(i);
              try{
              sleep((long)(Math.random()*1000));
              }catch(Exception e){
                   System.out.println(e.toString());
         public static void main(String[] args){
              TestThread t = new TestThread();
              TestThread t1 = new TestThread();
              t.start();
              try{
              t.join();
              }catch(Exception e){
              t.start();

    Why the program only can print from 0 to 9 once, not
    twice?
    Thank you!
    Here is my programBecause the run() method returns after printing the numbers once and sleeping a random amount of time. When you return from the run() method, the thread ends.
    Threads cannot be restarted, i.e., if a thread has ended you cannot call start() on it again. If you want to do that, just create a new object and call start() on it.
    Maybe you want a loop in your run() method:
    public void run() {
      while (true) {   // Keep doing this forever!
        for(int i=0;i<10;i++) {
          System.out.println(i);
          try {
            sleep((long)(Math.random()*1000));
          catch(Exception e) {
            System.out.println(e.toString());
    }Jesper

  • How to set the default path of the tag while working with xtype "tags"

    Hi,
    I am working with xtype tag, where i have to select tags in the dialog box. Everything is fine, but my requirement is set the tags path.
    Currently it is defaulted to /etc/tags and showing all the tags. Instead i have show only the single tag path that is required for me.
    Is there any way where i can set the root path and set to my custom tag path like: /ets/tags/mycustomtags/
    Thanks for the support in advance
    Riyaz

    Hi,
    Use namespaces property to set the path. But it only works with namespaces that you directly creates under /etc/tags
    so for example if you want to use or show two namesapces /ets/tags/mycustomtags & /ets/tags/mycustomtags1
    then set this property as
    namespaces       string[]             mycustomtags  
                                                       mycustomtags1
    and if you have only want to show one then
    namespaces       string[]             mycustomtags
    I hope it will help you.
    Also refer http://dev.day.com/docs/en/cq/current/widgets-api/output/CQ.tagging.TagInputField.html
    Let me know if you need more information.
    THanks,
    Pawan

  • Running the book while the display is closed

    I closed the display when the book was running, earlier I will open it and the book will be running, but now when I closed the display, the book shuts down and fails to respond.
    Please help me. What's wrong with powerbook now.

    sendhilkumar:
    "never put the computer/display to sleep when it's inactive".
    Reset both to 15 minutes or so, and check box to +put Hard Disk(s) to sleep when possible+. This will put the HD to sleep when inactive, and the computer and display to sleep for the times you have set.
    cornelius

  • Error While running the prgram in Second time...Frank Could u pls check th

    Hi,
    I am using JDeveloper 11g.
    I have created a web application using ADF Business Components. Here I created a Bar Graph. When I am running the first it works fine. But when I try to run the second time it is giving some errors like Error 500 - Internal Server Error.
    Kindly help me...
    Thanks in Advance
    Regards,
    Jithesh.

    Hi Timo,
    Thanks a lot for the response.
    I am searched as per your advise but still ma problem is there... I am not getting any proper solution for this
    In the setDomainEnv.cmd file I am unable to find the PermGen size as you said...In the file I got the following line.
    set MEM_PERM_SIZE=-XX:PermSize=48m
    Is this I hv to change or something else. I am attaching the same file contents. Kindly help me....
    set ORACLE_HOME=C:\Oracle\Middleware\jdeveloper
    set WL_HOME=C:\Oracle\Middleware\wlserver_10.3
    for %%i in ("%WL_HOME%") do set WL_HOME=%%~fsi
    set BEA_JAVA_HOME=
    set SUN_JAVA_HOME=C:\Oracle\Middleware\jdk160_05
    if "%JAVA_VENDOR%"=="BEA" (
         set JAVA_HOME=%BEA_JAVA_HOME%
    ) else (
         if "%JAVA_VENDOR%"=="Sun" (
              set JAVA_HOME=%SUN_JAVA_HOME%
         ) else (
              set JAVA_VENDOR=Sun
              set JAVA_HOME=C:\Oracle\Middleware\jdk160_05
    @REM We need to reset the value of JAVA_HOME to get it shortened AND
    @REM we can not shorten it above because immediate variable expansion will blank it
    set JAVA_HOME=%JAVA_HOME%
    for %%i in ("%JAVA_HOME%") do set JAVA_HOME=%%~fsi
    set SAMPLES_HOME=%WL_HOME%\samples
    set DOMAIN_HOME=C:\Oracle\Middleware\jdeveloper\system\system11.1.1.0.31.51.88\DefaultDomain
    for %%i in ("%DOMAIN_HOME%") do set DOMAIN_HOME=%%~fsi
    set LONG_DOMAIN_HOME=C:\Oracle\Middleware\jdeveloper\system\system11.1.1.0.31.51.88\DefaultDomain
    if "%DEBUG_PORT%"=="" (
         set DEBUG_PORT=8453
    if "%SERVER_NAME%"=="" (
         set SERVER_NAME=DefaultServer
    set POINTBASE_FLAG=false
    set enableHotswapFlag=
    set PRODUCTION_MODE=
    set doExitFlag=false
    set verboseLoggingFlag=false
    for %%p in (%*) do call :SET_PARAM %%p
    GOTO :CMD_LINE_DONE
         :SET_PARAM
         for %%q in (%1) do set noQuotesParam=%%~q
         if /i "%noQuotesParam%" == "nodebug" (
              set debugFlag=false
              GOTO :EOF
         if /i "%noQuotesParam%" == "production" (
              set DOMAIN_PRODUCTION_MODE=true
              GOTO :EOF
         if /i "%noQuotesParam%" == "notestconsole" (
              set testConsoleFlag=false
              GOTO :EOF
         if /i "%noQuotesParam%" == "noiterativedev" (
              set iterativeDevFlag=false
              GOTO :EOF
         if /i "%noQuotesParam%" == "noLogErrorsToConsole" (
              set logErrorsToConsoleFlag=false
              GOTO :EOF
         if /i "%noQuotesParam%" == "nopointbase" (
              set POINTBASE_FLAG=false
              GOTO :EOF
         if /i "%noQuotesParam%" == "doExit" (
              set doExitFlag=true
              GOTO :EOF
         if /i "%noQuotesParam%" == "noExit" (
              set doExitFlag=false
              GOTO :EOF
         if /i "%noQuotesParam%" == "verbose" (
              set verboseLoggingFlag=true
              GOTO :EOF
         if /i "%noQuotesParam%" == "enableHotswap" (
              set enableHotswapFlag=-javaagent:%WL_HOME%\server\lib\diagnostics-agent.jar
              GOTO :EOF
         ) else (
              set PROXY_SETTINGS=%PROXY_SETTINGS% %1
         GOTO :EOF
    :CMD_LINE_DONE
    set MEM_DEV_ARGS=
    if "%DOMAIN_PRODUCTION_MODE%"=="true" (
         set PRODUCTION_MODE=%DOMAIN_PRODUCTION_MODE%
    if "%PRODUCTION_MODE%"=="true" (
         set debugFlag=false
         set testConsoleFlag=false
         set iterativeDevFlag=false
    @REM If you want to override the default Patch Classpath, Library Path and Path for this domain,
    @REM Please uncomment the following lines and add a valid value for the environment variables
    @REM set PATCH_CLASSPATH=[myPatchClasspath] (windows)
    @REM set PATCH_LIBPATH=[myPatchLibpath] (windows)
    @REM set PATCH_PATH=[myPatchPath] (windows)
    @REM PATCH_CLASSPATH=[myPatchClasspath] (unix)
    @REM PATCH_LIBPATH=[myPatchLibpath] (unix)
    @REM PATCH_PATH=[myPatchPath] (unix)
    call "%WL_HOME%\common\bin\commEnv.cmd"
    set WLS_HOME=%WL_HOME%\server
    set MEM_ARGS=-Xms256m -Xmx512m
    set MEM_PERM_SIZE=-XX:PermSize=48m
    set MEM_MAX_PERM_SIZE=-XX:MaxPermSize=128m
    if "%JAVA_VENDOR%"=="Sun" (
         if "%PRODUCTION_MODE%"=="" (
              set MEM_DEV_ARGS=-XX:CompileThreshold=8000 %MEM_PERM_SIZE%
    @REM Had to have a separate test here BECAUSE of immediate variable expansion on windows
    if "%JAVA_VENDOR%"=="Sun" (
         set MEM_ARGS=%MEM_ARGS% %MEM_DEV_ARGS% %MEM_MAX_PERM_SIZE%
    if "%JAVA_VENDOR%"=="HP" (
         set MEM_ARGS=%MEM_ARGS% %MEM_MAX_PERM_SIZE%
    @REM IF USER_MEM_ARGS the environment variable is set, use it to override ALL MEM_ARGS values
    if NOT "%USER_MEM_ARGS%"=="" (
         set MEM_ARGS=%USER_MEM_ARGS%
    set JAVA_PROPERTIES=-Dplatform.home=%WL_HOME% -Dwls.home=%WLS_HOME% -Dweblogic.home=%WLS_HOME%
    @REM To use Java Authorization Contract for Containers (JACC) in this domain,
    @REM please uncomment the following section. If there are multiple machines in
    @REM your domain, be sure to edit the setDomainEnv in the associated domain on
    @REM each machine.
    @REM
    @REM -Djava.security.manager
    @REM -Djava.security.policy=location of weblogic.policy
    @REM -Djavax.security.jacc.policy.provider=weblogic.security.jacc.simpleprovider.SimpleJACCPolicy
    @REM -Djavax.security.jacc.PolicyConfigurationFactory.provider=weblogic.security.jacc.simpleprovider.PolicyConfigurationFactoryImpl
    @REM -Dweblogic.security.jacc.RoleMapperFactory.provider=weblogic.security.jacc.simpleprovider.RoleMapperFactoryImpl
    set EXTRA_JAVA_PROPERTIES=-Ddomain.home=%DOMAIN_HOME% -Doracle.home=%ORACLE_HOME% -Doracle.security.jps.config=%DOMAIN_HOME%\config\oracle\jps-config.xml -Doracle.dms.context=OFF -Djava.protocol.handler.pkgs=oracle.mds.net.protocol %EXTRA_JAVA_PROPERTIES%
    set JAVA_PROPERTIES=%JAVA_PROPERTIES% %EXTRA_JAVA_PROPERTIES%
    set ARDIR=%WL_HOME%\server\lib
    pushd %LONG_DOMAIN_HOME%
    @REM Clustering support (edit for your cluster!)
    if "%ADMIN_URL%"=="" (
         @REM The then part of this block is telling us we are either starting an admin server OR we are non-clustered
         set CLUSTER_PROPERTIES=-Dweblogic.management.discover=true
    ) else (
         set CLUSTER_PROPERTIES=-Dweblogic.management.discover=false -Dweblogic.management.server=%ADMIN_URL%
    if NOT "%LOG4J_CONFIG_FILE%"=="" (
         set JAVA_PROPERTIES=%JAVA_PROPERTIES% -Dlog4j.configuration=file:%LOG4J_CONFIG_FILE%
    set JAVA_PROPERTIES=%JAVA_PROPERTIES% %CLUSTER_PROPERTIES%
    @REM Clear the pre_classpath here in case an application template wants to set it before the larger pre_classpath is invoked below
    set PRE_CLASSPATH=
    set JAVA_DEBUG=
    if "%debugFlag%"=="true" (
         set JAVA_DEBUG=-Xdebug -Xnoagent -Xrunjdwp:transport=dt_socket,address=%DEBUG_PORT%,server=y,suspend=n -Djava.compiler=NONE
         set JAVA_OPTIONS=%JAVA_OPTIONS% %enableHotswapFlag% -ea -da:com.bea... -da:javelin... -da:weblogic... -ea:com.bea.wli... -ea:com.bea.broker... -ea:com.bea.sbconsole...
    ) else (
         set JAVA_OPTIONS=%JAVA_OPTIONS% %enableHotswapFlag% -da
    if NOT exist %JAVA_HOME%\lib (
         echo The JRE was not found in directory %JAVA_HOME%. ^(JAVA_HOME^)
         echo Please edit your environment and set the JAVA_HOME
         echo variable to point to the root directory of your Java installation.
         popd
         pause
         GOTO :EOF
    if "%POINTBASE_FLAG%"=="true" (
         set DATABASE_CLASSPATH=%POINTBASE_CLASSPATH%
    ) else (
         set DATABASE_CLASSPATH=%POINTBASE_CLIENT_CLASSPATH%
    set POST_CLASSPATH=
    set POST_CLASSPATH=%ORACLE_HOME%\modules\features\adf.share_11.1.1.jar;%POST_CLASSPATH%
    set POST_CLASSPATH=%POST_CLASSPATH%;%DATABASE_CLASSPATH%;%ARDIR%\xqrl.jar
    @REM PROFILING SUPPORT
    set JAVA_PROFILE=
    set SERVER_CLASS=weblogic.Server
    set JAVA_PROPERTIES=%JAVA_PROPERTIES% %WLP_JAVA_PROPERTIES%
    set JAVA_OPTIONS=%JAVA_OPTIONS% %JAVA_PROPERTIES% -Dwlw.iterativeDev=%iterativeDevFlag% -Dwlw.testConsole=%testConsoleFlag% -Dwlw.logErrorsToConsole=%logErrorsToConsoleFlag%
    @REM -- Setup properties so that we can save stdout and stderr to files
    if NOT "%WLS_STDOUT_LOG%"=="" (
         echo Logging WLS stdout to %WLS_STDOUT_LOG%
         set JAVA_OPTIONS=%JAVA_OPTIONS% -Dweblogic.Stdout=%WLS_STDOUT_LOG%
    if NOT "%WLS_STDERR_LOG%"=="" (
         echo Logging WLS stderr to %WLS_STDERR_LOG%
         set JAVA_OPTIONS=%JAVA_OPTIONS% -Dweblogic.Stderr=%WLS_STDERR_LOG%
    @REM ADD EXTENSIONS TO CLASSPATHS
    if NOT "%EXT_PRE_CLASSPATH%"=="" (
         set PRE_CLASSPATH=%EXT_PRE_CLASSPATH%;%PRE_CLASSPATH%
    if NOT "%EXT_POST_CLASSPATH%"=="" (
         set POST_CLASSPATH=%POST_CLASSPATH%;%EXT_POST_CLASSPATH%
    if NOT "%WEBLOGIC_EXTENSION_DIRS%"=="" (
         set JAVA_OPTIONS=%JAVA_OPTIONS% -Dweblogic.ext.dirs=%WEBLOGIC_EXTENSION_DIRS%
    set JAVA_OPTIONS=%JAVA_OPTIONS%
    @REM SET THE CLASSPATH
    set CLASSPATH=%PRE_CLASSPATH%;%WEBLOGIC_CLASSPATH%;%POST_CLASSPATH%;%WLP_POST_CLASSPATH%
    set JAVA_VM=%JAVA_VM% %JAVA_DEBUG% %JAVA_PROFILE%
    Jithesh.

  • Error While running the prgram in Second time..Frank Could u pls check this

    Hi,
    I am using JDeveloper 11g.
    I have created a web application using ADF Business Components in JSF pages(Created the Bar Graph). When I am running the first it works fine. But when I try to run the second time it is giving some errors like Error 500 - Internal Server Error.
    Kindly help me...
    Thanks in Advance
    Regards,
    Jithesh.

    So what do you find in the log files, or console output?
    --olaf                                                                                                                                                                                               

  • Java threading problem... threads only work on 1 processor

    I've got a iterative deepening problem that i have to parallelize. As far as i know i did everything correctly however everything seems to be running on 1 processor instead of 2 processors. As far as i know i am using threads (-Xprof either defines them as thread-1 thread-2 or pool1-thread1,depending on the method used for issueing)
    the worker thread is:
    public int solutionsT(Board board, int currentDepth) {
            int temp = 0;
            int result = 0;
            if (board.distance() == 0) {
               return 1;
            if (board.distance() > board.bound()) {
                return 0;
            Board[] children = board.makeMoves();
            result = 0;
            for (int i = 0; i < children.length; i++) {
                if (children[i] != null) {
                    temp = solutionsT(children, currentDepth + 1);
    if(temp != 0){
    result += temp;
    return result;
    public void run() {
    int temp =0;
    int i = 0;
    while(true){
    while(bag.size() !=0){
    bag.putSolution(solutionsT(bag.get(),1));
    try{   
    barrier.await();
    }catch(Exception e){}
    it get's it's input from a bag that is filled before the iteration begins. (once the bag is filled it trips a barrier) this worker thread is a implementation of Runnable
    This piece of code is used to make the thread object and to issue it
    public SolutionThread(int numberOfThreads) {
       thread = numberOfThreads;
       bag = new bagOfBoards();
       barrier = new CyclicBarrier(thread+1);
       if(thread > 1){
          ExecutorService threadExecutor = Executors.newFixedThreadPool( thread );
          solution = new ThreadTest[thread];
          bag = new bagOfBoards();
          for(int i = 0;i<thread;i++){
             solution[i] = new ThreadTest(bag, lock, barrier, i);
             threadExecutor.execute(solution);
    finally this is the code which is used to acces the bag and get a board.
    synchronized public Board get() {
                if (size > 0) {
                size--;
                Board result = bag[size];
                return result;
            } else {
             return null;
        }since this method is synchronized and it always returns something (either null or a board) and the worker tests for this. there is no race condition here.
    furter more. the main thread is a loop. It fills te bags with an intial state. then it trips the barrier and waits for the workers to do the work. the workers then process the bag until it hits zero and then trip the barrier so that the main thread can do the next iteration (and fill the bag)
    p.s. i know the code is a bit messy, but i want to get the threading to work. As of now i relaly don't understand why the threads are just running on 1 processor instead of 2 processors. not only that. the excecution time is nearly the same as that of a sequential equivalent.
    p.s.2 the code is parallisable. and it is run on a smp system.
    Message was edited by:
    jstrike

    i'm very sure that the jvm and os support smp. the
    problem really should be in the code.I don't see how this can be the case. There's nothing in the Java language that deals with how threads are assigned to processors (at least not as far as I know) so there isn't anything you can do in your code to affect that.
    Or did you meant that i have to tell the jvm in the class that
    there is support for multiple processorsThat would be the only possibility. I have no idea whether it can be done or not, though.

  • The problem in the thread pool implemented by myself

    Hello, I need to a thread pool in J2ME CDC 1.0 + FP 1.0, so I implemented a simple one by myself that also meets my own requirement.
    Here is the main idea:
    The thread pool creates a fixed number of threads in advance. When a task comes, it is put in the waiting list. All threads tries to get the tasks from the waiting list. If no task exists, the threads wait until someone wakes them up.
    Here are the requirements from myself:
    1. when a task has finished its work in one execution, it is put in the waiting list for the next run.
    2. the task can control the delay between when the task owner tries to put it in the waiting list and when the task is actually put in the waiting list. I need this function because sometimes I don't want the tasks to run too often and want to save some CPU usage.
    In my program, I creates two thread pools. In one pool, every task don't use the delay, and the thread pool works very well. The other pool has the tasks that use the delay, and sometimes, as I can see from the printed information, there are many tasks in the waiting list but 0 or 1 thread executes tasks. It seems that the waiting threads cannot wake up when new tasks comes.
    I suspect the code in addTask(), but cannot find the reason why it fails. Could anyone please help me find out the bug in my code? I put the code of thread pool below
    Thank you in advance
    Zheng Da
    ThreadPool.java
    package j2me.concurrent;
    import java.util.LinkedList;
    import java.util.Timer;
    import java.util.TimerTask;
    import alvis.general.Util;
    public class ThreadPool {
         private int maxQueueSize;
         private boolean running = true;
         private Thread[] threads;
         private LinkedList tasks = new LinkedList();
         private Timer timer = new Timer(true);
         private AtomicInteger usingThreads = new AtomicInteger(0);
         private synchronized boolean isRunning() {
              return running;
         private synchronized void stopRunning() {
              running = false;
         private synchronized PoolTask getTask() {
              while (tasks.isEmpty() && isRunning()) {
                   try {
                        this.wait();
                   } catch (InterruptedException e) {
                        e.printStackTrace();
              if (tasks.isEmpty())
                   return null;
              // Util.log.info(Thread.currentThread().getName() +
              // " gets a task, left tasks: " + tasks.size());
              return (PoolTask) tasks.removeFirst();
         private synchronized void addTaskNoDelay(PoolTask task) {
              tasks.addLast(task);
              notifyAll();
         private synchronized void addTask(final PoolTask task) {
              long delay = task.delay();
              if (delay == 0) {
                   addTaskNoDelay(task);
              } else {
                   timer.schedule(new TimerTask() {
                        public void run() {
                             addTaskNoDelay(task);
                   }, delay);
         private synchronized int numTasks() {
              return tasks.size();
         private class PoolThread extends Thread {
              public void run() {
                   Util.poolThreads.inc();
                   while (isRunning()) {
                        PoolTask task = getTask();
                        if (task == null) {
                             Util.poolThreads.dec();
                             return;
                        usingThreads.inc();
                        long currentTime = System.currentTimeMillis();
                        task.run();
                        long elapsedTime = System.currentTimeMillis() - currentTime;
                        if (elapsedTime > 100)
                             System.err.println(task.toString() + " takes " + ((double) elapsedTime)/1000 + "s");
                        usingThreads.dec();
                        if (!task.finish()) {
                             addTask(task);
                   Util.poolThreads.dec();
         public ThreadPool(int size, int taskQueueSize) {
              maxQueueSize = taskQueueSize;
              threads = new Thread[size];
              for (int i = 0; i < threads.length; i++) {
                   threads[i] = new PoolThread();
                   threads.start();
         public synchronized boolean executor(PoolTask task) {
              if (!isRunning()) {
                   return false;
              Util.log.info("Thread Pool gets " + task + ", there are "
                        + numTasks() + " waiting tasks");
              if (numTasks() >= maxQueueSize) {
                   return false;
              addTask(task);
              return true;
         public synchronized void destroy() {
              stopRunning();
              timer.cancel();
              // TODO: I am not sure it can wake up all threads and destroy them.
              this.notifyAll();
         public synchronized void printSnapshot() {
              System.err.println("using threads: " + usingThreads + ", remaining tasks: " + tasks.size());
    PoolTask.javapackage j2me.concurrent;
    public interface PoolTask extends Runnable {
         * It shows if the task has already finished.
         * If it isn't, the task will be put in the thread pool for the next execution.
         * @return
         boolean finish();
         * It shows the delay in milliseconds that the task is put in the thread pool.
         * @return
         long delay();

    are receiving/sends tasks packets time consuming operation in your case or not? if it is not you do not need to use thread pools at all. you can create a queue like in your code through the linked list and dispatch this queue periodically with minimum monitor usage. try this.
    import java.util.LinkedList;
    public class PacketDispatcher extends Thread {
        LinkedList list = new LinkedList();
        public PacketDispatcher (String name) {
            super(name);
        public void putTask(Task task) {
            synchronized (list) {
                list
                        .add(task);
                list.notify();
        public void run() {
            while (true/* your condition */) {
                Task task = null;
                synchronized (list) {
                    while (list.isEmpty())
                        try {
                            list.wait();
                        } catch (InterruptedException e) {
                            e.printStackTrace();
                    task = (Task)list
                            .poll();
                if (task == null) {
                    try {
                        Thread
                                .sleep(1);
                    } catch (InterruptedException e) {
                        e.printStackTrace();
                    continue;
                task
                        .run();
                if (!task.isFinished()) {
                    putTask(task);
                Thread
                        .yield();
        public static void main(String[] args) {
            // just for test
            try {
                Thread.sleep (10000);
            } catch (InterruptedException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
            PacketDispatcher dispatcher = new PacketDispatcher("Packet Dispatcher");
            Task task = new Task();
            dispatcher.putTask(task);
            dispatcher.start();
            try {
                Thread.sleep (10000);
            } catch (InterruptedException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
            Task task2 = new Task();
            dispatcher.putTask(task2);
    class Task {
        long result = 0;
        public boolean isFinished () {
            if (getResult() >= 10000000) {
                return true;
            return false;
        public void run() {
            for (int i = 0; i < 1000; i++) {
                result += i;
        public long getResult () {
            return result;       
    }

  • Why does my screen turn black when I play iTunes while working on iPhoto?

    Why does my screen turn black when I play ITunes while working on iPhoto? I can't click off of the screen but get a message that reads Shut down computer by pressing button in back then turn computer back on by pushing button in back. That's followed by Chinese letters (which I cannot read). I have had other problems when playing iTunes (actually, a radio station on the Internet) while working on  iPhoto. Before, I got a window that would pop up and tell me I had no disk space available, that I would have to quit applications that were open. Not many were open.
    It would be nice if I could solve this problem once and for all.
    Thanks in advance for all the suggestions. I truly appreciate your help.
    Jan

    That was easy. Thanks. Jan
    Interval Since Last Panic Report:  1949305 sec
    Panics Since Last Report:          1
    Thu Feb  6 15:29:32 2014
    panic(cpu 1 caller 0xffffff80002c4794): Kernel trap at 0xffffff7f81d89ff3, type 14=page fault, registers:
    CR0: 0x0000000080010033, CR2: 0xffffff7acd4a2a7c, CR3: 0x0000000085d3b000, CR4: 0x0000000000000660
    RAX: 0xffffffff4bffff56, RBX: 0x0000000000000000, RCX: 0x0000000000000001, RDX: 0x0000000000000000
    RSP: 0xffffff807867b7c0, RBP: 0xffffff807867b800, RSI: 0xffffff7acd4a2a7c, RDI: 0xffffff8065292000
    R8:  0x0000000000000001, R9:  0x0000000000000000, R10: 0xffffff7f81d44200, R11: 0xffffff800f8b45e8
    R12: 0xffffff8065292000, R13: 0xffffff807867b860, R14: 0x0000000000000001, R15: 0xffffff7acd4a2a7c
    RFL: 0x0000000000010286, RIP: 0xffffff7f81d89ff3, CS:  0x0000000000000008, SS:  0x0000000000000010
    CR2: 0xffffff7acd4a2a7c, Error code: 0x0000000000000000, Faulting CPU: 0x1
    Backtrace (CPU 1), Frame : Return Address
    0xffffff807867b470 : 0xffffff8000220792
    0xffffff807867b4f0 : 0xffffff80002c4794
    0xffffff807867b6a0 : 0xffffff80002da55d
    0xffffff807867b6c0 : 0xffffff7f81d89ff3
    0xffffff807867b800 : 0xffffff7f81d8a694
    0xffffff807867b890 : 0xffffff7f81d8b4ed
    0xffffff807867b8d0 : 0xffffff7f81d472a1
    0xffffff807867ba40 : 0xffffff7f81d8bd6d
    0xffffff807867bb00 : 0xffffff7f81d44346
    0xffffff807867bb60 : 0xffffff8000655f3e
    0xffffff807867bb80 : 0xffffff800065681a
    0xffffff807867bbe0 : 0xffffff8000656fbb
    0xffffff807867bd20 : 0xffffff80002a3f08
    0xffffff807867be20 : 0xffffff8000223096
    0xffffff807867be50 : 0xffffff80002148a9
    0xffffff807867beb0 : 0xffffff800021bbd8
    0xffffff807867bf10 : 0xffffff80002af140
    0xffffff807867bfb0 : 0xffffff80002dab5e
          Kernel Extensions in backtrace:
             com.apple.GeForce(7.3.2)[7E1D7726-416F-3716-ACCB-E1E276E35002]@0xffffff7f81d390 00->0xffffff7f81dfbfff
                dependency: com.apple.NVDAResman(7.3.2)[97284661-2629-379E-B86B-D388618E8C30]@0xffffff7f808 b0000
                dependency: com.apple.iokit.IONDRVSupport(2.3.4)[7C8672C4-8B0D-3CCF-A79A-23C62E90F895]@0xff ffff7f8089e000
                dependency: com.apple.iokit.IOPCIFamily(2.7)[5C23D598-58B2-3204-BC03-BC3C0F00BD32]@0xffffff 7f8082b000
                dependency: com.apple.iokit.IOGraphicsFamily(2.3.4)[D0A1F6BD-E66E-3DD8-9913-A3AB8746F422]@0 xffffff7f80865000
    BSD process name corresponding to current thread: iPhoto
    Mac OS version:
    11G63
    Kernel version:
    Darwin Kernel Version 11.4.2: Thu Aug 23 16:25:48 PDT 2012; root:xnu-1699.32.7~1/RELEASE_X86_64
    Kernel UUID: FF3BB088-60A4-349C-92EA-CA649C698CE5
    System model name: iMac10,1 (Mac-F2268CC8)
    System uptime in nanoseconds: 11526391261403
    last loaded kext at 23020191300: com.apple.driver.AppleHWSensor    1.9.5d0 (addr 0xffffff7f8234b000, size 28672)
    last unloaded kext at 522057763087: com.apple.driver.AppleFileSystemDriver    13 (addr 0xffffff7f8254c000, size 12288)
    loaded kexts:
    com.apple.driver.AppleHWSensor    1.9.5d0
    com.apple.driver.AppleBluetoothMultitouch    70.12
    com.apple.filesystems.autofs    3.0
    com.apple.iokit.IOBluetoothSerialManager    4.0.8f17
    com.apple.driver.AudioAUUC    1.59
    com.apple.driver.AppleMikeyHIDDriver    122
    com.apple.driver.AppleHDA    2.2.5a5
    com.apple.driver.AppleUpstreamUserClient    3.5.9
    com.apple.driver.AppleMikeyDriver    2.2.5a5
    com.apple.driver.AppleBacklight    170.2.2
    com.apple.driver.AppleMCCSControl    1.0.33
    com.apple.driver.AppleLPC    1.6.0
    com.apple.driver.AGPM    100.12.75
    com.apple.iokit.IOUserEthernet    1.0.0d1
    com.apple.Dont_Steal_Mac_OS_X    7.0.0
    com.apple.driver.AudioIPCDriver    1.2.3
    com.apple.driver.ApplePolicyControl    3.1.33
    com.apple.GeForce    7.3.2
    com.apple.driver.ACPI_SMC_PlatformPlugin    5.0.0d8
    com.apple.driver.BroadcomUSBBluetoothHCIController    4.0.8f17
    com.apple.driver.AppleUSBCardReader    3.0.6
    com.apple.driver.AppleIRController    312
    com.apple.AppleFSCompression.AppleFSCompressionTypeDataless    1.0.0d1
    com.apple.AppleFSCompression.AppleFSCompressionTypeZlib    1.0.0d1
    com.apple.BootCache    33
    com.apple.iokit.SCSITaskUserClient    3.2.1
    com.apple.iokit.IOAHCISerialATAPI    2.0.3
    com.apple.driver.XsanFilter    404
    com.apple.iokit.IOAHCIBlockStorage    2.1.0
    com.apple.driver.AppleRTC    1.5
    com.apple.driver.AppleFWOHCI    4.9.0
    com.apple.driver.AirPort.Atheros40    505.67.1
    com.apple.driver.AppleAHCIPort    2.3.1
    com.apple.nvenet    2.0.17
    com.apple.driver.AppleUSBHub    5.1.0
    com.apple.driver.AppleUSBEHCI    5.1.0
    com.apple.driver.AppleUSBOHCI    5.1.0
    com.apple.driver.AppleEFINVRAM    1.6.1
    com.apple.driver.AppleHPET    1.7
    com.apple.driver.AppleACPIButtons    1.5
    com.apple.driver.AppleSMBIOS    1.9
    com.apple.driver.AppleACPIEC    1.5
    com.apple.driver.AppleAPIC    1.6
    com.apple.driver.AppleIntelCPUPowerManagementClient    195.0.0
    com.apple.nke.applicationfirewall    3.2.30
    com.apple.security.quarantine    1.4
    com.apple.security.TMSafetyNet    8
    com.apple.driver.AppleIntelCPUPowerManagement    195.0.0
    com.apple.driver.AppleMultitouchDriver    231.4
    com.apple.driver.IOBluetoothHIDDriver    4.0.8f17
    com.apple.kext.triggers    1.0
    com.apple.iokit.IOSerialFamily    10.0.5
    com.apple.driver.DspFuncLib    2.2.5a5
    com.apple.driver.AppleBacklightExpert    1.0.4
    com.apple.driver.AppleSMBusController    1.0.10d0
    com.apple.driver.AppleSMBusPCI    1.0.10d0
    com.apple.iokit.IOSurface    80.0.2
    com.apple.iokit.IOAudioFamily    1.8.6fc18
    com.apple.kext.OSvKernDSPLib    1.3
    com.apple.driver.AppleGraphicsControl    3.1.33
    com.apple.driver.AppleHDAController    2.2.5a5
    com.apple.iokit.IOHDAFamily    2.2.5a5
    com.apple.nvidia.nv50hal    7.3.2
    com.apple.NVDAResman    7.3.2
    com.apple.iokit.IONDRVSupport    2.3.4
    com.apple.iokit.IOGraphicsFamily    2.3.4
    com.apple.iokit.IOFireWireIP    2.2.5
    com.apple.driver.IOPlatformPluginLegacy    5.0.0d8
    com.apple.driver.IOPlatformPluginFamily    5.1.1d6
    com.apple.driver.AppleSMC    3.1.3d10
    com.apple.driver.AppleUSBBluetoothHCIController    4.0.8f17
    com.apple.iokit.IOBluetoothFamily    4.0.8f17
    com.apple.iokit.IOSCSIBlockCommandsDevice    3.2.1
    com.apple.iokit.IOUSBMassStorageClass    3.0.3
    com.apple.iokit.IOUSBHIDDriver    5.0.0
    com.apple.driver.AppleUSBMergeNub    5.1.0
    com.apple.driver.AppleUSBComposite    5.0.0
    com.apple.iokit.IOSCSIMultimediaCommandsDevice    3.2.1
    com.apple.iokit.IOBDStorageFamily    1.7
    com.apple.iokit.IODVDStorageFamily    1.7.1
    com.apple.iokit.IOCDStorageFamily    1.7.1
    com.apple.iokit.IOSCSIArchitectureModelFamily    3.2.1
    com.apple.iokit.IOFireWireFamily    4.4.8
    com.apple.iokit.IO80211Family    420.3
    com.apple.iokit.IOAHCIFamily    2.0.8
    com.apple.iokit.IONetworkingFamily    2.1
    com.apple.iokit.IOUSBUserClient    5.0.0
    com.apple.iokit.IOUSBFamily    5.1.0
    com.apple.driver.NVSMU    2.2.9
    com.apple.iokit.IOHIDFamily    1.7.1
    com.apple.driver.AppleEFIRuntime    1.6.1
    com.apple.iokit.IOSMBusFamily    1.1
    com.apple.security.sandbox    177.11
    com.apple.kext.AppleMatch    1.0.0d1
    com.apple.driver.DiskImages    331.7
    com.apple.iokit.IOStorageFamily    1.7.2
    com.apple.driver.AppleKeyStore    28.18
    com.apple.driver.AppleACPIPlatform    1.5
    com.apple.iokit.IOPCIFamily    2.7
    com.apple.iokit.IOACPIFamily    1.4
    System Profile:
    Model: iMac10,1, BootROM IM101.00CC.B00, 2 processors, Intel Core 2 Duo, 3.06 GHz, 4 GB, SMC 1.52f9
    Graphics: NVIDIA GeForce 9400, NVIDIA GeForce 9400, PCI, 256 MB
    Memory Module: BANK 0/DIMM1, 2 GB, DDR3, 1067 MHz, 0x80CE, 0x4D34373142353637334548312D4346382020
    Memory Module: BANK 1/DIMM1, 2 GB, DDR3, 1067 MHz, 0x80CE, 0x4D34373142353637334548312D4346382020
    AirPort: spairport_wireless_card_type_airport_extreme (0x168C, 0x8F), Atheros 9280: 4.0.67.5-P2P
    Bluetooth: Version 4.0.8f17, 2 service, 18 devices, 1 incoming serial ports
    Serial ATA Device: ST3500418ASQ, 500.11 GB
    Serial ATA Device: HL-DT-ST DVDRW  GA11N
    USB Device: Built-in iSight, apple_vendor_id, 0x8502, 0x24400000 / 2
    USB Device: Internal Memory Card Reader, apple_vendor_id, 0x8403, 0x26500000 / 3
    USB Device: USB2.0 Hub, 0x05e3  (Genesys Logic, Inc.), 0x0608, 0x26200000 / 2
    USB Device: IR Receiver, apple_vendor_id, 0x8242, 0x04500000 / 2
    USB Device: Hub in Apple Extended USB Keyboard, apple_vendor_id, 0x1003, 0x06400000 / 3
    USB Device: Apple Extended USB Keyboard, apple_vendor_id, 0x020b, 0x06430000 / 4
    USB Device: BRCM2046 Hub, 0x0a5c  (Broadcom Corp.), 0x4500, 0x06100000 / 2
    USB Device: Bluetooth USB Host Controller, apple_vendor_id, 0x8215, 0x06110000 / 6

  • HOW CAN I CAPTURE SCREEN AND SOUND WHILE WORKING IN AUDITION

    Hi!  I would like capture the screen in real time as well as the sound while working in audition and later add voice and annotations .
          I tried Adobe Acitvate but it is not working. Time is running out for my trial version and I need to decide to get the right software.
          Hope to get an answer soon.
    David

    Are you talking about having used Adobe Captivate? If yes, which kind of recording did you start? And; since you talk about a trial version, I suppose you use Captivate 7?

  • Whats wrong, why doesnt the thread start?

    Below is my code for the part of my program, which creates a thread for every client that connects to a server in an instant messenger program. What the thread does it constantly recieves any data sent to the server, so that it therefore displays it on its own area of the screen. For some reason...this thread does not want to start. Any help would be incredibly appreciated. So heres the code:
    class SocketClient extends JFrame implements Runnable {
         Socket socket = null;
       PrintWriter out = null;
       BufferedReader in = null;
              String text = null;
              Thread getdata;
       SocketClient(){
         public void listenSocket() {
         if ( connected==("2") ) {
    //Create socket connection
         try{
           socket = new Socket("0.0.0.0", 4444);
                        System.out.println("Connected to self");
           out = new PrintWriter(socket.getOutputStream(), true);
           in = new BufferedReader(new InputStreamReader(socket.getInputStream()));
         } catch (UnknownHostException e) {
           System.out.println("Unknown host: host your connecting to");
           System.exit(1);
         } catch  (IOException e) {
           System.out.println("No I/O");
           System.exit(1);
                   connected = "1";
         else {
              try{
                    socket = new Socket("0.0.0.0", 4444);
           out = new PrintWriter(socket.getOutputStream(), true);
           in = new BufferedReader(new InputStreamReader(socket.getInputStream()));
         } catch (UnknownHostException e) {
           System.out.println("Unknown host: host your connecting to");
           System.exit(1);
         } catch  (IOException e) {
           System.out.println("No I/O");
           System.exit(1);
         if (thisclient==(1))
                   System.out.println("in thisserver");
                   Thread getdata = new Thread();
                             getdata.start();
                             thisclient = 2;
         senddata();
    public void senddata() {
         //Send data over socket
         System.out.println("in send data method");
         friendtypingLabel.setText("in send data");
              String text = messageArea.getText();
              out.println(text);
           messageArea.setText(new String(""));
    //Receive text from server
    public void run()
              if(getdata == Thread.currentThread() )
                   System.out.println("running getdata thread");  // if the thread was running this would be written to system but it isnt
                   friendtypingLabel.setText("running get data");
                   getdatamethod();
    public void getdatamethod() {
         //Send data over socket
    //Receive text from server
    while(true) {
           try{
           String line = in.readLine();
              messlistArea.append("Message Client:" + line + "\n");
           } catch (IOException e){
          System.out.println("Read failed");
                 System.exit(1);
              try { Thread.sleep(2000); }
                   catch(InterruptedException e) {}
    }

    k...well ive made it so that the client can see what they have just sent....but i cant seem to make is so that the can see wot the server and wot other clients have sent...here is some update code:
    class SocketClient extends JFrame implements Runnable {
         Socket socket = null;
       PrintWriter out = null;
       BufferedReader in = null;
              String text = null;
       SocketClient(){
         public void listenSocket() {
         if ( connected==("2") ) {
    //Create socket connection
         try{
           socket = new Socket("0.0.0.0", 4444);
                        System.out.println("Connected to self");
           out = new PrintWriter(socket.getOutputStream(), true);
           in = new BufferedReader(new InputStreamReader(socket.getInputStream()));
         } catch (UnknownHostException e) {
           System.out.println("Unknown host: host your connecting to");
           System.exit(1);
         } catch  (IOException e) {
           System.out.println("No I/O");
           System.exit(1);
                   connected = "1";
         else {
              try{
                    socket = new Socket("0.0.0.0", 4444);
           out = new PrintWriter(socket.getOutputStream(), true);
           in = new BufferedReader(new InputStreamReader(socket.getInputStream()));
         } catch (UnknownHostException e) {
           System.out.println("Unknown host: host your connecting to");
           System.exit(1);
         } catch  (IOException e) {
           System.out.println("No I/O");
           System.exit(1);
         if (thisclient==(1))
                   System.out.println("in thisserver");
                   getdata = new Thread(this);
                                                                                                                                                // if this is the client, then start the getdata
                             getdata.start();                                                                           // thread
                             thisclient = 2;
                             getdata.equals(Thread.currentThread());
         senddata();
    public void senddata() {
         //Send data over socket
         System.out.println("in send data method");
         friendtypingLabel.setText("in send data");
              String text = messageArea.getText();
              out.println(text);
           messageArea.setText(new String(""));
    //Receive text from server
    public void run()                                                   // runs the thread getdata
    System.out.println("Thread is " + Thread.currentThread());
              if(getdata.equals(Thread.currentThread()) )
                   getdatamethod();
    public void getdatamethod() {                      // method for the getdata thread
         //Send data over socket
    //Receive text from server
    while(true) {
    System.out.println("Run getdata");
           try{
                     String line = in.readLine();
                        if (line != null) {
              messlistArea.append("Message Client:" + line + "\n");
                             }catch (IOException e){
                              System.out.println("Read failed");
                      System.exit(1);
              try { Thread.sleep(2000); }
                   catch(InterruptedException e) {}
    }

  • Leaving charger in while working on mac?

    is it okay to leave the charger plugged into the mac while working? is it okay for the battery life?

    Sure. For more info check out the post below. It has a very good collection of battery tips and hints.
    https://discussions.apple.com/thread/1764220?threadID=1764220&tstart=45
    Stedman

  • How to run a thread for second time ?

    I have a written a ThreadPool, but I found that basically a thread is not running for the second time. i.e First i call run() method and call stop(). If i call again run() method for the same thread, it is not running. What should I do, If i want to run the thread for the second time ?
    class NewThread implements Runnable {
    String name;
    NewThread(String a) {
    name=a;
    public void run() {
    try{
    for(int i=0;i<5;i++) {
    System.out.println("Thread :" + name + " #" +i);
    Thread.sleep(5);
    catch (Exception e) {
    e.printStackTrace();
    class threadRunnableTest {
    public static void main (String args[]) {
    Runnable runnable=new NewThread("BaSkAr");
    Thread thread = new Thread(runnable);
    try{
    System.out.println("First Thread is starting !!!");
    thread.start();
    Thread.sleep(2000);
    System.out.println("First Thread it to be stopped!!");
    thread.stop();
    System.out.println("Second Thread is starting !!!");
    thread.start();
    Thread.sleep(2000);
    System.out.println("Second Thread it to be stopped!!");
    thread.stop();
    catch (Exception e) {
    e.printStackTrace();

    baskark wrote:
    I have a written a ThreadPool, but I found that basically a thread is not running for the second time. i.e First i call run() method and call stop(). If i call again run() method for the same thread, it is not running. What should I do, If i want to run the thread for the second time ?
    class NewThread implements Runnable {
    String name;
    NewThread(String a) {
    name=a;
    public void run() {
    try{
    for(int i=0;i<5;i++) {
    System.out.println("Thread :" + name + " #" +i);
    Thread.sleep(5);
    catch (Exception e) {
    e.printStackTrace();
    class threadRunnableTest {
    public static void main (String args[]) {
    Runnable runnable=new NewThread("BaSkAr");
    Thread thread = new Thread(runnable);
    try{
    System.out.println("First Thread is starting !!!");
    thread.start();
    Thread.sleep(2000);
    System.out.println("First Thread it to be stopped!!");
    thread.stop();
    System.out.println("Second Thread is starting !!!");
    thread.start();
    Thread.sleep(2000);
    System.out.println("Second Thread it to be stopped!!");
    thread.stop();
    catch (Exception e) {
    e.printStackTrace();
    It's usually helpful to check the documentation:
    [http://java.sun.com/javase/6/docs/api/java/lang/Thread.html#start()|http://java.sun.com/javase/6/docs/api/java/lang/Thread.html#start()]
    start
    public void start()Causes this thread to begin execution; the Java Virtual Machine calls the run method of this thread.
    The result is that two threads are running concurrently: the current thread (which returns from the call to the start method) and the other thread (which executes its run method).
    It is never legal to start a thread more than once. In particular, a thread may not be restarted once it has completed execution.
    So, make a new java.lang.Thread

  • How do I run a thread without its panel.

    I have created a vi in my application that I run as a thread. I run the thread by using an invoke node.
    When I am testing under LabView everything is fine but when I create the executable I have found problems.
    As I am starting the thread with an invoke node, the vi does not show in the application builder unless I add it as a top level vi. When I add it as a top level vi, the panel is shown when I run the application.
    I don't want to show the panel because firstly theres nothing on it anyway and secondly it looks untidy.
    Dave.

    Brian
    I tried that already with no effect. I have attached an example of my problem. This shows a meter on the front panel. A vi running as a thread writes a value to a global every 20ms and this is then read by the front panel and written to the meter.
    Dave.
    Attachments:
    Thread_test.zip ‏18 KB

  • Documents in the Cloud not working

    I'm having issues with the Documents in the cloud feature for a couple of days now, first I thought my restore fixed it but as I was working with some documents in iWork for iOS I ran into the exact same problem again.
    All my documents display the arrow going up badge or occasionally a progress bar that doesn't fill, and other apps that support iCloud for storing documents just refuse to let me access them.
    I checked the logs for my iOS devices (an iPad 2 and iPhone 4S) and they both exhibit a particular line when I try to sync my files with iCloud
    librariand[1208] <Error>: client connection is invalid: Connection invalid
    I have no clue what's going on, going to icloud.com on my Mac and entering the iWork webapp doesn't show any documents either, even thgough I succesfully synced all of my Pages documents across my iOS devices yesterday and they are still on sync.

    I'm having weirdness in Numbers and Pages too. Just upgraded an iPad 4 to 8.1.1, and now neither Numbers or Pages will load the iCloud documents. In fact, when I turn on "Use iCloud" in Settings and go to either of the Apps, nothing changes, but when I go back to Settings the "Use iCloud" has been switched back off. Both Apps load very slowly. When they finally do open and I click the + sign in the upper left of title bar, a blank cartoon-like bubble opens, then the App crashes. Interestingly a new iPhone 6 running the same software works just fine... both Apps load quickly and retrieve the iCloud documents instantly. I haven't got a clue...

Maybe you are looking for

  • HT5772 How do I delete voice memos from my phone?  It does not show on the app or in iTunes.  Thanks!

    How do I delete voice memos from my phone?  It does not show in the app or in iTunes.  Thanks

  • Outbound Queues in CRM system

    Dear All, There are lot of outbound queues in our CRM production sytem which are older than one month,basis is asking wether we can delete those queues or not,request you all to help me wehter we can delete it or not.if anybody can put some light on

  • How to save a .pdf

    is there a way to save a pdf i created by using one of the fileds in the form so it will use that as the name of file, so i will be able to search for it in the future. for example i created a form that has a purchase order field, i would like for th

  • Is there a way to set an application to always open in full screen mode?

    Some applications I would like to default to full screen on startup (iPhoto for example).  Is there a setting for that, or do I need to manually switch to full screen every time I launch it? Thanks!

  • Problem in implementing POP3 protocol.

    hi... i wanna implement POP3 protocol......actully i m designing an mail client..n i m using POP3 protocol to receive mails frm a POP3 server..but i dn't kno how to implement it?..how to go ahead to implement it?...plzz help me...if u hav any sort of