If you are experiencing an issue please mention the full platform your issue applies to:
IDE: NetBeans
Desktop OS: Win 8
Simulator : --
Device : --
Hello.
I want to handle multiple threads in pool so I am using following coding:
int corePoolSize = 4;
int maxThread = 8;
int keepAliveTime = 8000;//in milliseconds
ExecutorService executor = new ThreadPoolExecutor(corePoolSize, maxThread, keepAliveTime,
TimeUnit.MILLISECONDS, new LinkedBlockingQueue<Runnable>());
executor.execute(new Runnable() {
public void run() {
getTransactionValues();
}
});
for this code I am importing below statements:
import java.util.concurrent.ExecutorService;
import java.util.concurrent.LinkedBlockingQueue;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;
As when I save code, it doesn't give me any error.
But when I compile and build it, it gives me these errors:
D:\nz\m4a\akash_test\WorkInProcess\src\userclasses\StateMachine.java:33: error: package java.util.concurrent does not exist
import java.util.concurrent.*;
D:\nz\m4a\akash_test\WorkInProcess\src\userclasses\StateMachine.java:749: error: cannot find symbol
ExecutorService executor = new ThreadPoolExecutor(corePoolSize, maxThread, keepAliveTime,
symbol: class ExecutorService
location: class StateMachine
D:\nz\m4a\akash_test\WorkInProcess\src\userclasses\StateMachine.java:749: error: cannot find symbol
ExecutorService executor = new ThreadPoolExecutor(corePoolSize, maxThread, keepAliveTime,
symbol: class ThreadPoolExecutor
location: class StateMachine
D:\nz\m4a\akash_test\WorkInProcess\src\userclasses\StateMachine.java:750: error: cannot find symbol
TimeUnit.MILLISECONDS, new LinkedBlockingQueue<Runnable>());
symbol: variable TimeUnit
location: class StateMachine
D:\nz\m4a\akash_test\WorkInProcess\src\userclasses\StateMachine.java:750: error: cannot find symbol
TimeUnit.MILLISECONDS, new LinkedBlockingQueue<Runnable>());
symbol: class LinkedBlockingQueue
location: class StateMachine
Note: D:\nz\m4a\akash_test\WorkInProcess\src\userclasses\StateMachine.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: D:\nz\m4a\akash_test\WorkInProcess\src\userclasses\StateMachine.java uses unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
5 errors
I'm quite amazed why this code / package is generating error ?
Because in Java thi
s concurrent package is
from 1.5 and
I tried by setting JDK1.8 and JDK1.7 from Tools -> Java Platform but no luck..
I also tried by re-setting JAVA_HOME and 'path' values swapping from JDK1.8 and JDK1.7 directories but didn't work.
Sorry to post here, I'm not sure is this error related to Codename One or Netbeans,
Apology if it is not related to Codename One.
Thanks.