N Core Java Concurrency N - UC Santa Barbara

2y ago
13 Views
3 Downloads
689.04 KB
6 Pages
Last View : 8d ago
Last Download : 3m ago
Upload by : Hayden Brunner
Transcription

Get More Refcardz! Visit refcardz.com#61CONTENTS INCLUDE:nnnnnnAbout Java ConcurrencyConceptsProtecting Shared DataConcurrent CollectionsThreadsThreads Coordination and more.Core Java ConcurrencyBy Alex MillerAbout java concurrencyFrom its creation, Java has supported key concurrencyconcepts such as threads and locks. This guide helpsJava developers working with multi-threaded programsto understand the core concurrency concepts and howto apply them. Topics covered in this guide include builtin Java language features like Thread, synchronized, andvolatile, as well as new constructs added in JavaSE 5 such asLocks, Atomics, concurrent collections, thread coordinationabstraction, and Executors. Using these building blocks,developers can build highly concurrent and thread-safe Javaapplications.www.dzone.comCore Java ConcurrencyImmutableobjectsFinal field semantics can be leveraged to create thread-safe immutableobjects that can be shared and read without synchronization. To make animmutable object you should guarantee that: The object is safely published (the this reference does not escapeduring construction) All fields are declared final Object reference fields must not allow modifications anywhere in theobject graph reachable from the fields after construction. The class should be declared final (to prevent a subclass fromsubverting these rules)Writing thread-safe Java programs requires a developer touse proper locking when modifying shared data. Lockingestablishes the orderings needed to satisfy the Java MemoryModel and guarantee the visibility of changes to other threads.This section describes key Java Concurrency concepts that areused throughout this DZone Refcard.HotTipTable 1: Java Concurrency ConceptsConceptDescriptionJava MemoryModelThe Java Memory Model (JMM) was defined in Java SE 5 (JSR 133) andspecifies the guarantees a JVM implementation must provide to a Javaprogrammer when writing concurrent code. The JMM is defined in termsof actions like reading and writing fields, and synchronizing on a monitor.These actions form an ordering (called the “happens-before” ordering)that can be used to reason about when a thread sees the result of anotherthread’s actions, what constitutes a properly synchronized program, how tomake fields immutable, and more.MonitorIn Java, every object contains a “monitor” that can be used to providemutual exlusion access to critical sections of code. The critical section isspecified by marking a method or code block as synchronized. Onlyone thread at a time is allowed to execute any critical section of code for aparticular monitor. When a thread reaches this section of code, it will waitindefinitely for the monitor to be released if another thread holds it. Inaddition to mutual exlusion, the monitor allows cooperation through thewait and notify operations.Atomic fieldassignmentAssigning a value to a field is an atomic action for all types except doublesand longs. Doubles and longs are allowed to be updated as two separateoperations by a JVM implementation so another thread might theoreticallysee a partial update. To protect updates of shared doubles and longs,mark the field as a volatile or modify it in a synchronized block.Race conditionA race condition occurs when more than one thread is performing a seriesof actions on shared resources and several possible outcomes can existbased on the order of the actions from each thread are performed.Data raceA data race specifically refers to accessing a shared non-finalnon-volatile field from more than one thread without propersynchronization. The Java Memory Model makes no guarantees aboutthe behavior of unsynchronized access to shared fields. Data races arelikely to cause unpredictable behavior that varies between architecturesand machines.Final fieldsAt the end of construction, an object undergoes “final field freeze”, whichguarantees that if the object is safely published, all threads will see thevalues set during construction even in the absence of synchronization.Final field freeze includes not just the final fields in the object but also allobjects reachable from those final fields.Protecting shared dataConceptsSafe publicationFinal fields,continuedData changed outside synchronization has NOspecified semantics under the Java Memory Model!The JVM is free to reorder instructions and limitvisibility in ways that are likely to be surprising to adeveloper.SynchronizedEvery object instance has a monitor that can be locked byone thread at a time. The synchronized keyword can bespecified on a method or in block form to lock the monitor.Modifying a field while synchronized on an object guaranteesthat subsequent reads from any other thread synchronized onthe same object will see the updated value. It is important tonote that writes outside synchronization or synchronized on adifferent object than the read are not necessarily ever visible toother threads.Get More Refcardz(They’re free!)nnnnnIt is unsafe to publish a reference to an object before construction of theobject is complete. One way that the this reference can escape is byregistering a listener with a callback during construction. Another commonscenario is starting a Thread from the constructor. In both cases, thepartially constructed object is visible to other threads.nnFinal fields must be set to an explicit value by the end of objectconstruction or the compiler will emit an error. Once set, final field valuescannot be changed. Marking an object reference field as final doesnot prevent objects referenced from that field from changing later. Forexample, a final ArrayList field cannot be changed to a differentArrayList, but objects may be added or removed on the list instance.DZone, Inc.Authoritative contentDesigned for developersWritten by top expertsLatest tools & technologiesHot tips & examplesBonus content onlineNew issue every 1-2 weeksSubscribe Now for FREE!Refcardz.com www.dzone.com

2The synchronized keyword can be specified on a method orin block form on a particular object instance. If specified on anon-static method, the this reference is used as the instance.In a synchronized static method, the Class defining the methodis used as the instance.Java Concurrency}public void run() {while(! stop) {// . do processing}}}LockThe java.util.concurrent.locks package has a standard Lockinterface. The ReentrantLock implementation duplicates thefunctionality of the synchronized keyword but also providesadditional functionality such as obtaining information aboutthe state of the lock, non-blocking tryLock(), and interruptiblelocking.Example of using an explicit ReentrantLock instance:HotTipMarking an array as volatile does not make entriesin the array volatile! In this case volatile applies onlyto the array reference itself. Instead, use a class likeAtomicIntegerArray to create an array with volatilelike entries.Atomic classesOne shortcoming of volatile is that while it provides visibilityguarantees, you cannot both check and update a volatilefield in a single atomic call. The java.util.concurrent.atomicpackage contains a set of classes that support atomiccompound actions on a single value in a lock-free mannersimilar to volatile.public class Counter {private final Lock lock new ReentrantLock();private int value 0;public int increment() {lock.lock();try {return value;} finally {lock.unlock();}}public class Counter {private AtomicInteger value new AtomicInteger();public int next() {return value.incrementAndGet();}}}ReadWriteLockThe java.util.concurrent.locks package also containsa ReadWriteLock interface (and ReentrantReadWriteLockimplementation) which is defined by a pair of locks forreading and writing, typically allowing multiple concurrentreaders but only one writer. Example of using an explicitReentrantReadWriteLock to allow multiple concurrent readers:The incrementAndGet method is just one example of acompound action available on the Atomic classes.Atomic classes are provided for booleans, integers, longs,and object references as well as arrays of integers, longs, andobject references.ThreadLocalpublic class Statistic {private final ReadWriteLock lock new ReentrantReadWriteLock();private int value;One way to contain data within a thread and make lockingunnecessary is to use ThreadLocal storage. Conceptually aThreadLocal acts as if there is a variable with its own versionin every Thread. ThreadLocals are commonly used for stashingper-Thread values like the “current transaction” or otherresources. Also, they are used to maintain per-thread counters,statistics, or ID generators.public void increment() {lock.writeLock().lock();try {value ;} finally {lock.writeLock().unlock();}}public class TransactionManager {private static final ThreadLocal Transaction currentTransaction new ThreadLocal Transaction () {@Overrideprotected Transaction initialValue() {return new NullTransaction();}};public Transaction currentTransaction() {Transaction current currentTransaction.get();if(current.isNull()) {current new }return current;}}public int current() {lock.readLock().lock();try {return value;} finally {lock.readLock().unlock();}}}volatileThe volatile modifier can be used to mark a field and indicatethat changes to that field must be seen by all subsequentreads by other threads, regardless of synchronization. Thus,volatile provides visibility just like synchronization but scopedonly to each read or write of the field. Before Java SE 5,the implementation of volatile was inconsistent betweenJVM implementations and architectures and could not berelied upon. The Java Memory Model now explicitly definesvolatile’s behavior.Concurrent CollectionsA key technique for properly protecting shared data is toencapsulate the synchronization mechanism with the classholding the data. This technique makes it impossible toimproperly access the data as all usage must conform to thesynchronization protocol. The java.util.concurrent packageholds many data structures designed for concurrent use.Generally, the use of these data structures yields far betterperformance than using a synchronized wrapper around anunsynchronized collection.An example of using volatile as a signaling flag:public class Processor implements Runnable {private volatile boolean stop;public void stopProcessing() {stop true;DZone, Inc. www.dzone.com

3Concurrent lists and setsIn these cases, BlockingQueue provides methods that eitherblock forever or block for a specified time period, waiting forthe condition to change due to the actions of another thread.Table 5 demonstrates the Queue and BlockingQueue methods interms of key operations and the strategy for dealing with thesespecial conditions.The java.util.concurrent package contains three concurrent Listand Set implementations described in Table 2.Table 2: Concurrent Lists and ArraySet provides copy-on-write semanticswhere each modification of the data structure results in anew internal copy of the data (writes are thus very expensive).Iterators on the data structure always see a snapshot of thedata from when the iterator was ava ConcurrencyTable 5: Queue and BlockingQueue methodsSimilar to CopyOnWriteArraySet,CopyOnWriteArrayList uses copy-on-write semantics toimplement the List row ExceptionaddremoveelementReturn special valueofferpollpeekBlock foreverputtaken/aBlock with timerofferpolln/aBlocking QueueConcurrentSkipListSet (added in Java SE 6) providesconcurrent access along with sorted set functionality similarto TreeSet. Due to the skip list based implementation,multiple threads can generally read and write within the setwithout contention as long as they aren’t modifying the sameportions of the set.Several Queue implementations are provided by the JDK andtheir relationships are discribed in Table 6.Table 6: Queue ImplementationsConcurrent mapsThe java.util.concurrent package contains an extension tothe Map interface called ConcurrentMap, which provides someextra methods described in Table 3. All of these methodsperform a set of actions in the scope of a single atomic action.Performing this set of actions outside the map would introducerace conditions due to making multiple (non-atomic) calls onthe map.MethodDescriptionPriorityQueuePriorityQueue is the only non-concurrent queueimplementation and can be used by a single thread to collectitems and process them in a sorted order.ConcurrentLinkedQueueAn unbounded linked list queue implementation and the onlyconcurrent implementation not supporting BlockingQueue.ArrayBlockingQueueA bounded blocking queue backed by an array.LinkedBlockingQueueAn optionally bounded blocking queue backed by a linkedlist. This is probably the most commonly used Queueimplementation.PriorityBlockingQueueAn unbounded blocking queue backed by a heap. Itemsare removed from the queue in an order based on theComparator associated with the queue (instead of FIFOorder).DelayQueueAn unbounded blocking queue of elements, each with a delayvalue. Elements can only be removed when their delay haspassed and are removed in the order of the oldest expireditem.SynchronousQueueA 0-length queue where the producer and consumer blockuntil the other arrives. When both threads arrive, the value istransferred directly from producer to consumer. Useful whentransferring data between threads.Table 3: ConcurrentMap methodsMethodDescriptionputIfAbsent(K key, V value) : VIf the key is not in the map then put the key/value pair, otherwise do nothing. Returns oldvalue or null if not previously in the map.remove(Object key, Object value): booleanIf the map contains key and it is mapped tovalue then remove the entry, otherwise donothing.replace(K key, V value) : VIf the map contains key then replace withnewValue, otherwise do nothing.replace(K key, V oldValue, VnewValue) : booleanIf the map contains key and it is mappedto oldValue then replace with newValue,otherwise do nothing.DequesThere are two ConcurrentMap implementations available asshown in Table 4.A double-ended queue or Deque (pronounced “deck”) wasadded in Java SE 6. Deques support not just adding from oneend and removing from the other but adding and removingitems from both ends. Similarly to BlockingQueue, there is aBlockingDeque interface that provides methods for blockingand timeout in the case of special conditions. Table 7 showsthe Deque and BlockingDeque methods. Because Deque extendsQueue and BlockingDeque extends BlockingQueue, all of thosemethods are also available for use.Table 4: ConcurrentMap oncurrentHashMap provides two levels of internalhashing. The first level chooses an internal segment, and thesecond level hashes into buckets in the chosen segment. Thefirst level provides concurrency by allowing reads and writesto occur safely on each segment in p (added in Java SE 6) providesconcurrent access along with sorted map functionality similarto TreeMap. Performance bounds are similar to TreeMapalthough multiple threads can generally read and write fromthe map without contention as long as they aren’t modifyingthe same portion of the map.Table 7: Deque and BlockingDeque methodsQueuesQueues act as pipes between “producers” and “consumers”.Items are put in one end of the pipe and emerge from theother end of the pipe in the same “first-in first-out” (FIFO)order.First orLastQueueHeadTailBlockingQueueThe Queue interface was added to java.util in Java SE 5 andwhile it can be used in single-threaded scenarios, it is primarilyused with multiple producers or one or more consumers, allwriting and reading from the same queue.HeadTailStrategyInsertRemoveExamineThrow exceptionaddFirstremoveFirstgetFirstReturn special valueofferFirstpollFirstpeekFirstThrow exceptionaddLastremoveLastgetLastReturn special valueofferLastpollLastpeekLastBlock foreverputFirsttakeFirstn/aBlock with timerofferFirstpollFirstn/aBlock foreverputLasttakeLastn/aBlock with timerofferLastpollLastn/aOne special use case for a Deque is when add, remove, andexamine operations all take place on only one end of thepipe. This special case is just a stack (first-in-last-out retrievalorder). The Deque interface actually provides methods that usethe terminology of a stack: push(), pop(), and peek(). TheseThe BlockingQueue interface is in java.util.concurrent andextends Queue to provide additional choices of how to handlethe scenario where a queue may be full (when a producer addsan item) or empty (when a consumer reads or removes an item).DZone, Inc.Interface www.dzone.com

4methods map to addFirst(), removeFirst(), and peekFirst()methods in the Deque interface and allow you to use any Dequeimplementation as a stack. Table 8 describes the Deque andBlockingDeque implementations in the JDK. Note that Dequeextends Queue and BlockingDeque extends BlockingQueueJava Concurrencymaking progress. Livelock occurs when threads spend allof their time negotiating access to a resource or detectingand avoiding deadlock such that no thread actually makesprogress.Thread CoordinationTable 8: DequesClassDescriptionLinkedListThis long-standing data structure has been retrofitted in Java SE6 to support the Deque interface. You can now use the standardDeque methods to add or remove from either end of the list(many of these methods already existed) and also use it as a nonsynchronized stack in place of the fully synchronized Stack class.ArrayDequeThis implementation is not concurrent and supports unboundedqueue length (it resizes dynamically as needed).LinkedBlockingDequeThe only concurrent deque implementation, this is a blockingoptionally-bounded deque backed by a linked list.wait / notifyThe wait / notify idiom is appropriate whenever one threadneeds to signal to another that a condition has been met, especially as an alternative to sleeping in a loop and polling thecondition. For example, one thread might wait for a queue tocontain an item to process. Another thread can signal the waiting threads when an item is added to the queue.The canonical usage pattern forThreadsIn Java, the java.lang.Thread class is used to represent anapplication or JVM thread. Code is always being executed inthe context of some Thread class (use Thread.currentThread()to obtain your own Thread).The most obvious way to communicate between threads is forone thread to directly call a method on another Thread object.Table 9 shows methods on Thread that can be used for directinteraction across threads.public void change() {synchronized(lock) {flag true;lock.notifyAll();}}}Table 9: Thread coordination methodsDescriptionstartStart a Thread instance and execute its run() method.joinBlock until the other Thread exitsinterruptInterrupt the other thread. If the thread is blocked in a method thatresponds to interrupts, an InterruptedException will be thrown in theother thread, otherwise the interrupt status is set.stop, suspend,resume, destroyThese methods are all deprecated and should not be used. Theyperform dangerous operations depending on the state of the thread inquestion. Instead, use interrupt() or a volatile flag to indicateto a thread what it should do.and notify is as follows:public void waitTillChange() {synchronized(lock) {while(! flag) {try {lock.wait();} catch(InterruptedException e) {}}}}Thread CommunicationThread Methodwaitpublic class Latch {private final Object lock new Object();private volatile boolean flag false;Some important things to note about this code: Always call wait, notify, and notifyAll inside a synchronizedlock or an IllegalMonitorStateException will be thrown. Always wait inside a loop that checks the condition beingwaited on – this addresses the timing issue if anotherthread satisfies the condition before the wait begins.Also, it protects your code from spurious wake-ups thatcan (and do) occur. Always ensure that you satisfy the waiting conditionbefore calling notify or notifyAll. Failing to do so willcause a notification but no thread will ever be able toescape its wait loop.Uncaught exception handlersThreads can specify an UncaughtExceptionHandler that willreceive notification of any uncaught exception that cause athread to abruptly terminate.ConditionIn Java SE 5, a new java.util.concurrent.locks.Conditionclass was added. Condition implements the wait/notifysemantics in an API but with several additional features such asthe ability to create multiple Conditions per Lock, interruptiblewaiting, access to statistics, etc. Conditions are obtained froma Lock instance as follows:Thread t new Thread(runnable);t.setUncaughtExceptionHandler(new Thread.UncaughtExceptionHandler() {void uncaughtException(Thread t, Throwable e) {// get Logger and log uncaught exception}});t.start();Deadlockpublic class LatchCondition {private final Lock lock new ReentrantLock();private final Condition condition lock.newCondition();private volatile boolean flag false;A deadlock occurs when there is more than one thread, eachwaiting for a resource held by another, such that a cycle ofresources and acquiring threads is formed. The most obviouskind of resource is an object monitor but any resource thatcauses blocking (such as wait / notify) can qualify.public void waitTillChange() {lock.lock();try {while(! flag) {condition.await();}} finally {lock.unlock();}}Many recent JVMs can detect monitor deadlocks and will printdeadlock information in thread dumps produced from a signal,jstack, or other thread dump tool.In addition to deadlock, some other threading situations arestarvation and livelock. Starvation occurs when threads hold alock for long periods such that some threads “starve” withoutDZone, Inc.public void change() {lock.lock();try { www.dzone.com

5Java Concurrency T invokeAny(Collection ? extends Callable T tasks) T invokeAny(Collection ? extends Callable T tasks,flag true;condition.signalAll();} finally {lock.unlock();}long timeout, TimeUnit unit)}Callable and Future}A Callable is like the familiar Runnable but can return a resultand throw an exception:Coordination classesThe java.util.concurrent package contains several classespre-built for common forms of multi-thread communication.These coordination classes cover most common scenarioswhere wait/notify and Condition might be used and are stronglyperferred for their safety and ease of use. V call() throws Exception;It is common in the executor framework to submit a Callableand receive a Future. A Future is a marker representing aresult that will be available at some point in the future. TheFuture has methods that allow you to either poll or block whilewaiting for the result to be ready. You can also cancel the taskbefore or while it’s executing through methods on Future.CyclicBarrierThe CyclicBarrier is initialized with a participant count.Participants call await() and block until the count is reached,at which point an optional barrier task is executed by the lastarriving thread, and all threads are released. The barrier canbe reused indefinitely. Used to coordinate the start and stop ofgroups of threads.If you need the functionality of a Future where only Runnablesare supported (as in Executor), you can use FutureTask as abridge. FutureTask implements both Future and Runnable sothat you can submit the task as a Runnable and use the taskitself as a Future in the caller.CountDownLatchThe CountDownLatch is initialized with a count. Threads maycall await() to wait for the count to reach 0. Other threads(or same) may call countDown() to reduce count. Not reusableonce the count has reached 0. Used to trigger an unknown setof threads once some number of actions has occurred.SemaphoreA Semaphore manages a set of “permits” that can be checkedout with acquire() which will block until one is available.Threads call release() to return the permit. A semaphore withone permit is equivalent to a mutual exclusion block.ExchangerAn Exchanger waits for threads to meet at the exchange()method and swap values atomically. This is similar to using aSynchronousQueue but data values pass in both directions.ExecutorService implementationsThe primary implementation of ExecutorService isThreadPoolExecutor. This implementation class provides awide variety of configurable features: Thread pool – specify “core” thread count (optionally prestarted), and max thread count Thread factory – generate threads with customcharacteristics such as a custom name Work queue – specify the queue implementation, whichmust be blocking, but can be bounded or unbounded Rejected tasks – specify the policy for tasks that cannot beaccepted due to a full input queue or unavailable worker Lifecycle hooks – overridden to extend to override keypoints in the lifecycle like before or after task executionTask excecution Shutdown – stop incoming tasks and wait for executingtasks to completeMany concurrent Java programs need a pool of workersexecuting tasks from a queue. The java.util.concurrentpackage provides a solid foundation for this style of workmanagement.is an extension ofthat provides the ability to scheduletasks for completion rather than using FIFO semantics. Forcases where java.util.Timer is not sophisticated enough,the ScheduledThreadPoolExecutor often provides hreadPoolExecutorExecutorServiceThe Executor and more expansive ExecutorService interfacesdefine the contract for a component that can executetasks. Users of these interfaces can get a wide variety ofimplementation behaviors behind a common interface.The Executors class contains many static methods (seeTable 10) for creating prepackaged ExecutorService andScheduledExecutorService instances that will cover a widevariety of common use cases.The most generic Executor interface accepts jobs only in theform of Runnables:Table 10: Executors factory methods void execute(Runnable command)The ExecutorService extends Executor to add methods thattake both Runnable and Callable task and collections of tasks: Future ? submit(Runnable task) Future T submit(Callable T task) Future T submit(Runnable task, T result) List Future T invokeAll(Collection ? extendsCallable T tasks) List Future T invokeAll(Collection ? urns an ExecutorService with exactlyone thread.newFixedThreadPoolReturns an ExecutorService with a fixednumber of threads.newCachedThreadPoolReturns an ExecutorService with a varyingsize thread pool.newSingleThreadScheduledExecutorReturns a ScheduledExecutorServicewith a single thread.newScheduledThreadPoolReturns a ScheduledExecutorServicewith a core set of threads.Callable T tasks, long timeout, TimeUnit unit)DZone, Inc. www.dzone.com

6The following example creates a fixed thread pool and submitsa long-running task to it:produced by one of the Executor factory methods; often thiswill be simpler and more flexible.CompletionServiceint processors rService executor Executors.newFixedThreadPool(processors);Future Integer futureResult executor.submit(new Callable Integer () {public Integer call() {// long running computation that returns an integer}});Integer result futureResult.get();Java ConcurrencyBeyond the common pattern of a pool of workers and an inputqueue, it is common for each task to produce a result that mustbe accumulated for further processing. The CompletionServiceinterface allows a user to submit Callable and Runnable tasksbut also to take or poll for results from the results queue:// block for result Future V take() – take if available Future V poll() – block until available Future V poll(long timeout, TimeUnit unit) – blockIn this example the call that submits the task to the executorwill not block but return immediately. The last line will block onthe get() call until the result is available.until timeout endsThe ExecutorCompletionService is the standardimplementation of CompletionService. It is constructed withan Executor that provides the input queue and worker threadpool.covers almost all situations where you wouldpreviously create Thread objects or thread pools. Any timeyour code is constructing a Thread directly, consider whetheryou could accomplish the same goal with an ExecutorServiceExecutorServiceWhen sizing thread pools, it is often useful to base the size on the number of logical cores in the machine running theapplication. In Java, you can get that value by calling Runtime.getRuntime().availableProcessors(). The number of availableprocessors may change during the lifetime of a JVM.HotTipA BOUT t h e A u t h o rRECO M M ENDED B o o kAlex Miller is a Tech Lead with Terracotta Inc, the mak-Developing, testing, and debugging multithreaded programs can still be very difficult; it is all too easy to createconcurrent programs that appear to work, but fail when itmatters most: in production, under heavy load. Java Concurrency in Practice arms readers with both the theoreticalunderpinnings and concrete techniques for building reliable, scalable, maintainable concurrent applications. Rather than simplyoffering an inventory of concurrency APIs and mechanisms, it providesdesign rules, patterns, and mental models that make it easier to buildconcurrent programs that are both correct and performant.ers of the open-source Java clustering product Terracotta.Prior to Terracotta, Alex worked at BEA Systems and wasChief Architect at MetaMatrix. His interests include Java,concurrency, distributed systems, query languages, andsoftware design. Alex enjoys tweeting as @puredangerand writing his blog at http://tech.puredanger.com and is a frequentspeaker at user group meetings and conferences. In St. Louis, Alex isthe founder of the Lambda Lounge group for the study of functional anddynamic languages and the Strange Loop developer confe

Core Java Concurrency From its creation, Java has supported key concurrency concepts such as threads and locks. This guide helps Java developers working with multi-threaded programs to understand the core concurrency concepts and how to apply them. Topics covered in this guide include built-in Java

Related Documents:

java.io Input and output java.lang Language support java.math Arbitrary-precision numbers java.net Networking java.nio "New" (memory-mapped) I/O java.rmi Remote method invocations java.security Security support java.sql Database support java.text Internationalized formatting of text and numbers java.time Dates, time, duration, time zones, etc.

Java Version Java FAQs 2. Java Version 2.1 Used Java Version This is how you find your Java version: Start the Control Panel Java General About. 2.2 Checking Java Version Check Java version on https://www.java.com/de/download/installed.jsp. 2.3 Switching on Java Console Start Control Panel Java Advanced. The following window appears:

Multi-Core in JAVA/JVM Tommi Zetterman Concurrency Prior to Java 5: Synchronization and Threads Java has been supporting concurrency from the beginning. Typical Java execution environment consists of Java Virtual Machine (JVM) which executes platform-in

devoted to designing concurrency control methods for RTDBS and to evaluating their performance. Most of these algorithms use serializability as correctness criteria and are based on one of the two basic concurrency control mechanisms: Pessimistic Concurrency Control [3, 12] or Optimistic Concurrency Control [2, 4, 5, 6, 11]. However, 2PL

Concurrency control Concurrency control in DBS methods for scheduling the operations of database transactions in a way which guarantees serializability of all transactions ("between system start and shutdown") Primary concurrency control methods – Locking (most important) – Optimistic concurrency control – Time stamps

CORE JAVA TRAINING COURSE CONTENT SECTION 1 : INTRODUCTION Introduction about Programming Language Paradigms Why Java? Flavors of Java. Java Designing Goal. Role of Java Programmer in Industry Features of Java Language. Installing Java Di

3. _ is a software that interprets Java bytecode. a. Java virtual machine b. Java compiler c. Java debugger d. Java API 4. Which of the following is true? a. Java uses only interpreter b. Java uses only compiler. c. Java uses both interpreter and compiler. d. None of the above. 5. A Java file with

APPLIED ENGLISH GRAMMAR AND COMPOSITION [For Classes IX & X] English (Communicative) & English (Language and Literature) By Dr Madan Mohan Sharma M.A., Ph.D. Former Head, Department of English University College, Rohtak New Saraswati House (India) Pvt. Ltd. Second Floor, MGM Tower, 19 Ansari Road, Daryaganj, New Delhi-110002 (India) Ph: 91-11-43556600 Fax: 91-11-43556688 E-mail: delhi .