Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package leak;
- public class Main {
- public static void main(String... args) {
- //event subscriber thread
- new Thread( new Runnable() {
- @Override
- public void run() {
- for (int i = 0; i < 100000; i++) {
- Subscriber sub = new Subscriber();
- try {
- Thread.sleep(1000);
- } catch (InterruptedException e) {
- e.printStackTrace();
- }
- }
- }
- }).start();
- //event producer thread
- new Thread( new Runnable() {
- @Override
- public void run() {
- for (int i = 0; i < Integer.MAX_VALUE; i++) {
- Publisher.publishEvent( new Publisher.Event(i));
- try {
- Thread.sleep(100);
- } catch (InterruptedException e) {
- e.printStackTrace();
- }
- }
- }
- }).start();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement