Brooklyn

brooklyn.entity.rebind.persister
[Java] Class MementoFileWriter

java.lang.Object
  brooklyn.entity.rebind.persister.MementoFileWriter

public class MementoFileWriter

For asynchronously writing to a file. This class is thread-safe. If a write is in progress, one will be scheduled. If a write is already scheduled, we will just rely on the existing one; otherwise we will write now.

Authors:
aled


Field Summary
protected static Logger LOG

 
Constructor Summary
MementoFileWriter(java.io.File file, ListeningExecutorService executor, MementoSerializer serializer)

@param val

 
Method Summary
void delete()

void waitForWriteCompleted(long timeout, java.util.concurrent.TimeUnit unit)

This method must only be used for testing.

void write(java.lang.Object val)

 
Methods inherited from class java.lang.Object
java.lang.Object#wait(), java.lang.Object#wait(long), java.lang.Object#wait(long, int), java.lang.Object#equals(java.lang.Object), java.lang.Object#toString(), java.lang.Object#hashCode(), java.lang.Object#getClass(), java.lang.Object#notify(), java.lang.Object#notifyAll()
 

Field Detail

LOG

protected static final Logger LOG


 
Constructor Detail

MementoFileWriter

public MementoFileWriter(java.io.File file, ListeningExecutorService executor, MementoSerializer serializer)
Parameters:
val
file
executor - A sequential executor (e.g. SingleThreadedExecutor, or equivalent)
serializer


 
Method Detail

delete

public void delete()


waitForWriteCompleted

@VisibleForTesting
public void waitForWriteCompleted(long timeout, java.util.concurrent.TimeUnit unit)
This method must only be used for testing. If required in production, then revisit implementation!


write

public void write(java.lang.Object val)


 

Brooklyn Multi-Cloud Application Management Platform
brooklyncentral.github.com. Apache License. © 2012.