Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public static void main(String[] args) {
- int numOfThreads = 1000;
- UnSafePublication uspObj = new UnSafePublication();
- Runnable initializeRunnable = () -> {
- uspObj.initialize();
- };
- Runnable assertRunnable = () -> {
- try {
- Thread.sleep(110);
- } catch (InterruptedException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
- if (uspObj.holder == null) {
- uspObj.holder.assertSanity(42);
- } else {
- uspObj.holder.assertSanity(uspObj.holder.getHolderValue());
- }
- };
- for (int i = 0; i < numOfThreads; i++) {
- Thread iR = new Thread(initializeRunnable);
- Thread aR = new Thread(assertRunnable);
- iR.start();
- aR.start();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement