reset password
Author Message
cysun
Posts: 2935
Posted 13:52 Aug 05, 2009 |

Alexandre point out that if two calls to "new Date()" are close to each other, the two date values are identical, and this may cause problem when testing different buffer replacement policies. What you can do is inserting some Thread.sleep() calls into the test code BufferManagerTest.java so that the pin/unpin timestamps are different. For example:

public static void main( String args[] ) throws Exception
{
...
bufferManager.unpin( buffers[3] );
Thread.sleep(100);
bufferManager.unpin( Buffers[1] );
Thread.sleep(100);
bufferManager.unpin( Buffers[2] );
...
}

Thead.sleep(n) suspend the current thread for (roughly) n milliseconds.