Mega Code Archive
Search
.Net
ASP .Net
ASP .Net Tutorial
C#
C# Book
C# by API
C# Tutorial
VB.Net
VB.Net by API
VB.Net Tutorial
Visual C++ .Net
VisualBasic Script
Java
Java
Java Book
Java by API
Java Tutorial
Script
Flash ActionScript
Flex
JavaScript DHTML
JavaScript Reference
JavaScript Tutorial
Database
MSSQL
MSSQL Tutorial
MySQL
MySQL Tutorial
Oracle PLSQL
Oracle PLSQL Tutorial
PostgreSQL
Languages
Android
C
C Tutorial
C++
C++ Tutorial
Delphi
Perl
PHP
Python
Python Tutorial
Ruby
Silverlight
Office
MSOfficeExcel 2007 Tutorial
MSOfficePowerPoint 2007 Tutorial
MSOfficeWord 2007 Tutorial
Data
XML
XML Tutorial
Java
Threads 209 codes
Home
Java
Threads
1 A daemon thread
2 A live daemon thread does not prevent an application from exiting
3 A multithreaded queue used for implementing producer-consumer style threading patterns
4 A reader-writer lock from Java Threads by Scott Oak and Henry Wong
5 A semaphore
6 A simple demonstration of wait() and notify()
7 A simple example that uses an Executor
8 A thread must be marked as a daemon thread before it is started
9 A thread of execution that uses a CyclicBarrier
10 A utility class that receives a collection of tasks to execute internally and then distributes the tasks among a thread pool
11 A work queue is used to coordinate work between a producer and a set of worker threads
12 Add a delay
13 An abstract class to perform lengthy GUI-interacting tasks in a dedicated thread
14 An application exits when there are no non-daemon threads running
15 An example of CountDownLatch
16 An example of Exchanger
17 An implementation of a producer and consumer that use semaphores to control synchronization
18 Animation
19 Another deadlock demo
20 Another way to stop a thread
21 Another way to suspend and resume
22 Atomic Float
23 Atomic Utils
24 BlockingQueue Test
25 Boolean lock
26 BufferedWriter and threads
27 Busy Flag
28 Byte FIFO
29 Calling sleep() to wait for a while
30 Communicate between threads using a Queue
31 Coordinates threads for multi-threaded operations
32 Count Up Down Latch
33 Counter
34 Create a new thread for the thread pool The create thread will be a daemon thread
35 Create a thread by extending Thread
36 Create a thread by implementing Runnable
37 Creating a Bounded Work Queue
38 Creating threads with inner classes
39 Current set
40 Customized java util ArrayList
41 Customized java util HashMap
42 Customized java util TreeMap
43 Daemon Lock
44 Daemon Thread
45 Daemon threads dont prevent the program from ending
46 Daemon threads spawn other daemon threads
47 Deadlock Detecting
48 Deadlock Detector
49 DeadLock Detector 2
50 Defining a thread for a thread pool
51 Demo for java util concurrent Future
52 Demonstrate join()
53 Demonstrates how deadlock can be hidden in a program
54 Demonstrating the runnable interface
55 Determining If the Current Thread Is Holding a Synchronized Lock
56 Determining When a Thread Has Finished
57 Early return
58 Eliminating race Conditions using Swing Components
59 Exception call back
60 Executes a task with a specified timeout
61 Fibonacci
62 Finds a resource with the given name
63 Get Thread name
64 GUI clock
65 Handle concurrent readwrite
66 Illustrate the volatile variables
67 Implementing an Unbounded Work Queue
68 Inner self run threads
69 Interrupt a thread
70 Interruptible Synchronized Block
71 Invoke a series of runnables as closely to synchronously as possible
72 InvokeExample
73 Is Event Dispatcher Thread
74 Is thread alive
75 Java 1 5 (5 0) new feature
76 Java 1 5 (5 0) new features
77 Java new feature
78 Java Thread Performance
79 Java util concurrent ThreadPoolExecutor and thread pool
80 JDK1 5 provides a mechanism to create a pool a scheduled task
81 Job Scheduler
82 Launch many programs using Thread and use join() to wait for the completion
83 Listing all running threads
84 Listing All Running Threads in a group
85 Listing all threads and threadgroups in the VM
86 Lock for read and write
87 Monitor a threads status
88 No synchronize
89 Object FIFO
90 Operations that may seem safe are not, when threads are present
91 Output stream and threads
92 Parallelizing Loops for Multiprocessor Machines
93 Pause the execution
94 Pause the execution of a thread using sleep()
95 Pausing a Thread
96 Pausing the Current Thread
97 Producer and Comsumer
98 Producer consumer for J2SE 1 5 using concurrent
99 Producer consumer in Java 1
100 Producer consumer in Java 2
101 Producer Consumer Test
102 Race Conditions using Swing Components
103 Read Write Lock
104 ReentrantLock
105 Return a new instance of the given class Checks the ThreadContext classloader first, then uses the System classloader
106 Return a value from a thread
107 Rhyming Words
108 Runs multiple jobs in parallel
109 Safe collection operation
110 Safe list copy
111 Safe vector copy
112 Self run thread
113 Semaphore that can allow a specified number of threads to enter, blocking the others
114 Set Thread Priority
115 Set Uncaught Exception Handler
116 Setting priorities on the Thread objects
117 Shows the use of thread priorities
118 Signaling
119 Simple Object FIFO
120 Simple object pool Based on ThreadPool and few other classes
121 Simple pool of Threads
122 Simple thread pool A task is executed by obtaining a thread from the pool
123 Simple threads creator
124 SimpleThread using the Runnable interface
125 Single Thread Request Executor
126 Sleep utilities
127 Static synchronize
128 Static synchronized block
129 Stop watch programme
130 Stopping a Thread
131 Stores a single object for the producerconsumer pattern and takes care of thread synchronization
132 Suggesting when to switch threads with yield()
133 Suspend, resume, and stop a thread
134 Swing and thread
135 Swing and Thread for length operation
136 Swing and Threading
137 Swing and threads
138 Swing Type Tester 10
139 SwingUtilities invokeLater and swing thread
140 Synchronize method
141 Synchronized Block demo
142 Synchronizing blocks instead of entire methods
143 Synchronizing on another object
144 Task
145 Task Scheduling
146 Test Override
147 Test Override Thread
148 The BooleanLock class provides a useful encapsulation of a boolean variable that is easily and safely accessed from multiple thead
149 The producer-consumer approach to thread cooperation
150 The safe way to stop a thread
151 This program demonstrates that a thread that runs in parallel with the event dispatch thread can cause errors in Swing components.
152 This program shows data corruption when multiple threads access a data structure
153 This program shows how multiple threads can safely access a data structure
154 This program shows how multiple threads can safely access a data structure, using synchronized methods
155 Thread
156 Thread accuracy
157 Thread and Swing 1
158 Thread and Swing 2
159 Thread and Swing 3
160 Thread Cache
161 Thread deadlock
162 Thread general interrupt
163 Thread ID
164 Thread Interrupt when calculating Pi
165 Thread interrupt check
166 Thread interrupt reset
167 Thread name
168 Thread notify
169 Thread pending and interrupt
170 Thread pool
171 Thread Pool 2
172 Thread pool demo
173 Thread Pool Test
174 Thread Pools 1
175 Thread Pools 2
176 Thread priorities
177 Thread Priority
178 Thread priority information
179 Thread Race Demo
180 Thread Reminder
181 Thread sleep
182 Thread sleep and interrupt
183 Thread synchronization
184 Thread-based logging utility
185 ThreadGroup Enumerate
186 Threads join
187 Three Threads Test
188 Timer class used to implement login and query timeouts
189 Transition Detector
190 Two simple threads
191 Understanding join()
192 Use a ThreadGroup
193 User interface responsiveness
194 Using a Thread-Local Variable
195 Using interrupt() to break out of a blocked thread
196 Using java util concurrent locks Lock to control the synchronized resource
197 Using pipes for inter-thread IO
198 Using the Runnable interface
199 Utilities to manage thread ids
200 Very basic implementation of a thread pool
201 Very simple Threading example
202 View current Threads in a table
203 Visual suspend and resume
204 Wait exclusive semaphore with wait - notify primitives
205 Wait for the threads to finish
206 Wait the for the completion of a thread
207 Waiting on an object
208 Worker thread pool
209 Write your Beans this way so they can run in a multithreaded environment