file io - Handling write and read at the same time in java -


i have thread continuously logging file. have function getlines() when called return last 100 lines of log file.

my question whether implementing simple bufferedreader inside getlines() enough ? i'm concerned whether reading valid when write going on. don't mind missing few lines of code written during process of read though.

thanks

since java fileoutputstream / fileinputstream open files in shared mode reading not interfere writing. though in view better , more efficient implement logger holds last 100 written lines , returns them on demand.


Comments

Popular posts from this blog

ruby on rails - Permission denied @ sys_fail2 - (D:/RoR/projects/grp/public/uploads/ -

c++ - nodejs socket.io closes connection before upgrading to websocket -

java - What is the equivalent of @Value in CDI world? -