Join David Gassner for an in-depth discussion in this video Synchronizing threads, part of Java Advanced Training.
There are many sorts of applications where multiple threads might need to share a resource,…and you will need to synchronize these threads so that only one thread at a time has access to that resource.…I'll demonstrate how to do this in the project SyncThreads.…I'm starting with an empty Main class and with a custom thread class that extends thread.…In this version of MyThread I'm sleeping for 2 seconds, but that's it, I'm not outputting…anything to the screen quite yet.…
In order to demonstrate synchronization, first I'm going to create a class that can be used as a target object.…You can use any Java object for this purpose, but I'm going to create a very simple class.…I'll right-click on my existing package and create a new class, and I'll name it TargetClass.…Now again, you can use any Java object, including, say, a stream that's pointing to a file or…a network connection, but I'll just use the simplest sort of object.…
I'll click Finish, and then I'll implement a single method.…I'll set it as public and void, and I'll name the method call, and I'll have it receive…
- Installing Java on Windows and Mac OS X
- Installing Eclipse
- Using new features such as simplified generics
- Working with advanced class structures (member, local inner, etc.)
- Using the Reflection API
- Navigating inheritance trees
- Managing unordered and ordered sets
- Peeking and polling with queues
- Testing and error handling
- Managing files and directories
- Working with I/O streams
- Next steps with Java
Skill Level Advanced
1. Getting Started
2. Java 7 New Features
3. Using Advanced Class Structures
4. Using the Reflection API
5. More of the Collections Framework
6. Testing and Advanced Exception Handling
Using the finally keyword5m 40s
7. Managing Files and Directories in Java 7
8. Working with I/O Streams
9. Working with Multi-threading
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
This will not affect your course history, your reports, or your certificates of completion for this course.Cancel
Take notes with your new membership!
Type in the entry box, then click Enter to save your note.
1:30Press on any video thumbnail to jump immediately to the timecode shown.
Notes are saved with you account but can also be exported as plain text, MS Word, PDF, Google Doc, or Evernote.