com.sun.jini.outrigger
Interface LogOps


public interface LogOps

Methods that log an operation. These are used when writing to the store.

The writeOp and takeOp methods can be called under a transaction. For these methods an in-progress transaction is indicated by a non-null txnId parameter. The txnId is an identifier for a transaction. Each unique transaction must have a unique identifier and all write or take operations under the same transaction should use the same identifier. The store does not interpret the identifier in any way.

Note: Because the transaction identifier must be unique, it can not be ServerTransaction.id. Instead this identifier is the Txn ID.

When a transaction is closed, the prepareOp, commitOp, and abortOp methods are passed the identifier (txnId) for that transaction. If prepareOp is called and there is a restart, the txnId passed to the write and take operations will be passed back to the server via the Recover.recoverWrite and Recover.recoverTake methods. Likewise the same identifier will be passed to Recover.recoverTransaction.

Author:
Sun Microsystems, Inc.
See Also:
Store, Recover

Method Summary
 void abortOp(Long txnId)
          Log a transaction abort.
 void bootOp(long time, long sessionId)
          Log a server boot (first time start or any reactivation).
 void cancelOp(Uuid cookie, boolean expired)
          Log a cancel and entry or registration.
 void commitOp(Long txnId)
          Log a transaction commit or prepareAndCommit.
 void joinStateOp(StorableObject state)
          Log an update to the join state
 void prepareOp(Long txnId, StorableObject transaction)
          Log a transaction prepare.
 void registerOp(StorableResource registration, String type, StorableObject[] templates)
          Log a notify operation.
 void renewOp(Uuid cookie, long expiration)
          Log a renew operation.
 void takeOp(Uuid[] cookies, Long txnId)
          Log a batch take operation.
 void takeOp(Uuid cookie, Long txnId)
          Log a take operation.
 void uuidOp(Uuid uuid)
          Log the Uuid that identifies the space as a whole.
 void writeOp(StorableResource[] entries, Long txnId)
          Log a batch write operation.
 void writeOp(StorableResource entry, Long txnId)
          Log a write operation.
 

Method Detail

bootOp

void bootOp(long time,
            long sessionId)
Log a server boot (first time start or any reactivation).

Parameters:
time - stamp for this boot
sessionId - of this boot
See Also:
Recover.recoverSessionId(long)

joinStateOp

void joinStateOp(StorableObject state)
Log an update to the join state

Parameters:
state - to be logged
See Also:
Recover.recoverJoinState(com.sun.jini.outrigger.StoredObject)

writeOp

void writeOp(StorableResource entry,
             Long txnId)
Log a write operation. If the operation was performed under a transaction the txnId is the identifier for that transaction.

Parameters:
entry - to be logged
txnId - transaction identifier or null if no transaction is active for this write
See Also:
Recover.recoverWrite(com.sun.jini.outrigger.StoredResource, java.lang.Long)

writeOp

void writeOp(StorableResource[] entries,
             Long txnId)
Log a batch write operation. If the operation was performed under a transaction the txnId is the identifier for that transaction.

Parameters:
entries - to be logged
txnId - transaction identifier or null if no transaction is active for this write
See Also:
Recover.recoverWrite(com.sun.jini.outrigger.StoredResource, java.lang.Long)

takeOp

void takeOp(Uuid cookie,
            Long txnId)
Log a take operation. If the operation was performed under a transaction the txnId is the identifier for that transaction.

Parameters:
cookie - ID identifying the entry target to be taken
txnId - transaction identifier or null if no transaction is active for this take
See Also:
Recover.recoverTake(net.jini.id.Uuid, java.lang.Long)

takeOp

void takeOp(Uuid[] cookies,
            Long txnId)
Log a batch take operation. If the operation was performed under a transaction the txnId is the identifier for that transaction.

Parameters:
cookies - IDs identifying the entries to be taken
txnId - transaction identifier or null if no transaction is active for this take
See Also:
Recover.recoverTake(net.jini.id.Uuid, java.lang.Long)

registerOp

void registerOp(StorableResource registration,
                String type,
                StorableObject[] templates)
Log a notify operation. Notifications under transactions are lost at the end of the transaction, so the only ones that are logged are those that are under no transaction.

Parameters:
registration - to be logged
type - of registration, passed back via type parameter of corresponding recoverRegister call
templates - associated with this registration
See Also:
Recover.recoverRegister(com.sun.jini.outrigger.StoredResource, java.lang.String, com.sun.jini.outrigger.StoredObject[])

renewOp

void renewOp(Uuid cookie,
             long expiration)
Log a renew operation. We use the expiration, not the extension, because we don't want to calculate the expiration relative to when we read the log -- we want to use the exact expiration granted.

Parameters:
cookie - ID of the entry or registration associated with this renew
expiration - time
See Also:
StoredResource

cancelOp

void cancelOp(Uuid cookie,
              boolean expired)
Log a cancel and entry or registration. The entry or registration associated with cookie will no longer be recoverable and may be removed from the log records.

Parameters:
cookie - ID of the entry or registration to cancel
expired - is true if the cancel was due to a lease expiration

prepareOp

void prepareOp(Long txnId,
               StorableObject transaction)
Log a transaction prepare. If there is a restart before either commitOp or abortOp is called for the transaction identified by txnId, all write and take operations associated with txnId will be recovered and Recover.recoverTransaction called with the the same txnId.

Parameters:
txnId - identifier of the transaction to be prepared
transaction - object associated with this transaction
See Also:
Recover.recoverTransaction(java.lang.Long, com.sun.jini.outrigger.StoredObject)

commitOp

void commitOp(Long txnId)
Log a transaction commit or prepareAndCommit. The store will commit the write and take operations associated with txnId. A call to prepareOP is not required for commitOp to be called.

Parameters:
txnId - identifier of the transaction to be committed

abortOp

void abortOp(Long txnId)
Log a transaction abort. Any write and take operations associated with txnId will no longer be recoverable and may be removed from the log records.

Parameters:
txnId - identifier of the transaction to be aborted

uuidOp

void uuidOp(Uuid uuid)
Log the Uuid that identifies the space as a whole.

Parameters:
uuid - The Uuid to be stored.
See Also:
Recover.recoverUuid(net.jini.id.Uuid)


Copyright 2007, multiple authors.
Licensed under the Apache License, Version 2.0, see the NOTICE file for attributions.