abstract class WriteOperations.LobOp<R,E extends Exception> extends Object
abstract
class used to perform retries for a
put or delete operation applied to a LOB.Constructor and Description |
---|
WriteOperations.LobOp(long chunkTimeout,
TimeUnit chunkTimeoutUnit,
long opTimeout,
TimeUnit opTimeoutUnit)
Convenience constructor for the
deleteLOB operation. |
WriteOperations.LobOp(WriteOperations.LOBStreamListener inStreamCallback,
long chunkTimeout,
TimeUnit chunkTimeoutUnit,
long opTimeout,
TimeUnit opTimeoutUnit)
Creates a concrete instance of this class representing the desired
LOB put or delete operation with the requested
parameters described below.
|
Modifier and Type | Method and Description |
---|---|
(package private) abstract R |
doLobOp(InputStream inStream,
long chunkTmOutMS)
Implemented for each LOB operation.
|
(package private) InputStream |
prepareForRetry(int iTry,
FaultException fe)
Applies the appropriate logic to determine if a retry of the current
operation can/should be made; updating the necessary state to
prepare for and support such a retry.
|
(package private) R |
run()
Calls the doLobOp method and performs retries when a FaultException
is thrown.
|
WriteOperations.LobOp(WriteOperations.LOBStreamListener inStreamCallback, long chunkTimeout, TimeUnit chunkTimeoutUnit, long opTimeout, TimeUnit opTimeoutUnit)
LobOp
)
provides the implementation of the retry logic that will be employed
by each LOB operation when failure occurs, it is the entity that
calls the operation that must provide an implementation of the
inStreamCallback
parameter; which is used by the retry
mechanism to obtain a new or reset InputStream
instance
positioned at the first byte of the associated LOB value.inStreamCallback
- instance of the interface
WriteOperations.LOBStreamListener
; which specifies how
the associated InputStream
should be created or reset
when the operation represented by the current instance of this class
is retried as a result of a failure. If the operation represented by
this class is deleteLOB
, then null
should
be input for this parameter; otherwise, the calling entity must
provide an application-specific implementation of the
WriteOperations.LOBStreamListener
interface for this
parameter.chunkTimeout
- the timeout to use when attempting the desired
operation on each LOB "chunk". The value input for this parameter is
an upper bound on the time taken to perform the operation on each
chunk. A best effort is made not to exceed the specified limit. If
zero is input, then the value returned by
KVStoreConfig.getLOBTimeout(java.util.concurrent.TimeUnit)
is used. If the value input
for this parameter is less than 0, then an
IllegalArgumentException
is thrown.chunkTimeoutUnit
- the unit of time on which the value input
for the chunkTimeout parameter is based; for example,
TimeUnit.MILLISECONDS
.opTimeout
- the timeout to use when attempting the desired
operation on a given LOB (stream); that is, the sequence of chunks
making up the LOB. The value input for this parameter is an upper
bound on the time taken to perform the operation on the LOB as a
whole. If zero is input, then the value returned by KVStoreConfig.getRequestTimeout(java.util.concurrent.TimeUnit)
is used. If the value input for
this parameter is less than 0 or greater than
Integer.MAX_VALUE
, an
IllegalArgumentException
is thrown. This parameter must
be less than or equal to Integer.MAX_VALUE
because a
value greater than Integer.MAX_VALUE
when constructing
a RequestTimeoutException
(when the requested operation
timeout has been exceeded before a retry can be initiated) will
result in overflow.opTimeoutUnit
- the unit of time on which the value input for
the opTimeout parameter is based; for example,
TimeUnit.MILLISECONDS
.abstract R doLobOp(InputStream inStream, long chunkTmOutMS) throws FaultException, ConcurrentModificationException, IOException, E extends Exception
chunkTmOutMS
- the timeout in milliseconds to use when
attempting the desired operation on each LOB "chunk".FaultException
ConcurrentModificationException
IOException
E extends Exception
R run() throws FaultException, ConcurrentModificationException, IOException, E extends Exception
FaultException
ConcurrentModificationException
IOException
E extends Exception
InputStream prepareForRetry(int iTry, FaultException fe) throws FaultException, ConcurrentModificationException, IOException
If the LOBStreamListener
is null
, then the
current operation must be deleteLOB
rather than one of
the putLob operations. For that case, since there is no
stream for deleteLOB
to operate on, this method returns
null
. On the other hand, if the
LOBStreamListener
is not null
, then the
current operation must be either putLob
or one of its
counterparts; in which case, before retrying the operation, this
method uses the callback mechanism provided by the listener to
produce and return a new or reset InputStream
instance
positioned at the first byte of the associated LOB.
Copyright (c) 2011, 2015 Oracle and/or its affiliates. All rights reserved.