I am creating a service that looks similar to this:
interface MyLogger
{
void logStuff( int id, String message );
}
The implementation basically opens a file and caches an instance of the BufferedWriter in the class. The method is synchronized.
Is it ok to have an opened file wrapper by a BufferedWriter in a long live manner ?
A simplistic implementation of logStuff.
public void logStuff(...)
{
try
{
this.writer.write( message );
this.writer.flush();
}
catch( IOException ignored ) {}
}