com.sun.sgs.impl.service.channel
Class ChannelServiceImpl.Context

java.lang.Object
  extended by com.sun.sgs.impl.util.TransactionContext
      extended by com.sun.sgs.impl.service.channel.ChannelServiceImpl.Context
Enclosing class:
ChannelServiceImpl

final class ChannelServiceImpl.Context
extends TransactionContext

This transaction context maintains a per-channel list of non-transactional tasks to perform when the transaction commits. A task is added to the context by a ChannelImpl via the addChannelTaskOnCommit method. Such non-transactional tasks include sending a notification to a channel server to modify the channel membership list, or forwarding a send request to a set of channel servers.


Field Summary
 
Fields inherited from class com.sun.sgs.impl.util.TransactionContext
isCommitted, isPrepared, txn
 
Method Summary
 void abort(boolean retryable)
          Removes the context from the context list containing pending updates, and flushes all committed contexts preceding prepared ones.
 void addChannelToService(BigInteger channelRefId)
          Adds the specified channelRefId to the set of locally-coordinated channels whose event queues need to be serviced as a result of operations executed during this context's associated transaction.
 void addTask(BigInteger channelRefId, KernelRunnable task)
          Adds the specified non-transactional task to the task list of the given channelRefId.
 void commit()
          Marks this transaction as committed and flushes all committed contexts preceding prepared ones.
 boolean prepare()
          Marks this transaction as prepared, and if there are pending changes, adds this context to the context list and returns false.
 
Methods inherited from class com.sun.sgs.impl.util.TransactionContext
getTransaction, isPrepared, prepareAndCommit
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

addTask

public void addTask(BigInteger channelRefId,
                    KernelRunnable task)
Adds the specified non-transactional task to the task list of the given channelRefId. If the transaction commits, the task will be added to the channel's tasks queue.


addChannelToService

public void addChannelToService(BigInteger channelRefId)
Adds the specified channelRefId to the set of locally-coordinated channels whose event queues need to be serviced as a result of operations executed during this context's associated transaction.

When this context is flushed, for each channel that needs to be serviced, a task to service the channel's event queue will be added to that channel coordinator's task queue.

Parameters:
channelRefId - a locally-coordinated channel that needs to be serviced

prepare

public boolean prepare()
Marks this transaction as prepared, and if there are pending changes, adds this context to the context list and returns false. Otherwise, if there are no pending changes returns true indicating readonly status.

Overrides:
prepare in class TransactionContext
Returns:
true if this context's state is read-only, false otherwise

abort

public void abort(boolean retryable)
Removes the context from the context list containing pending updates, and flushes all committed contexts preceding prepared ones.

Specified by:
abort in class TransactionContext
Parameters:
retryable - if true, the transaction's abort cause is a retryable exception

commit

public void commit()
Marks this transaction as committed and flushes all committed contexts preceding prepared ones.

Specified by:
commit in class TransactionContext

RedDwarf, Version 0.10.1
2010-03-14 10:56:12

Copyright © 2010 The RedDwarf Authors. All rights reserved
Copyright © 2007-2010 Sun Microsystems, Inc. All rights reserved