Executor ? ExecutorService API? ??? ??? ???? ???? ??? ??? ?????. ?? java.util.concurrent ???? ?????. ??? ??, ?? ? ???? ???? ????? ?? ????? ????? ??????.
Executors? ??? ??? ExecutorService ????? ???? ???? ?? ??? ???? ???? java.util.concurrent ???? ???? ??????. ??? ? ?? ????? ????? ??? ???? ??? ????? ?? ???? ??? ? ????.
Executor API Java 1.5?? ?? ??? ???????. Execute(Runnable command) ???? ?????. ??? ?? ??????? ExecutorService? ? ?????? ?????. ??? ??? ?? ??? ???? ??? ?? ??? ?? ??? ???? ?? ???? void? ???? ????.
ExecutorService API Java 1.5?? ?? ??? ????????. ?? ??????? ?? ??? ???? ???? ?? ??? ?????. Runnable ? Callable ??? ?? ?????. ?? ??? ?? Future? ?????. ??? ?? ?? ???? ?????.
submit()? Callable ?? Runnable ??? ???? Future ?? ??? ?????.
invokeAny()? ??? ?? ??? ???? ? ??? ???? ?? ??? ?????.
invokeAll()? ??? ?? ??? ???? ?? ??? ????? Future ?? ?? ?? ???? ?????.
shutdown() ??? ???? ?? ????? ??? ? ??? ???? ????. ?? ?? ?? ?? ??? ???? ??? ???? ?????.
shutdownNow()? Executor ???? ?? ????? ????? ?? ?? ?? ??? ??? ????? ??? ????.
awaitTermination(long timeout, TimeUnit ??)? ?? ??? ????? ?? ??? ????? ?? ???? ??? ??? ??/?????. ?? ???? ?????.
ExecutorService ??
- FixThreadPool ??? ?? ???? ?? ?? ??? ?? ?????. ??? ??? ??? ?????. ??? ??? ???? ??? ??? ??? ?? ?????. ???? ?? ??? ??? ???? ?????.
ExecutorService fixedThreadPool = Executors.newScheduledThreadPool(5); Future<String> submit = fixedThreadPool.submit(() -> { System.out.println("Task executed by " + Thread.currentThread().getName()); return Thread.currentThread().getName(); }); fixedThreadPool.shutdown();
- CachedThreadPool ??? ?? ???? ????? ?? ?? ??? ??? ?? ???? ?????. ???? 60? ?? ?? ???? ?????. ?? ?? ??? ?????. ?? ?? ?? ? ???? ????? ???? ???? ? ? ?????.
ExecutorService fixedThreadPool = Executors.newCachedThreadPool(); Future<String> submit = fixedThreadPool.submit(() -> { System.out.println("Task executed by " + Thread.currentThread().getName()); return Thread.currentThread().getName(); }); fixedThreadPool.shutdown();
- SingleThreadExecutor ?? ???? ???? ??? ????? ?????. ???? ?? ??? ????.
ExecutorService fixedThreadPool = Executors.newSingleThreadExecutor(); Future<String> submit = fixedThreadPool.submit(() -> { System.out.println("Task executed by " + Thread.currentThread().getName()); return Thread.currentThread().getName(); }); fixedThreadPool.shutdown()
- ScheduledThreadPool/ScheduledExecutor ???? ???? ??? ????? ?? ?? ?? ???? ??? ?? ??? ?? trhead ?? ?????.
ScheduledExecutorService scheduler = Executors.newSingleThreadScheduledExecutor(); // Single-threaded scheduler ScheduledExecutorService scheduler = Executors.newScheduledThreadPool(5); // Multi-threaded scheduler
scheduler.schedule(task, 10, TimeUnit.SECONDS); // Schedule task to run after 10 seconds. scheduler.scheduleAtFixedRate(task, 5, 10, TimeUnit.SECONDS); //It schedules a task to run every 10 seconds with an initial delay of 5 seconds. scheduler.scheduleWithFixedDelay(task, 5, 10, TimeUnit.SECONDS); //It schedules a task to run with a fixed delay of 10 seconds between the end of one execution and the start of the next, with an initial delay of 5 seconds. scheduler.schedule(() -> scheduler.shutdown(), 20, TimeUnit.SECONDS); //It schedules a shutdown of the scheduler after 20 seconds to stop the example.
ExecutorService? ?? ??
task? ExecutorService? submit()? submit() ???? ???? ??? ? ????. Execute() ???? Runnable ??? ???? ?? submit()? Runnable ? Callable ??? ?? ??? ? ????."
executor.execute(new RunnableTask()); //fire-and-forgot executor.submit(new CallableTask()); //returns the status of task
ExecutorService ??
???? ????? ExecutorService? ???? ?? ?????. shutdown() ? shutdownNow() ???? ???? ? ??? ??? ? ????.
executor.shutdown(); // Initiates an orderly shutdown" executor.shutdownNow(); // Attempts to stop all actively executing tasks. executor.awaitTermination(long timeout, TimeUnit unit); //blocks the thread until all tasks are completed or timeout occurs or current thread is interrupted, whichever happens first. Returns `true `is tasks completed, otherwise `false`.
???? ?? ??
executor.shutdown(); try { // Wait for tasks to complete or timeout if (!executor.awaitTermination(120, TimeUnit.SECONDS)) { // If the timeout occurs, force shutdown executor.shutdownNow(); } } catch (InterruptedException ex) { executor.shutdownNow(); Thread.currentThread().interrupt(); }
Runnable ??
- Runnable? ??????? ???? ??? ? ?? ??? ?????.
- Threads ?? Executor ???? ???? Runnable ??? ??? ? ????.
- Runnable?? run() ???? ??? ???? ???? ????.
- ??? ??? throw? ? ????.
??? ??
- 1.5?? ?????
- call() ???? ??? V ??? ?????.
- throw Exception ??? ???? ???, ??? ??? throw? ? ????.
??? ???
- ?? ??? ???? ??? ?????.
- ??? ?? ?? ??? ??? ? Future? ?????.
- boolean isDone() ?? ?? ??? ?????. ???? True, ??? ??? False.
- boolean cancel(boolean mayInterruptIfRunning) ??? ??? ?????. mayInterruptIfRunning? false? ???? ?? ??? ??? ???? ????.
- boolean isCancelled()? ??? ?????? ??? ?????.
- V get()? ?? ??? ?????. ??? ???? ??? ???? ?????.
- V get(long timeout, TimeUnit ??) ??? ?? ??? ??? ??? ?? ??? ?? ?? ??? ?? ??? ?????. ??? ???? ??? ??? ?? ??? TimeoutException? ?????.
??? ??? ??!!!
???? ?? ?? ?????
? ??? Java? ??? ??? ??? ?? ?????. ??? ??? PHP ??? ????? ?? ?? ??? ?????!

? AI ??

Undress AI Tool
??? ???? ??

Undresser.AI Undress
???? ?? ??? ??? ?? AI ?? ?

AI Clothes Remover
???? ?? ???? ??? AI ?????.

Clothoff.io
AI ? ???

Video Face Swap
??? ??? AI ?? ?? ??? ???? ?? ???? ??? ?? ????!

?? ??

??? ??

???++7.3.1
???? ?? ?? ?? ???

SublimeText3 ??? ??
??? ??, ???? ?? ????.

???? 13.0.1 ???
??? PHP ?? ?? ??

???? CS6
??? ? ?? ??

SublimeText3 Mac ??
? ??? ?? ?? ?????(SublimeText3)

??? ??











?? ?? ?? ??? ??? ?? ??? ??, ? ? ?? ? ??? ?????. 1. ??? ?? ???? ?? ???? ???-????, ? ??? ??? ??? ? ????, Hashmap? ???-??? ?? ??? ??? ???? ????. 2. NULL ? ?? ???? HashMap? ??? NULL ?? ?? ? ?? ???? ?? HashTable? NULL ?? ?? ???? ??? NullPointerException? ?????. 3. ????? ??? ????? ?? ??? ?? ?? ? ????? HashTable? ? ??? ?? ?? ??? ????. ?? ConcurrenTashMap? ???? ?? ????.

Java? ?? ??? ??? ?? ??? ??? ?? ??? ??? ?? ??? ?? ?? ??? ???? ??? ?? ???? ?????. 1. ??? ???? ??? ?? ?? ? ???? ?? ??? ???? ?? ?? ??? ? ????. 2. ???? ?? ??? ???? ??? ?? ???? ?? ?? ??? ???????. 3. ?? ???? ?? ?? ?? ? ???? ???? ?? NULL ?? ??? ? ????. 4. ?? ???? ??? ?? ?? ? ??? ?????? ?? ??? ??? ?? ?? ??? ????? ??? ??? ??? ??????? ?? ???? ??????.

staticmethodsininterfaceswereIntRectionSelffacesswithinteffaceswithinteffaceswithintintinjava8toallowutilityFunctionswithinterfaceitswithinteffaceswithinterfaceffaces

JIT ????? ??? ???, ??? ?? ? ???, ?? ?? ? ???? ? ? ?? ?? ??? ? ?? ??? ?? ??? ??????. 1. ??? ???? ?? ?? ??? ??? ?? ?? ???? ??? ?? ?????. 2. ??? ?? ? ??? ?? ?? ? ??? ???? ?? ?? ???; 3. ?? ??? ??? ?? ??? ???? ???? ???? ? ?? ?? ??? ?????. 4. ?? ??? ?? ??? ??? ???? ???? ?? ? ??? ???? ?? ??? ?????.

???? ??? ??? Java?? ??? ?? ???? ??? ?? ? ? ??? ??? ???? ? ?????. ?? ???? ??? ??, ??? ?? ??? ?? ?? ??? ??? ????? ???? ????? ?????. ?? ??? ??? ??, ????? ? ??? ????, ?? ??? ??? ?????? ? ?? ? ?? ?????.

injava, thefinalkeywordpreventsavariable'svalue'svalueffrombeingchangedafterassignment, butitsbehaviordiffersforprimitivesandobjectreences.forprimitivevariables, asinfinalintmax_speed = 100; wherereassoncesanerror.forobjectref

??? ? ?? ??? ???? : ????? ?? ?. 1. int? ???? ???? ?? ?? ?? ? ??? ???? ?????. 2. ?? ? ???? (int) myDouble ??? ?? ?? ??? ?????. ?? ??? ??? ?? ??? ?? ??, ?? ?? ?? ???? ?? ??? ?? ???? ?? ?????. ???? ? ??? ??? ????. ?? ??? ??? ??? ??? ??? ?? ??? ??? ? ??? ?? ???? ??? ??? ??? ??? ? ??? ?? ??? ?? ??? ?? ?? ? ? ????. ?? ?? ??? ?? ??? ??? ??? ??? ? ??????.

??? ??? ?? ?? ??? ????? ? ???? ????? ???? ?? ???? ?? ???? ?????. ?? ??? ??? ????. ?? ?? ?? ??? ???? ???? ?? ?? ??? ??? ?? ?? ??? ??? ?????. ?? ??? ??? ????. ?? ??? ?? ??? ?? ?? ??? ?? ?? ??? ???? NewClass ()? ??? ?? ???? ????. ?? ??? ?? ??? ???? ?? ??? ?? ? ? ??? ?? ?? ??? ????? ????? ?????. ?? ??, ?? ?????? ?????, ??? ? ?? ????? ??? ?? ?????. ???? ?? ?? ??? ???? ?? ???? ?? ? ??? ???? ?? ??? ?? ?????? ?????. ???? ???? ??? ??, ?? ?? ? ?? ??? ????, ?? ?? ???? ?????.
