LiVe YoUr DrEaM…

Archive for March 2013

best-kept-secretName : Best Kept Secret

Author: Jeffrey Archer

Genre : Fiction

Pages : 370+

Language: English

Publication Year: 2013

Is Review Spoiler: No

Rating: 4/5

—————————————————————————————————————————

You can find “Only Time Will Tell” review – here.

You can find “The Sins Of Father” review – here.

Jeffery Archer is best known as a “master storyteller” and the stories he narrates are so non-put-downable, even though they don’t involve great deal of suspense/thriller/mystery. the character development is as amazing as ‘Only Time Will Tell’ and story is gripping, compelling and great read. Ending is nail-biting and better than ‘The Sins Of Father’. I really can’t wait for fourth book in the chronicles.

‘Best Kept Secret’ – is the third book in “The Clifton Chronicles”; In this book Archer continues the life saga of ‘Harry Clifton’. Like others books in ‘The Clifton Chronicles’ this book to ends with an cliff-hanger in in such way that reader has to wait for next book to be released in the series in order to find out what happened.

Best Kept Secret opens a moment after the end of The Sins of the Father, with the resolution of the trial and the triumphant marriage of Harry Clifton and Elizabeth Barrington, finally uniting their family. Harry, now a bestselling novelist, Emma, their son Sebastian, and orphaned Jessica make a new life for themselves, but all is not as happy and secure as it could be. Emma’s brother, Giles, is engaged to a woman who may be more interested in Barrington’s fortune and title than in a long and happy marriage. And Sebastian, though he is bright, isn’t quite the hard worker that his father was at school, and finds a hard time resisting the temptations that his somewhat unsavory friends provide.

This book is divided into two parts – the first part of the book deals with Harry’s book promotions as a detective novelist and court room trial as to who should inherit the Baringatton title and all that is therein. Second part of the book mainly deals with election campaign of Giles Baringatton, here Archer introduces an old enemy Alex Fisher – who tortured Harry at school and later took credit for Giles’ heroics during the war.

The story continues to next generation of Clifton’s with Sebastian, the son of Harry and Emma, who is not as good as his father at studies and finds a hard time resisting the temptations that his somewhat unsavory friends provide – this leads to another cliff-hanger ending from Jeffrey Archer.

If you are looking for what’s the ‘best kept secret’ is, you won’t find it out until you read half of the book. Believe me title has nothing to do with the actual contents of the book and story.

Jeffrey Archer recently revealed, during his Indian tour from March 10-15, that the Clifton Chronicles might comprise of more books than he had originally planned. Harry Clifton is only 35 at the end of this third book, and Archer suggested that he would have to extend his pentalogy to a hexalogy or even a heptalogy. [“wikipedia”]

If you have read last two book in the chronicles, this is must read for you. For those who haven’t read first two book, I suggest they start with the ‘Only Time Will Tell’.

Advertisements

Problem Statement: Four threads need to add one element each at a time in a shared list. Each Thread will have it’s own list, say, Thread 1 will have list1 similarly Thread 2 will have list2 so on. And all threads will add to the list5.

Order in which they need to add elements: Thread 1 will add one element and after Thread 1, Thread 2 will add one element and after Thread 2, Thread 3 will add one element and after Thread 3, Thread 4 will add one element – and after Thread 4 – again Thread 1 will add one element to list 5 until they add all their elements to list5.

Code for above problem [run ThreadCoordinationSimulator.java]:

/**
 * This program used to demonstrate the Thread co-ordination in which threads
 * will execute their tasks in given order. for example: In below example each
 * thread holds a list of integers and it has to iterate and add the elements
 * from list to shared list. In a below given order – Thread 1 will add one
 * element from it’s list to shared list and then wait. After compilation of
 * Thread 1 – Thread 2 will add one element from it’s list to shared list and
 * then wait. Similarly Thread 3 and Thread 4 will add one element in above
 * mentioned order wait. Once Thread 4 – has done adding element to the shared
 * list, again Thread 1 will start and add the element to the thread in above
 * mentioned order.
 *
 * @author sayedkhadri
 * @version 1.0.0
 */
public class ThreadCoordinationSimulator {
List<Integer> sharedListOfIntegers = new ArrayList<Integer>();
Lock l = new ReentrantLock();
Condition c1 = l.newCondition();
Condition c2 = l.newCondition();
Condition c3 = l.newCondition();
Condition c4 = l.newCondition();
/**
* This method will add an integer to shared list after acquiring the lock
* l, otherwise it will wait till lock is available.
*
* @param i
*            integer to be added.
*/
public void add(int i) {
            l.lock();
                 sharedListOfIntegers.add(i);
            l.unlock();
}
public static void main(String[] args) {
             List<Integer> l1 = Arrays.asList(1, 2, 3, 4);
            List<Integer> l2 = Arrays.asList(5, 6, 7, 8);
            List<Integer> l3 = Arrays.asList(9, 10, 11, 12);
            List<Integer> l4 = Arrays.asList(13, 14, 15, 16);
            ThreadCoordinationSimulator tester = new ThreadCoordinationSimulator();
            new WorkerForStoringIntegers(l1, tester.l, tester.c4, tester.c1, tester, “Thread 1”).start();
            new WorkerForStoringIntegers(l2, tester.l, tester.c1, tester.c2, tester, “Thread 2”).start();
            new WorkerForStoringIntegers(l3, tester.l, tester.c2, tester.c3, tester, “Thread 3”).start();
            new WorkerForStoringIntegers(l4, tester.l, tester.c3, tester.c4, tester, “Thread 4”).start();
try {
          tester.l.lock();
                  tester.c4.signalAll();
           tester.l.unlock();
} catch (Exception e) {
e.printStackTrace();
}
}
}
The Worker Thread.
/**

*
*
*
* @author sayedkhadri
* @version 1.0.0
*/
public class WorkerForStoringIntegers extends Thread {
Lock lock = null;
Condition waitForCondition = null;
Condition notifyCondition = null;
List<Integer> listOfIntegers = new ArrayList<Integer>();
ThreadCoordinationSimulator tester = null;

public WorkerForStoringIntegers(List<Integer> listOfIntegers, Lock lock, Condition waitForCondtion, Condition notifyCondtion, ThreadCoordinationSimulator tester, String threadName) {

this.lock = lock;
this.waitForCondition = waitForCondtion;
this.notifyCondition = notifyCondtion;
this.listOfIntegers = listOfIntegers;
this.tester = tester;
this.setName(threadName);

}

@Override
public void run() {

lock.lock();

try {
waitForCondition.await();

for (Integer i : listOfIntegers) {
System.out.println(Thread.currentThread().getName() + ” Adding Element: ” + i + ” to shared list.”);
tester.add(i);
notifyCondition.signalAll();//once addition is done, notify the one who is waiting.

waitForCondition.await();//wait till you are notified.
}

System.out.println(Thread.currentThread().getName() + ” Successfully Completed.”);
notifyCondition.signalAll();
lock.unlock();

} catch (Exception e) {

}
}

}

Save ThreadCoordinationSimulator.java and WorkerForStoringIntegers.java in same package and run ThreadCoordinationSimulator.java.

Let me know your views on this.


Enter your email address to follow this blog and receive notifications of new posts by email.

Join 65 other followers

Read

  • 47,254 times

My Tweets (Click to follow me)

Error: Twitter did not respond. Please wait a few minutes and refresh this page.

Indi Rank

sayedkhadri.wordpress.com
72/100

IndiCoder

IndiBlogger

Visitors Locations