Package google.registry.dns.writer
Class BaseDnsWriter
java.lang.Object
google.registry.dns.writer.BaseDnsWriter
- All Implemented Interfaces:
DnsWriter
- Direct Known Subclasses:
CloudDnsWriter
,DnsUpdateWriter
,VoidDnsWriter
A base implementation of
DnsWriter
that protects against multiple calls to commit().-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionfinal void
commit()
Commits the updates to the DNS server atomically.protected abstract void
Commits DNS updates.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface google.registry.dns.writer.DnsWriter
publishDomain, publishHost
-
Constructor Details
-
BaseDnsWriter
public BaseDnsWriter()
-
-
Method Details
-
commit
public final void commit()Description copied from interface:DnsWriter
Commits the updates to the DNS server atomically.The user is responsible for making sure commit() isn't called twice. Implementations are encouraged to throw an error if commit() is called twice.
Here's an example of how you would do that
private boolean committed = false; void commit() { checkState(!committed, "commit() has already been called"); committed = true; // ... actual commit implementation }
-
commitUnchecked
protected abstract void commitUnchecked()Commits DNS updates. This can never be called more than once.
-