Package com.tangosol.io.journal
Class AbstractJournalRM.JournalImpl
- java.lang.Object
-
- com.tangosol.io.journal.AbstractJournalRM.JournalImpl
-
- All Implemented Interfaces:
Disposable
,Journal
,AutoCloseable
- Direct Known Subclasses:
RamJournalRM.JournalImpl
- Enclosing class:
- AbstractJournalRM
protected class AbstractJournalRM.JournalImpl extends Object implements Journal
A Journal implementation managed by this Journal Resource Manager.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface com.tangosol.io.journal.Journal
Journal.JournalConsumer
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
JournalImpl()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
dispose()
Invoked when all resources owned by the implementer can safely be released.protected Journal.JournalConsumer
getConsumer()
Obtain the JournalConsumer (typically a JournalBinaryStore) instance associated with this JournalImpl.protected RuntimeException
instantiateJournalFullException()
Return a RuntimeException indicating the Journal is out of capacity.Binary
read(long lTicket)
Using a ticket returned from a previous call toJournal.write(com.tangosol.util.Binary)
, read the Binary value that was written to the Journal.int
release(long lTicket)
Notify the Journal that the value corresponding to the specified ticket is no longer needed.protected void
setConsumer(Journal.JournalConsumer consumer)
Specify the JournalConsumer (typically a JournalBinaryStore) instance that this JournalImpl was created for.String
toString()
long
write(Binary bin)
Write a Binary value to the Journal and return a ticket for it.protected long
writeOverflow(Binary bin)
Handle the case in which the write overflows the capacity of the journal.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface com.oracle.coherence.common.base.Disposable
close
-
-
-
-
Method Detail
-
write
public long write(Binary bin)
Write a Binary value to the Journal and return a ticket for it.
-
read
public Binary read(long lTicket)
Using a ticket returned from a previous call toJournal.write(com.tangosol.util.Binary)
, read the Binary value that was written to the Journal.- Specified by:
read
in interfaceJournal
- Parameters:
lTicket
- a ticket returned from a previous call toJournal.write(com.tangosol.util.Binary)
- Returns:
- the Binary value that was previously written
-
release
public int release(long lTicket)
Notify the Journal that the value corresponding to the specified ticket is no longer needed.- Specified by:
release
in interfaceJournal
- Parameters:
lTicket
- a ticket returned from a previous call toJournal.write(com.tangosol.util.Binary)
- Returns:
- the number of bytes released
-
dispose
public void dispose()
Invoked when all resources owned by the implementer can safely be released.Once disposed of the object should no longer be considered to be usable.
Note the Disposable interface is compatible with try-with-resources which will automatically invoke this method.
- Specified by:
dispose
in interfaceDisposable
-
getConsumer
protected Journal.JournalConsumer getConsumer()
Obtain the JournalConsumer (typically a JournalBinaryStore) instance associated with this JournalImpl.- Returns:
- the JournalConsumer that this JournalImpl was created for
-
setConsumer
protected void setConsumer(Journal.JournalConsumer consumer)
Specify the JournalConsumer (typically a JournalBinaryStore) instance that this JournalImpl was created for.- Parameters:
consumer
- a JournalConsumer
-
writeOverflow
protected long writeOverflow(Binary bin)
Handle the case in which the write overflows the capacity of the journal.- Parameters:
bin
- the Binary to write- Returns:
- a ticket
- Throws:
IllegalStateException
- if nothing can be done to store the data
-
instantiateJournalFullException
protected RuntimeException instantiateJournalFullException()
Return a RuntimeException indicating the Journal is out of capacity.- Returns:
- a RuntimeException indicating the Journal is out of capacity
-
-