This presentation is about advanced multithreading and concurrency in Java. I have tried my best to explain the concepts with code. Feel free to reach me if you have any questions or concerns.
The document discusses threads and multithreading in Java. It defines a thread as a single sequential flow of control within a program. Multithreading allows a program to be divided into multiple subprograms that can run concurrently. Threads have various states like newborn, runnable, running, blocked, and dead. The key methods for managing threads include start(), sleep(), yield(), join(), wait(), notify(). Synchronization is needed when multiple threads access shared resources to prevent inconsistencies. Deadlocks can occur when threads wait indefinitely for each other.
Java Hibernate Programming with Architecture Diagram and Examplekamal kotecha
Java Hibernate Introduction, Architecture and Example with step by step guidance to run the program especially for students and teachers.
Learn More @ http://java2all.com/technology/hibernate
This document discusses exception handling in C++ and Java. It defines what exceptions are and explains that exception handling separates error handling code from normal code to make programs more readable and robust. It covers try/catch blocks, throwing and catching exceptions, and exception hierarchies. Finally, it provides an example of implementing exception handling in a C++ program to handle divide-by-zero errors.
- Java threads allow for multithreaded and parallel execution where different parts of a program can run simultaneously.
- There are two main ways to create a Java thread: extending the Thread class or implementing the Runnable interface.
- To start a thread, its start() method must be called rather than run(). Calling run() results in serial execution rather than parallel execution of threads.
- Synchronized methods use intrinsic locks on objects to allow only one thread to execute synchronized code at a time, preventing race conditions when accessing shared resources.
This document provides an overview of developing a web application using Spring Boot that connects to a MySQL database. It discusses setting up the development environment, the benefits of Spring Boot, basic project structure, integrating Spring MVC and JPA/Hibernate for database access. Code examples and links are provided to help get started with a Spring Boot application that reads from a MySQL database and displays the employee data on a web page.
The document provides information about Java programming concepts including:
- How to download, install Java, and write a simple "Hello World" program.
- Common operators in Java like arithmetic, assignment, logical, and comparison operators.
- How to compile and run a Java program from the command line.
- Core Java concepts like variables, data types, classes, and methods.
- The document is intended as an introduction to Java programming for beginners.
Spring Boot is a framework that makes it easy to create stand-alone, production-grade Spring based Applications that can be "just run". It takes an opinionated view of the Spring platform and third-party libraries so that new and existing Spring developers can quickly get started with minimal configuration. Key features include automatic configuration of Spring, embedded HTTP servers, starters for common dependencies, and monitoring endpoints.
This document contains an agenda and slides for a presentation on Spring Boot. The presentation introduces Spring Boot, which allows developers to rapidly build production-grade Spring applications with minimal configuration. It demonstrates how to quickly create a "Hello World" application using Spring Boot and discusses some of the features it provides out-of-the-box like embedded servers and externalized configuration. The presentation also shows how to add additional functionality like Thymeleaf templates and actuator endpoints to monitor and manage applications.
This Edureka Java Tutorial will help you in understanding the various fundamentals of Java in detail with examples. Below are the topics covered in this tutorial:
1) Introduction to Java
2) Why learn Java?
3) Features of Java
4) How does Java work?
5) Data types in Java
6) Operators in Java
7) Control Statements in Java
8) Arrays in Java
9) Object Oriented Concepts in Java
Java 10 contains several new features including local variable type inference using the var keyword, time-based release versioning, improved support for Docker containers, and various library enhancements. It focuses on improving performance and usability. Some notable changes include local variable type inference for concise code, parallel full GC for the G1 collector to reduce latency, and application data sharing to improve startup times.
The document discusses several core Java concepts including:
1) Comments in Java code can be single-line or multiline javadoc comments.
2) Classes are fundamental in Java and describe data objects and methods that can be applied to objects.
3) Variables and methods have scopes determined by curly braces and a variable is only available within its scope.
Asynchronous API in Java8, how to use CompletableFutureJosé Paumard
Slides of my talk as Devoxx 2015. How to set up asynchronous data processing pipelines using the CompletionStage / CompletableFuture API, including how to control threads and how to handle exceptions.
The document provides an overview and introduction to Spring Data JPA, including:
1) How Spring Data abstracts away basic data management concepts and supports both relational and non-relational databases.
2) An example of refactoring from plain JPA to Spring Data JPA by defining a repository interface and using built-in query methods.
3) How the Spring Data repository abstraction reduces the effort to implement data access layers through interfaces like Repository.
This document provides an introduction and overview of the Java 8 Stream API. It discusses key concepts like sources of streams, intermediate operations that process stream elements, and terminal operations that return results. Examples are provided to demonstrate filtering, sorting, mapping and collecting stream elements. The document emphasizes that streams are lazy, allow pipelining operations, and internally iterate over source elements.
This document discusses Java Database Connectivity (JDBC) and its components. It describes the two-tier and three-tier JDBC architectures and the roles of the JDBC driver, connection, statement, and result set. It also covers the different types of JDBC drivers and provides code examples to demonstrate how to connect to a database and execute queries using JDBC.
Slides for a lightning talk on Java 8 lambda expressions I gave at the Near Infinity (www.nearinfinity.com) 2013 spring conference.
The associated sample code is on GitHub at https://github.com/sleberknight/java8-lambda-samples
Collections in Java include arrays, iterators, and interfaces like Collection, Set, List, and Map. Arrays have advantages like type checking and known size but are fixed. Collections generalize arrays, allowing resizable and heterogeneous groups through interfaces implemented by classes like ArrayList, LinkedList, HashSet and HashMap. Common operations include adding, removing, and iterating over elements.
Hibernate is an object-relational mapping tool that allows developers to more easily write applications that interact with relational databases. It does this by allowing developers to map Java classes to database tables and columns, so that developers can interact with data through Java objects rather than directly with SQL statements. Hibernate handles the conversion between Java objects and database rows behind the scenes. Some key benefits of using Hibernate include faster data retrieval, avoiding manual database connection management, and easier handling of database schema changes.
Selection Statements
Using if and if...else
Nested if Statements
Using switch Statements
Conditional Operator
Repetition Statements
Looping: while, do, and for
Nested loops
Using break and continue
This presentation provides an overview of oracle's associate and professional Java certifications - gives you ideas on how to prepare and crack the exam with ease.
This document provides an overview of the Java Collections Framework. It discusses core collection interfaces like List, Set, and Map and their common implementations like ArrayList, HashSet, and HashMap. It also covers sorting collections with Comparable and Comparator, searching collections with binary search, and using utility methods in the Collections class. Examples are provided to illustrate usage of various collection classes and methods.
This document discusses reading from and writing to files in Java programs. It explains how to open a file using a Scanner or PrintWriter object, read/write data using methods like next() and println(), and close the file when finished. It recommends storing file data in memory structures, processing it, then writing the results back to improve efficiency over sequential file access. Proper file handling and exception handling are also emphasized.
The document discusses multithreading concepts like concurrency and threading, how to create and control threads including setting priorities and states, and how to safely share resources between threads using synchronization, locks, and wait/notify methods to avoid issues like deadlocks. It also covers deprecated thread methods and increased threading support in JDK 1.5.
Java was developed in 1991 by James Gosling, Mike Sheridan, and Patrick Naughton at Sun Microsystems. It was originally called "Oak" but was renamed to Java in 1995. Java was created to be platform independent, allowing programs written in Java to run on any device without modification, unlike other languages at the time. This platform independence is known as "write once, run anywhere." Java was later acquired by Oracle Corporation in 2010 and continues to be updated with new versions, the most recent being Java SE9 released in September 2017.
Session tracking maintains the state of users between HTTP requests in servlets. Common techniques include cookies, hidden form fields, URL rewriting, and HTTP sessions. Cookies store data on the client side in the browser cache while HTTP sessions store data on the server side. Cookies have limitations on size and security while sessions can store unlimited data securely on the server but end when the browser closes. Both techniques allow servlets to identify returning users and maintain state across requests.
This document contains an agenda and slides for a presentation on Spring Boot. The presentation introduces Spring Boot, which allows developers to rapidly build production-grade Spring applications with minimal configuration. It demonstrates how to quickly create a "Hello World" application using Spring Boot and discusses some of the features it provides out-of-the-box like embedded servers and externalized configuration. The presentation also shows how to add additional functionality like Thymeleaf templates and actuator endpoints to monitor and manage applications.
This Edureka Java Tutorial will help you in understanding the various fundamentals of Java in detail with examples. Below are the topics covered in this tutorial:
1) Introduction to Java
2) Why learn Java?
3) Features of Java
4) How does Java work?
5) Data types in Java
6) Operators in Java
7) Control Statements in Java
8) Arrays in Java
9) Object Oriented Concepts in Java
Java 10 contains several new features including local variable type inference using the var keyword, time-based release versioning, improved support for Docker containers, and various library enhancements. It focuses on improving performance and usability. Some notable changes include local variable type inference for concise code, parallel full GC for the G1 collector to reduce latency, and application data sharing to improve startup times.
The document discusses several core Java concepts including:
1) Comments in Java code can be single-line or multiline javadoc comments.
2) Classes are fundamental in Java and describe data objects and methods that can be applied to objects.
3) Variables and methods have scopes determined by curly braces and a variable is only available within its scope.
Asynchronous API in Java8, how to use CompletableFutureJosé Paumard
Slides of my talk as Devoxx 2015. How to set up asynchronous data processing pipelines using the CompletionStage / CompletableFuture API, including how to control threads and how to handle exceptions.
The document provides an overview and introduction to Spring Data JPA, including:
1) How Spring Data abstracts away basic data management concepts and supports both relational and non-relational databases.
2) An example of refactoring from plain JPA to Spring Data JPA by defining a repository interface and using built-in query methods.
3) How the Spring Data repository abstraction reduces the effort to implement data access layers through interfaces like Repository.
This document provides an introduction and overview of the Java 8 Stream API. It discusses key concepts like sources of streams, intermediate operations that process stream elements, and terminal operations that return results. Examples are provided to demonstrate filtering, sorting, mapping and collecting stream elements. The document emphasizes that streams are lazy, allow pipelining operations, and internally iterate over source elements.
This document discusses Java Database Connectivity (JDBC) and its components. It describes the two-tier and three-tier JDBC architectures and the roles of the JDBC driver, connection, statement, and result set. It also covers the different types of JDBC drivers and provides code examples to demonstrate how to connect to a database and execute queries using JDBC.
Slides for a lightning talk on Java 8 lambda expressions I gave at the Near Infinity (www.nearinfinity.com) 2013 spring conference.
The associated sample code is on GitHub at https://github.com/sleberknight/java8-lambda-samples
Collections in Java include arrays, iterators, and interfaces like Collection, Set, List, and Map. Arrays have advantages like type checking and known size but are fixed. Collections generalize arrays, allowing resizable and heterogeneous groups through interfaces implemented by classes like ArrayList, LinkedList, HashSet and HashMap. Common operations include adding, removing, and iterating over elements.
Hibernate is an object-relational mapping tool that allows developers to more easily write applications that interact with relational databases. It does this by allowing developers to map Java classes to database tables and columns, so that developers can interact with data through Java objects rather than directly with SQL statements. Hibernate handles the conversion between Java objects and database rows behind the scenes. Some key benefits of using Hibernate include faster data retrieval, avoiding manual database connection management, and easier handling of database schema changes.
Selection Statements
Using if and if...else
Nested if Statements
Using switch Statements
Conditional Operator
Repetition Statements
Looping: while, do, and for
Nested loops
Using break and continue
This presentation provides an overview of oracle's associate and professional Java certifications - gives you ideas on how to prepare and crack the exam with ease.
This document provides an overview of the Java Collections Framework. It discusses core collection interfaces like List, Set, and Map and their common implementations like ArrayList, HashSet, and HashMap. It also covers sorting collections with Comparable and Comparator, searching collections with binary search, and using utility methods in the Collections class. Examples are provided to illustrate usage of various collection classes and methods.
This document discusses reading from and writing to files in Java programs. It explains how to open a file using a Scanner or PrintWriter object, read/write data using methods like next() and println(), and close the file when finished. It recommends storing file data in memory structures, processing it, then writing the results back to improve efficiency over sequential file access. Proper file handling and exception handling are also emphasized.
The document discusses multithreading concepts like concurrency and threading, how to create and control threads including setting priorities and states, and how to safely share resources between threads using synchronization, locks, and wait/notify methods to avoid issues like deadlocks. It also covers deprecated thread methods and increased threading support in JDK 1.5.
Java was developed in 1991 by James Gosling, Mike Sheridan, and Patrick Naughton at Sun Microsystems. It was originally called "Oak" but was renamed to Java in 1995. Java was created to be platform independent, allowing programs written in Java to run on any device without modification, unlike other languages at the time. This platform independence is known as "write once, run anywhere." Java was later acquired by Oracle Corporation in 2010 and continues to be updated with new versions, the most recent being Java SE9 released in September 2017.
Session tracking maintains the state of users between HTTP requests in servlets. Common techniques include cookies, hidden form fields, URL rewriting, and HTTP sessions. Cookies store data on the client side in the browser cache while HTTP sessions store data on the server side. Cookies have limitations on size and security while sessions can store unlimited data securely on the server but end when the browser closes. Both techniques allow servlets to identify returning users and maintain state across requests.
1) The document discusses various topics related to Java multithreading including introduction to threads, creation and life cycle of threads, stopping and blocking threads, using thread methods, thread priority, thread synchronization, and inter-thread communication.
2) It provides examples of creating threads by extending the Thread class and implementing the Runnable interface. Methods like start(), run(), sleep(), setPriority(), getPriority() are discussed.
3) Synchronization techniques like synchronized keyword and wait-notify methods are explained with examples to achieve inter-thread communication and coordination.
This presentation will give a brief idea about threads.
This presentation gives you what is required if you are a starter.
This has the lifecycle, multithreading and differences between multithreadind and normal threading.
This presentation even have example programs.
This document provides an overview of Java threading concepts including the base threading topics of thread creation methods, life cycle, priorities, and synchronization. It also covers more advanced topics such as volatile variables, race conditions, deadlocks, starvation/livelock, inter-thread communication using wait/notify, thread pools, and remote method invocation. The document includes examples and explanations of key threading mechanisms in Java like semaphores and message passing.
Multithreading in Java allows executing multiple threads simultaneously by using lightweight subprocesses called threads that can perform tasks in parallel. Threads share the same memory area, making context switching faster than multiprocessing. This allows tasks to be performed together, improving performance over single-threaded processes. Common uses of multithreading include games, animations, and achieving responsiveness in applications.
This document provides an overview of threads in Java. It discusses creating threads by extending Thread or implementing Runnable, synchronization using the synchronized keyword and locks, and wait() and notify() to allow threads to wait for events. It provides examples of each concept and recommends using a thread pool rather than creating a new thread per task to prevent scaling issues. The document concludes with an exercise to implement multithreaded printing of numbers using a thread pool.
Multithreading in Java Object Oriented Programming languagearnavytstudio2814
Multithreading in Java allows executing multiple threads simultaneously. A thread is the smallest unit of processing and is lightweight. Threads share memory space, which saves memory compared to processes that have separate memory areas. Context switching between threads is also faster than between processes. Common uses of multithreading include games, animations, and performing multiple operations simultaneously to save time while individual threads remain independent and unaffected by exceptions in other threads.
This document discusses multithreading and concurrency in Java. It defines a thread as a single sequential flow of control within a program. Multithreading allows a single processor to run multiple threads concurrently by rapidly switching between them. Creating threads in Java involves either extending the Thread class or implementing the Runnable interface. The document outlines thread states like new, ready, running, blocked, and finished. It also discusses thread scheduling, priorities, synchronization to prevent race conditions, and thread pools for managing tasks.
This document outlines the key concepts and objectives covered in Lecture 04 on threads. It introduces processes and threads, defining them as the basic units of execution in operating systems and Java programs respectively. It discusses how multi-processing systems and multi-threading programs allow concurrent execution. The lecture then covers thread fundamentals in Java, including creating and managing threads, and synchronizing access to shared resources using monitors, locks, and wait-notify mechanisms. Students are assigned workshops on the producer-consumer problem and philosophers problem to demonstrate these concurrency concepts.
This document summarizes key concepts from a lecture on threads. It defines processes and threads, explaining that threads exist within processes and allow for multithreaded execution. It covers thread fundamentals in Java, including creating threads by extending Thread or implementing Runnable, and methods like start(), sleep(), and yield(). The document also discusses synchronizing access to shared resources using monitors, and how wait-notify allows threads to pause and resume execution. Homework includes solving producer-consumer and philosophers problems using these threading concepts.
Multithreaded fundamentals
The thread class and runnable interface
Creating a thread
Creating multiple threads
Determining when a thread ends
Thread priorities
Synchronization
Using synchronized methods
The synchronized statement
Thread communication using notify(), wait() and notifyall()
Suspending , resuming and stopping threads
This document discusses string handling in Java. It covers string methods like charAt(), concat(), contains(), endsWith(), equals(), length(), replace(), split(), toLowerCase(), toUpperCase(), and trim(). It also discusses immutable nature of strings in Java and special operations like concatenation using + operator. The document provides examples to explain the usage of each string method.
Threads in java, Multitasking and Multithreadingssusere538f7
Threads allow Java programs to take advantage of multiprocessor systems by performing multiple tasks simultaneously. There are two main ways to create threads in Java - by extending the Thread class or implementing the Runnable interface. Threads can be started using the start() method and terminate when their run() method completes. The Java scheduler uses priority to determine which runnable threads get CPU time, with higher priority threads preempting lower priority ones. Threads provide concurrency but not true parallelism since Java threads still run on one CPU.
How Advanced Environmental Detection Is Revolutionizing Oil & Gas Safety.pdfRejig Digital
Unlock the future of oil & gas safety with advanced environmental detection technologies that transform hazard monitoring and risk management. This presentation explores cutting-edge innovations that enhance workplace safety, protect critical assets, and ensure regulatory compliance in high-risk environments.
🔍 What You’ll Learn:
✅ How advanced sensors detect environmental threats in real-time for proactive hazard prevention
🔧 Integration of IoT and AI to enable rapid response and minimize incident impact
📡 Enhancing workforce protection through continuous monitoring and data-driven safety protocols
💡 Case studies highlighting successful deployment of environmental detection systems in oil & gas operations
Ideal for safety managers, operations leaders, and technology innovators in the oil & gas industry, this presentation offers practical insights and strategies to revolutionize safety standards and boost operational resilience.
👉 Learn more: https://www.rejigdigital.com/blog/continuous-monitoring-prevent-blowouts-well-control-issues/
Down the Rabbit Hole – Solving 5 Training RoadblocksRustici Software
Feeling stuck in the Matrix of your training technologies? You’re not alone. Managing your training catalog, wrangling LMSs and delivering content across different tools and audiences can feel like dodging digital bullets. At some point, you hit a fork in the road: Keep patching things up as issues pop up… or follow the rabbit hole to the root of the problems.
Good news, we’ve already been down that rabbit hole. Peter Overton and Cameron Gray of Rustici Software are here to share what we found. In this webinar, we’ll break down 5 training roadblocks in delivery and management and show you how they’re easier to fix than you might think.
Mastering AI Workflows with FME - Peak of Data & AI 2025Safe Software
Harness the full potential of AI with FME: From creating high-quality training data to optimizing models and utilizing results, FME supports every step of your AI workflow. Seamlessly integrate a wide range of models, including those for data enhancement, forecasting, image and object recognition, and large language models. Customize AI models to meet your exact needs with FME’s powerful tools for training, optimization, and seamless integration
No-Code Workflows for CAD & 3D Data: Scaling AI-Driven InfrastructureSafe Software
When projects depend on fast, reliable spatial data, every minute counts.
AI Clearing needed a faster way to handle complex spatial data from drone surveys, CAD designs and 3D project models across construction sites. With FME Form, they built no-code workflows to clean, convert, integrate, and validate dozens of data formats – cutting analysis time from 5 hours to just 30 minutes.
Join us, our partner Globema, and customer AI Clearing to see how they:
-Automate processing of 2D, 3D, drone, spatial, and non-spatial data
-Analyze construction progress 10x faster and with fewer errors
-Handle diverse formats like DWG, KML, SHP, and PDF with ease
-Scale their workflows for international projects in solar, roads, and pipelines
If you work with complex data, join us to learn how to optimize your own processes and transform your results with FME.
PyData - Graph Theory for Multi-Agent Integrationbarqawicloud
Graph theory is a well-known concept for algorithms and can be used to orchestrate the building of multi-model pipelines. By translating tasks and dependencies into a Directed Acyclic Graph, we can orchestrate diverse AI models, including NLP, vision, and recommendation capabilities. This tutorial provides a step-by-step approach to designing graph-based AI model pipelines, focusing on clinical use cases from the field.
מכונת קנטים המתאימה לנגריות קטנות או גדולות (כמכונת גיבוי).
מדביקה קנטים מגליל או פסים, עד עובי קנט – 3 מ"מ ועובי חומר עד 40 מ"מ. בקר ממוחשב המתריע על תקלות, ומנועים מאסיביים תעשייתיים כמו במכונות הגדולות.
Integration of Utility Data into 3D BIM Models Using a 3D Solids Modeling Wor...Safe Software
Jacobs has developed a 3D utility solids modelling workflow to improve the integration of utility data into 3D Building Information Modeling (BIM) environments. This workflow, a collaborative effort between the New Zealand Geospatial Team and the Australian Data Capture Team, employs FME to convert 2D utility data into detailed 3D representations, supporting enhanced spatial analysis and clash detection.
To enable the automation of this process, Jacobs has also developed a survey data standard that standardizes the capture of existing utilities. This standard ensures consistency in data collection, forming the foundation for the subsequent automated validation and modelling steps. The workflow begins with the acquisition of utility survey data, including attributes such as location, depth, diameter, and material of utility assets like pipes and manholes. This data is validated through a custom-built tool that ensures completeness and logical consistency, including checks for proper connectivity between network components. Following validation, the data is processed using an automated modelling tool to generate 3D solids from 2D geometric representations. These solids are then integrated into BIM models to facilitate compatibility with 3D workflows and enable detailed spatial analyses.
The workflow contributes to improved spatial understanding by visualizing the relationships between utilities and other infrastructure elements. The automation of validation and modeling processes ensures consistent and accurate outputs, minimizing errors and increasing workflow efficiency.
This methodology highlights the application of FME in addressing challenges associated with geospatial data transformation and demonstrates its utility in enhancing data integration within BIM frameworks. By enabling accurate 3D representation of utility networks, the workflow supports improved design collaboration and decision-making in complex infrastructure projects
Scaling GenAI Inference From Prototype to Production: Real-World Lessons in S...Anish Kumar
Presented by: Anish Kumar
LinkedIn: https://www.linkedin.com/in/anishkumar/
This lightning talk dives into real-world GenAI projects that scaled from prototype to production using Databricks’ fully managed tools. Facing cost and time constraints, we leveraged four key Databricks features—Workflows, Model Serving, Serverless Compute, and Notebooks—to build an AI inference pipeline processing millions of documents (text and audiobooks).
This approach enables rapid experimentation, easy tuning of GenAI prompts and compute settings, seamless data iteration and efficient quality testing—allowing Data Scientists and Engineers to collaborate effectively. Learn how to design modular, parameterized notebooks that run concurrently, manage dependencies and accelerate AI-driven insights.
Whether you're optimizing AI inference, automating complex data workflows or architecting next-gen serverless AI systems, this session delivers actionable strategies to maximize performance while keeping costs low.
AI Agents in Logistics and Supply Chain Applications Benefits and ImplementationChristine Shepherd
AI agents are reshaping logistics and supply chain operations by enabling automation, predictive insights, and real-time decision-making across key functions such as demand forecasting, inventory management, procurement, transportation, and warehouse operations. Powered by technologies like machine learning, NLP, computer vision, and robotic process automation, these agents deliver significant benefits including cost reduction, improved efficiency, greater visibility, and enhanced adaptability to market changes. While practical use cases show measurable gains in areas like dynamic routing and real-time inventory tracking, successful implementation requires careful integration with existing systems, quality data, and strategic scaling. Despite challenges such as data integration and change management, AI agents offer a strong competitive edge, with widespread industry adoption expected by 2025.
Artificial Intelligence in the Nonprofit Boardroom.pdfOnBoard
OnBoard recently partnered with Microsoft Tech for Social Impact on the AI in the Nonprofit Boardroom Survey, an initiative designed to uncover the current and future role of artificial intelligence in nonprofit governance.
Providing an OGC API Processes REST Interface for FME FlowSafe Software
This presentation will showcase an adapter for FME Flow that provides REST endpoints for FME Workspaces following the OGC API Processes specification. The implementation delivers robust, user-friendly API endpoints, including standardized methods for parameter provision. Additionally, it enhances security and user management by supporting OAuth2 authentication. Join us to discover how these advancements can elevate your enterprise integration workflows and ensure seamless, secure interactions with FME Flow.
Trends Artificial Intelligence - Mary MeekerClive Dickens
Mary Meeker’s 2024 AI report highlights a seismic shift in productivity, creativity, and business value driven by generative AI. She charts the rapid adoption of tools like ChatGPT and Midjourney, likening today’s moment to the dawn of the internet. The report emphasizes AI’s impact on knowledge work, software development, and personalized services—while also cautioning about data quality, ethical use, and the human-AI partnership. In short, Meeker sees AI as a transformative force accelerating innovation and redefining how we live and work.
Developing Schemas with FME and Excel - Peak of Data & AI 2025Safe Software
When working with other team members who may not know the Esri GIS platform or may not be database professionals; discussing schema development or changes can be difficult. I have been using Excel to help illustrate and discuss schema design/changes during meetings and it has proven a useful tool to help illustrate how a schema will be built. With just a few extra columns, that Excel file can be sent to FME to create new feature classes/tables. This presentation will go thru the steps needed to accomplish this task and provide some lessons learned and tips/tricks that I use to speed the process.
Boosting MySQL with Vector Search -THE VECTOR SEARCH CONFERENCE 2025 .pdfAlkin Tezuysal
As the demand for vector databases and Generative AI continues to rise, integrating vector storage and search capabilities into traditional databases has become increasingly important. This session introduces the *MyVector Plugin*, a project that brings native vector storage and similarity search to MySQL. Unlike PostgreSQL, which offers interfaces for adding new data types and index methods, MySQL lacks such extensibility. However, by utilizing MySQL's server component plugin and UDF, the *MyVector Plugin* successfully adds a fully functional vector search feature within the existing MySQL + InnoDB infrastructure, eliminating the need for a separate vector database. The session explains the technical aspects of integrating vector support into MySQL, the challenges posed by its architecture, and real-world use cases that showcase the advantages of combining vector search with MySQL's robust features. Attendees will leave with practical insights on how to add vector search capabilities to their MySQL systems.
Creating an Accessible Future-How AI-powered Accessibility Testing is Shaping...Impelsys Inc.
Web accessibility is a fundamental principle that strives to make the internet inclusive for all. According to the World Health Organization, over a billion people worldwide live with some form of disability. These individuals face significant challenges when navigating the digital landscape, making the quest for accessible web content more critical than ever.
Enter Artificial Intelligence (AI), a technological marvel with the potential to reshape the way we approach web accessibility. AI offers innovative solutions that can automate processes, enhance user experiences, and ultimately revolutionize web accessibility. In this blog post, we’ll explore how AI is making waves in the world of web accessibility.
Your startup on AWS - How to architect and maintain a Lean and Mean accountangelo60207
Prevent infrastructure costs from becoming a significant line item on your startup’s budget! Serial entrepreneur and software architect Angelo Mandato will share his experience with AWS Activate (startup credits from AWS) and knowledge on how to architect a lean and mean AWS account ideal for budget minded and bootstrapped startups. In this session you will learn how to manage a production ready AWS account capable of scaling as your startup grows for less than $100/month before credits. We will discuss AWS Budgets, Cost Explorer, architect priorities, and the importance of having flexible, optimized Infrastructure as Code. We will wrap everything up discussing opportunities where to save with AWS services such as S3, EC2, Load Balancers, Lambda Functions, RDS, and many others.
2. 1. Introduction
What is a Process?
What is a Thread?
Benefits of Threads
Risks of Threads
Real-time usage of threads
Where are Threads used in Java?
3. WHAT IS A PROCESS?
Process is a isolated, independently executing
programs to which OS allocate resources such as
memory, file handlers, security credentials, etc.
Processes communicate with one another through
mechanisms like sockets, signal handlers, shared
memory, semaphores and files.
4. WHAT IS A THREAD?
Threads are called lightweight processes
Threads are spawned from Processes. So all the
threads created by one particular process can share
the process's resources (memory, file handlers, etc).
Threads allow multiple program flows to coexist
within the process.
Even though threads share process-wide resources
(memory, file handlers), but each thread has its own
Program Counter, Stack and local variables.
8. RISKS OF THREADS
Threads in Java are like double-ended swords.
Following are few risks;
Safety Hazards
Liveness Hazards
Performance Hazards
9. RISKS OF THREADS – SAFETY HAZARDS
Unsafe codes may result in race conditions.
public class SequenceGenerator {
private int currentSequence = 0;
}
public int getNextSequence() {
return currentSequence++;
}
Proper synchronization should be done.
10. RISKS OF THREADS – LIVENESS
HAZARDS
A liveness failure occurs when an activity gets into a
state such that it permanently unable to make
forward progress. (Eg. Infinite loop)
A liveness hazard scenario;
Thread A waits for a lock to be released by Thread B
and vice versa. In this scenario, these programs will
wait for ever.
11. RISKS OF THREADS – PERFORMANCE
HAZARDS
Context Switches
When threads share data, they must use
synchronization which prevents compiler
optimizations, flush or invalidate memory caches and
create synchronization traffic on shared memory bus.
12. Where are Threads used in Java? Or how
frequently are we using threads in our day-today
work?
13. WHERE ARE THREADS USED IN JAVA?
Threads are everywhere. Every Java application uses
thread. Even a simple CUI based application that
runs in a single class uses threads.
When JVM starts, it creates threads for JVM
housekeeping tasks (garbage collection, finalization)
and a main thread for running “main” method.
Examples; Timers, Servlets & JSPs, RMI, Swing &
AWT
15. 2. Java Threading Basics
Defining a Thread
Instantiate a Thread
Start a Threads
Thread Life-cycle
Thread Priorities
Important methods from java.lang.Thread & java.lang.Object class;
sleep()
yield()
join()
wait()
notify() & notifyAll()
Synchronization
Locks
When & how to Synchronize?
Deadlocks
Thread Interactions
16. DEFINING A THREAD
Extending java.lang.Thread class
public class SampleThread extends Thread {
public void run() {
system.out.println(“Running....”);
}
}
Implementing java.lang.Runnable interface
public class SampleRunnable implements Runnable {
public void run() {
system.out.println(“Running....”);
}
}
17. INSTANTIATE A THREAD
We can use any of the above mentioned ways to
define a thread. But can instantiate a thread only by
using java.lang.Thread class.
If we create a thread by extending Thread class;
SampleThread thread1 = new SampleThread();
If we create a thread by implementing Runnable
interface;
SampleRunnable runnable1 = new SampleRunnable();
Thread thread2 = new Thread(runnable1);
18. START A THREAD
Use the java.lang.Thread class's start()
method to start a thread.
public class TestThread {
public static void main(String... args) {
SampleThread t1 = new SampleThread();
t1.start();
}
}
Once if we start a thread, it can never be
started again.
20. THREAD PRIORITIES
In java Threads always run with some priorities,
usually a number between 1 to 10.
If a thread enters the runnable state, and it has
higher priority than the current running thread, the
lower-priority thread will be bumped back to
runnable and highest-priority thread will be chosen
to run.
All priority threads being equal, a JVM
implementation if the scheduler is free to do just
about anything it likes.
It is recommended not to depend on that behavior for
correctness
21. THREAD PRIORITIES (CONT.)
Use the following syntax to set priorities;
SampleThread thread1 = new SampleThread();
thread1.setPriority(8);
thread1.start();
Default priority is 5.
We can use the pre-defined constants like;
Thread.MIN_PRIORITY, Thread.NORM_PRIORITY
and Thread.MAX_PRIORITY
22. IMPORTANT METHODS FROM
JAVA.LANG.THREAD &
JAVA.LANG.OBJECT - SLEEP()
Since sleep is a static method in java.lang.Thread
class, the call affects only the current thread in
execution.
Used for pausing the thread execution for a specific
milliseconds.
Throws InterruptedException when another thread
is trying to interrupt a sleeping thread.
Syntax;
try {
Thread.sleep(60 * 1000); // sleep for 1 second
} catch(InterruptedException iex) { }
23. IMPORTANT METHODS FROM
JAVA.LANG.THREAD &
JAVA.LANG.OBJECT - YIELD()
Since yield is a static method in java.lang.Thread
class, the call affects only the current thread in
execution.
This method is supposed to make the current thread
head back to runnable to allow other threads of the
same priority to get their turn.
There is no guarantee to do what it claims.
24. IMPORTANT METHODS FROM
JAVA.LANG.THREAD &
JAVA.LANG.OBJECT - JOIN()
This is a non-static method.
Syntax;
public class Test {
public static void main(String... args) {
SampleThread thread1 = new SampleThread();
thread1.start();
thread1.join();
// Some more code here
}
}
The above code takes the main thread and attaches it
to the end of 'thread1'. Main thread will be paused.
'thread1' will be finished and main thread will
continue its execution.
25. IMPORTANT METHODS FROM
JAVA.LANG.THREAD & JAVA.LANG.OBJECT –
WAIT(), NOTIFY() & NOTIFYALL()
Use non-static wait method to prevent or pause a
thread from execution. Three overloaded versions
of wait are available. Preferably use the method
which takes a long as argument. This will make
the thread wake-up after a particular time.
'notify' and 'notifyAll' are methods used to inform
the waiting threads to stop waiting and move
them from blocked to runnable state.
All these 3 methods should be called only with in
a synchronization context. A thread can't invoke
these methods on an object unless it owns that
object's lock.
26. IMPORTANT METHODS FROM
JAVA.LANG.THREAD & JAVA.LANG.OBJECT –
WAIT(), NOTIFY() & NOTIFYALL() (CONT.)
When the wait method is called, the locks acquired
by the objects are temporarily released.
An InterruptedException is thrown when a waiting
thread is interrupted by another thread.
27. SYNCHRONIZATION
Synchronization can be done only for methods and
blocks of code. Not for classes.
Use synchronize keyword in places where we
refer/use the mutable instance variables, as these
mutable instance variables can be accessed by
multiple threads simultaneously.
Another use of synchronization is memory visibility.
Synchronization ensures atomicity and visibility
28. SYNCHRONIZATION - LOCKS
Every object in java has exactly one built-in lock by
default. This is called intrinsic lock.
When we synchronize a block of code with 'this' or
when we synchronize a method, actually we
synchronize it using intrinsic locks.
We can use our own locks in place of intrinsic locks.
We can declare an object as instance variable in a
class and we can use block synchronization where the
block is synchronized using this object.
29. SYNCHRONIZATION – WHEN & HOW?
Synchronize all parts of code that access the mutable
instance variables declared inside a class.
Follow the same synchronization policy when
modifying the code.
Make granular synchronizations.
Two ways to use synchronization.
1) Add synchronized keyword to method
2) Wrap a block of code with-in synchronized
keyword
30. DEADLOCK
public class DeadlockDemo {
private Object lockA = new Object();
private Object lockB = new Object();
public void read() {
synchronized(lockA) {
synchronized(lockB) {
// Code for read operation
}
}
}
}
public void write() {
synchronized(lockB) {
synchronized(lockA) {
// Code for write operation
}
}
}
31. THREAD INTERACTIONS
public class Operator extends Thread {
public void run() {
while(true) {
// Get data
synchronized(this) {
// Calculate input required for Machine
notify();
}
}
}
}
public class Machine extends Thread {
Operator operator; // Assume we have a constructor
public void run() {
while(true) {
synchronized(operator) {
try { operator.wait(); }
catch (InterruptedException ex) { }
// Get the generated input and process it
}
}
}
}
34. IMMUTABLE OBJECTS
An object is immutable if;
−
−
−
Its state cannot be modified after construction
All its fields are final
It is properly constructed
Example is String.
Create a custom immutable class.
35. THREAD-SAFETY – WHAT IS THE
MEANING?
A class is tread-safe when it continues to behave
correctly when accessed from multiple threads,
regardless of the scheduling or interleaving of the
execution of those threads by the runtime
environment, and with no additional synchronization
or other coordination on the part of the calling code.
36. THREAD-SAFETY – TIPS
Stateless objects are thread-safe.
State-full objects with ALL immutable instance
variable are thread-safe.
Access to immutable instance variables don't have to
be synchronized.
Synchronize atomic operations (on mutable instance
variables). If not, there will be race condition. For
example;
37. THREAD-SAFETY – TIPS (CONT.)
public class CounterServlet implements Servlet {
private long count = 0;
public void service(ServletRequest request,
ServletResponse response) {
// Some code here
++count;
// Some code here
}
}
To fix the above scenario use AutomicLong instead of
‘long’.
For mutable state variables that may be accessed by
more than one thread, all accesses to that variable
must be performed with the same lock held. In this
case, we say that the variable is guarded by the same
lock.
38. VOLATILE VARIABLES
Volatile variables are not cached in registers or in
caches where they are hidden from other processors,
so read of a volatile variable always returns the most
recent write by any thread.
Accessing volatile variables perform no locking and
so cannot cause the executing thread to block.
Volatile variables are called light-weight
synchronization.
Locking can guarantee both visibility and atomicity;
but volatile variables can only guarantee visibility.
39. VOLATILE VARIABLE (CONT.)
Use volatile variables only when;
Writes to the variable do not depend on its current
value.
Variable does not participate in invariants with other
state variables.
Locking not required for any other reason while the
variable is being accessed.
40. SYNCHRONIZED COLLECTIONS
Vector and Hashtable are synchronized classed from
JDK 1.2
Collections.synchronizedXxx helps to create
synchronized wrapper classes. These classes achieve
thread-safety by encapsulating their state and
synchronizing all public methods so that only one
thread can access the collection at a time.
41. SYNCHRONIZED COLLECTIONS PROBLEMS
Compound actions are still technically thread-safe
even without client-side locking, but they may not
behave as you might expect when other threads can
concurrently modify the collection.
public Object getLast(Vector list) {
int lastIndex = list.size() - 1;
return list.get(lastIndex);
}
public void deleteLast(Vector list) {
int lastIndex = list.size() - 1;
list.remove(lastIndex);
}
43. SYNCHRONIZED COLLECTION –
PROBLEMS (CONT.)
To fix this issue the code inside the methods has to be
synchronized using the input argument 'list'.
public Object getLast(Vector list) {
synchronized(list) {
int lastIndex = list.size() - 1;
return list.get(lastIndex);
}
}
public void deleteLast(Vector list) {
synchronized(list) {
int lastIndex = list.size() - 1;
list.remove(lastIndex);
}
}
44. SYNCHRONIZED COLLECTIONS –
PROBLEMS (CONT.)
The iterators returned by the synchronized
collections are fail-fast iterators.
While iteration, if another thread modifies the list,
then the iteration would be stopped by throwing the
exception ConcurrentModificationException.
Ways to avoid; clone the collection and send it for
iteration or wrap the collection with
UnmodifiableXxx class or use concurrent collections.
46. 4. Java Concurrency
Use of java.util.concurrent.lock.Lock
Use of java.util.concurrent.atomic package
Concurrent Collections
Synchronizers
Latches
FutureTask
Semaphores & Barriers
Executor Framework
Thread Pools
Executor Lifecycle
Callable & Future
Task Cancellation
Cancellation via Future
ExecutorService shutdown
47. USE OF
JAVA.UTIL.CONCURRENT.LOCK.LOCK
An alternative synchronization mechanism
introduced in JDK 1.5.
This was developed to solve the problems that we had
with traditional synchronization.
A commonly used Lock implementation is
ReenterantLock.
In general a reentrant lock mean, there is an
acquisition count associated with the lock, and if a
thread that holds the lock acquires it again, the
acquisition count is incremented and the lock then
needs to be released twice to truly release the lock.
48. USE OF
JAVA.UTIL.CONCURRENT.LOCK.LOCK
(CONT.)
Lock lock = new ReentrantLock();
lock.lock();
try {
// update object state
}
finally {
lock.unlock();
}
The above is the way to use it.
Many benchmarks have proven that, Reenterant
locks perform much better than synchronization.
49. USE OF
JAVA.UTIL.CONCURRENT.LOCK.LOCK
(CONT.)
This might tempt us to stop using synchronization.
But experts say that the new concurrency Lock is
only for advanced users for 2 reasons;
1) It is easy to forget to use a finally block to
release the lock, to the great detriment of your
program.
2) When the JVM manages lock acquisition and
release using synchronization, the JVM is able to
include locking information when generating
thread dumps. The Lock classes are just ordinary
classes, and the JVM does not (yet) have any
knowledge of which Lock objects are owned by
specific threads.
50. USE OF
JAVA.UTIL.CONCURRENT.ATOMIC
PACKAGE
A small toolkit of classes that support lock-free
thread-safe programming on single variables.
Few classes under this package are AtomicInteger,
AtomicLong, AtomicReference, etc.
Classes like AtomicInteger can be used in situations
like atomically incremented counter.
51. USE OF
JAVA.UTIL.CONCURRENT.ATOMIC
PACKAGE (CONT.)
To understand the atomic package correctly, we
should understand 2 concepts;
CAS: Compare And Swap. This idea is used in
processors also. A CAS operation includes three
operands -- a memory location (V), the expected
old value (A), and a new value (B). The processor
will atomically update the location to the new
value if the value that is there matches the
expected old value, otherwise it will do nothing. In
either case, it returns the value that was at that
location prior to the CAS instruction. CAS
effectively says "I think location V should have the
value A; if it does, put B in it, otherwise, don't
change it but tell me what value is there now."
52. USE OF
JAVA.UTIL.CONCURRENCY.ATOMIC
PACKAGE (CONT.)
Lock-Free: Concurrent algorithms based on CAS are
called lock-free, because threads do not ever have to
wait for a lock (sometimes called a mutex or critical
section, depending on the terminology of your
threading platform). Either the CAS operation
succeeds or it doesn't, but in either case, it completes
in a predictable amount of time. If the CAS fails, the
caller can retry the CAS operation or take other
action as it sees fit.
53. USE OF
JAVA.UTIL.CONCURRENT.ATOMIC
PACKAGE (CONT.)
package java.util.concurrent.atomic;
public class AtomicInteger {
private int value;
public final int get() {
Return value;
}
}
public final int incrementAndGet() {
for (;;) {
int current = get();
int next = current + 1;
if (compareAndSet(current, next))
return next;
}
}
54. CONCURRENT COLLECTIONS
These collections are designed for concurrent access
from multiple threads.
Interface ConcurrentMap is introduced for adding
support for compound actions like put-if-absent,
replace and conditional remove.
Interface BlockingQueue is useful for producerconsumer design scenarios.
ConcurrentHashMap is replacement for synchronized
hash-based map.
CopyOnWriteArrayList is replacement for
synchronized list.
55. SYNCHRONIZERS
A Synchronizer is any object that co-ordinates the
control flow of threads based on its state.
Blocking queues can act as synchronizers.
Other synchronizers are Latches, Semaphores &
Barriers.
56. SYNCHRONIZER - LATCHES
A latch is a synchronizer that can delay the process
of threads until it reaches its terminal state.
Once the latch reaches the terminal state, it cannot
change the state again. So it remains open forever.
Implementation call is CountDownLatch. Uses
await() and countDown() methods for controlling the
thread flow.
57. SYNCHRONIZERS – LATCHES (CONT.)
Class TaskTimeCalculator {
public long timeTaks(int noOfThreads, final Runnable task) {
CountDownLatch startGate = new CountDownLatch(1);
CountDownLatch endGate = new CountDownLatch(noOfThreads);
for(int i = 0; i < noOfThreads; i++) {
Thread t = new Thread() {
public void run() {
startGate.await();
try { task.run(); }
finally { endGate.countDown(); }
}
};
t.start();
} // End of for
}
}
long start = System.nanoTime();
startGate.countDown();
endGate.await();
long end = System.nanoTime();
return end – start;
58. SYNCHRONIZERS - FUTURETASK
FutureTask acts like a latch.
It implements Future.
Computation represented by FutureTask is
implemented with a Callable interface.
Behavior of Future.get() depends on the state of the
task. If task is not completed, get() method waits or
blocks till the task is completed. Once completed, it
returns the result or throws an ExecutionException.
59. SYNCHRONIZERS – FUTURETASK
(CONT.)
class PreLoader {
private final FutureTask<ProductInfo> future =
new FutureTask<ProductInfo>(new Callable<ProductInfo>() {
public ProductInfo call() throws DataLoadException {
return loadProductInfo();
}
});
private final Thread thread = new Thread(future);
public void start() { thread.start(); }
}
public ProductInfo get()
throws DataLoadException, InterruptedException {
try {
return future.get();
} catch(ExecutionException eex) {
Throwable cause = e.getCause();
// other exception handling code here
}
}
60. SYNCHRONIZERS – SEMAPHORES &
BARRIERS
Counting Semaphores are used to control the number
of activities that can access a certain resource or
perform a given action at the same time. This can be
used for implementing resource pooling. Methods
used; acquire() & release().
While Latches are for waiting fir events, Barriers are
for waiting for other threads. All the threads must
come together at a barrier point at the same time in
order to proceed.
61. EXECUTOR FRAMEWORK
Tasks are logical units of work, and threads are a
mechanism by which tasks can run asynchronously.
Java.util.concurrent provides a flexible thread pool
implementation as part of the Executor framework.
The primary abstraction for task execution in the
java class libraries is not Thread, but Executor.
62. EXECUTOR FRAMEWORK (CONT.)
public interface Executor {
void execute(Runnable command);
}
This simple interface forms the basic for flexible &
powerful framework for asynchronous task execution
that support wide variety of task execution policy.
Executors help us decoupling task submission from
task execution.
63. THREAD POOLS
Thread pool manages a homogenous pool of worker
threads.
Different thread pool implementation are;
1) FixedThreadPool
2) CachedThreadPool
3) SingleThreadExecutor
4) ScheduledThreadPool
These pools are created using Executors class.
64. EXECUTOR LIFECYCLE
Since Executors provide a service to applications,
they should be able to shut down properly.
public interface ExecutorService
extends Executor {
void shutdown();
List<Runnable> shutdownNow();
boolean isShutdown();
boolean isTerminated();
boolean awaitTermination(
long timeout, TimeUnit unit)
throws InterruptedException;
}
// Other methods
65. EXECUTOR LIFECYCLE - EXAMPLE
class LifeCycleWebServer {
private final ExecutorSerive exec =
Executors.newFixedThreadPool(100);
public void start() throws IOException {
ServerSocket socket = new ServerSocket(80);
}
while(!exec.isShutdown()) {
final Socket conn = socket.accept();
exec.execute(new Runnable() {
public void run() { handleRequest(conn); }
});
}
public void stop() { exec.shutdown(); }
}
void handleRequest(Socket connection) {
Request req = readRequest(connection);
if(isShutdownRequest(req)
stop();
else
dispatchRequest(req);
}
66. CALLABLE & FUTURE
In Runnable interface, run cannot return a value or
throw checked exception. Callable interface solves
this problem.
Callable expects a main entry point called 'call'
method and can return a value. Also it can throw an
Exception.
Future represents the lifecycle of a task and provides
methods to test wherher a task is completed or been
canceled, retrieve its result and cancel the task.
67. CALLABLE & FUTURE (CONT.)
public interface Callable<V> {
V call() throws Exception;
}
public interface Future<V> {
boolean cancel(boolean mayInterruptIfRunning);
boolean isCancelled();
boolean isDone();
V get() throws …;
V get(long timeout, TimeUnti unit) throws …;
}
68. TASK CANCELLATION
An activity is cancellable if external code can move it
to completion before its normal completion.
There are different ways to achieve this.
69. TASK CANCELLATION – MANUAL
public class PrimeGenerator implements Runnable {
private final List<BigInteger> primes =
new ArrayList<BigInteger>();
private volatile boolean cancelled = false;
public void run() {
BigInteger p = BigInteger.ONE;
while(!cancelled) {
p = p.nextProbablePrime();
synchronized(this) {
primes.add(p);
}
}
}
public void cancel() { cancelled = true; }
}
public synchronized List<BigInteger> get() {
return new ArrayList<BigInteger>(primes);
}
70. TASK CANCELLATION – THREAD
INTERRUPTION
The problem with previous approch is, it cancels all
the executing threads. We cannot cancel a specific
instance.
We can use the following methods in Thread class
instead.
public class Thread {
public void interrupt() { .. }
public boolean isInterrupted() { .. }
public static boolean interrupted() { .. }
}
71. TASK CANCELLATION – THREAD
INTERRUPTION (CONT.)
public class PrimeGenerator implements Runnable {
private final List<BigInteger> primes =
new ArrayList<BigInteger>();
private volatile boolean cancelled = false;
public void run() {
BigInteger p = BigInteger.ONE;
While(!Thread.currentThread().isInterrupted()) {
p = p.nextProbablePrime();
synchronized(this) {
primes.add(p);
}
}
}
public void cancel() { interrupt(); }
}
public synchronized List<BigInteger> get() {
return new ArrayList<BigInteger>(primes);
}
72. CANCELLATION VIA FUTURE
public void timedRun(Runnable r,
long timeout,
TimeUnit unit) throws InterruptedException {
Future<?> task = taskExec.submit(r);
}
try {
task.get(timeout, unit);
} catch(TimeoutException tex) {
// task will be cancelled below
} catch(ExecutionException eex) {
// Process eex and re-throw if needed
} finally {
if(!task.isCancelled() && !task.isDone()) {
task.cancel(true);
}
}
73. EXECUTORSERVICE SHUTDOWN
If Executors are not shutdown properly, it won't
allow the JVM process to close.
Two ways to shutdown;
1) Call shutdown()
2) Call shutdownNow()
74. That’s all flocks!
Thank you!! Please send me your valuable feedbacks.
Editor's Notes
#7: Its hard to scale up the clock rates. So processor manufacturers are putting more processors on a single chip.
A server app that accepts socket connections from multiple clients, may be processed in separate threads.
Improves desktop/standalone GUI application's response to user events.
#10: “currentSequence++” is not a single operation. It involves 3 operations as 1) get the data in currentSequence variable 2) Increment it by 1 3) Set the result back to currentSequence variable. Imagine 2 threads trying to access the getNextSequence() method simultaneouly.
#18: Overloaded constructors of java.lang.Thread class are;
1. Thread()
2. Thread(Runnable r)
3. Thread(Runnable r, String name)
4. Thread(String name)