|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.sun.sgs.impl.util.AbstractService
com.sun.sgs.impl.service.nodemap.NodeMappingServerImpl
public final class NodeMappingServerImpl
The remote server portion of the node mapping service. This portion of the service is used for any global operations, such as selecting a node for an identity. Additionally, all changes to the map are made by the server so it can notify listeners of changes, no matter which node is affected.
The constructor supports the following
properties:
com.sun.sgs.impl.service.nodemap.server.port
44535
NodeMappingServer. This value must be no less than 0 and no
greater than 65535. The value 0 can only be specified
if the com.sun.sgs.impl.service.nodemap.start.server
property is true, and means that an anonymous port will be
chosen for running the server.
com.sun.sgs.impl.service.nodemap.policy.class
com.sun.sgs.impl.service.nodemap.RoundRobinPolicy
NodeAssignPolicy, used for the node assignment policy. The class
should be public, not abstract, and should provide a public constructor
with Properties and NodeMappingServerImpl parameters.
com.sun.sgs.impl.service.nodemap.remove.expire.time
5000
0. Shorter expiration times cause the
map to be cleaned up more frequently, potentially causing more
assignNode
calls; longer expiration times will increase the chance that an
identity will become active again before it can be removed.
com.sun.sgs.impl.service.nodemap.relocation.expire.time
10000
IdentityRelocationListeners to call
completed on the
handler they receive. If this time has elapsed, this server disregards
the proposed identity relocation. This value is used to guard against
listeners which never respond they are finished. During this time
period, the identity is prohibited from moving elsewhere unless the
node has failed.
This class uses the Logger named
com.sun.sgs.impl.service.nodemap.server to log
information at the following logging levels:
SEVERE - Initialization or test failures
CONFIG - Construction information
WARNING - Errors
FINE - Map entry remove operations
FINEST - Trace operations
This class is public for testing.
| Nested Class Summary | |
|---|---|
(package private) static class |
NodeMappingServerImpl.GetIdTask
Task which gets an IdentityMO from a data service. |
| Nested classes/interfaces inherited from class com.sun.sgs.impl.util.AbstractService |
|---|
AbstractService.State, AbstractService.Version |
| Field Summary | |
|---|---|
(package private) static int |
DEFAULT_SERVER_PORT
The default value of the server port. |
(package private) static String |
SERVER_EXPORT_NAME
The name we export ourselves under. |
(package private) static String |
SERVER_PORT_PROPERTY
The property name for the server port. |
(package private) WatchdogService |
watchdogService
The watchdog service. |
| Fields inherited from class com.sun.sgs.impl.util.AbstractService |
|---|
appName, dataService, IO_TASK_PROPERTY_PREFIX, IO_TASK_RETRIES_PROPERTY, IO_TASK_WAIT_TIME_PROPERTY, maxIoAttempts, retryWaitTime, taskOwner, taskScheduler, transactionScheduler, txnProxy |
| Constructor Summary | |
|---|---|
NodeMappingServerImpl(Properties properties,
ComponentRegistry systemRegistry,
TransactionProxy txnProxy)
Creates a new instance of NodeMappingServerImpl, called from the local NodeMappingService. |
|
| Method Summary | |
|---|---|
boolean |
assertValid(Identity identity)
Check the validity of the data store for a particular identity. |
long |
assignNode(Class service,
Identity identity,
long requestingNode)
Assigns the identity to a node and indicates that the service class believes this identity is active. |
void |
canMove(Identity id)
All IdentityRelocationListeners have completed their work,
so it's safe to move the identity. |
void |
canRemove(Identity id)
The identity's reference count has gone to zero, so it can be removed. |
protected void |
doReady()
Performs ready operations. |
protected void |
doShutdown()
Performs shutdown operations. |
(package private) long |
getNodeForIdentity(Identity id)
Get the node an identity is mapped to. |
(package private) int |
getPort()
Returns the port being used for this server. |
protected void |
handleServiceVersionMismatch(AbstractService.Version oldVersion,
AbstractService.Version currentVersion)
Handles conversion from the oldVersion to the currentVersion. |
void |
registerNodeListener(NotifyClient client,
long nodeId)
Register a NotifyClient object to be called when changes
occur on a particular node. |
(package private) Set<String> |
reportFoundKeys(Identity identity)
Return the data store keys found for a particular identity. |
(package private) void |
runTransactionally(KernelRunnable task)
Run the given task synchronously, and transactionally, retrying if the exception is of type <@code ExceptionRetryStatus>. |
String |
toString()
Returns a string representation of this instance. |
void |
unregisterNodeListener(long nodeId)
Unregister the NotifyClient object for a node if one
is registered. |
| Methods inherited from class com.sun.sgs.impl.util.AbstractService |
|---|
callFinished, callStarted, checkNonTransactionalContext, checkServiceVersion, createTaskQueue, getDataService, getName, getState, isAlive, isInInitializedState, isRetryableException, ready, runIoTask, shutdown, shuttingDown |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
static final String SERVER_PORT_PROPERTY
static final int DEFAULT_SERVER_PORT
static final String SERVER_EXPORT_NAME
final WatchdogService watchdogService
| Constructor Detail |
|---|
public NodeMappingServerImpl(Properties properties,
ComponentRegistry systemRegistry,
TransactionProxy txnProxy)
throws Exception
The application context is resolved at construction time (rather
than when AbstractService.ready() is called), because this
server will never need Managers and will not run application code.
Managers are not available until Service.ready is called.
properties - service propertiessystemRegistry - system registrytxnProxy - the transaction proxy
Exception - if an error occurs during creation| Method Detail |
|---|
protected void handleServiceVersionMismatch(AbstractService.Version oldVersion,
AbstractService.Version currentVersion)
oldVersion to the currentVersion. This method is invoked by checkServiceVersion if a version mismatch is detected and is invoked
from within a transaction.
handleServiceVersionMismatch in class AbstractServiceoldVersion - the old versioncurrentVersion - the current versionprotected void doReady()
ready method only once so that the subclass can
perform any operations necessary during the "ready" phase.
doReady in class AbstractServiceprotected void doShutdown()
shutdown method only once so that the
subclass can perform any operations necessary to shutdown the
service.
Called from the instantiating service.
doShutdown in class AbstractServicepublic String toString()
toString in class Object
public long assignNode(Class service,
Identity identity,
long requestingNode)
throws IOException
assignNode in interface NodeMappingServerservice - the class of the calling serviceidentity - the identity to assign
should this be a set? requestingNode - the id of the node requesting assignment
IOException - if a communication problem occurs while
invoking this method
public void canMove(Identity id)
throws IOException
IdentityRelocationListeners have completed their work,
so it's safe to move the identity.
canMove in interface NodeMappingServerid - the identity which can now be moved
IOException - if a communication problem occurs while
invoking this method
public void canRemove(Identity id)
throws IOException
canRemove in interface NodeMappingServerid - the identity which can be removed from the map
IOException - if a communication problem occurs while
invoking this method
public void registerNodeListener(NotifyClient client,
long nodeId)
throws IOException
NotifyClient object to be called when changes
occur on a particular node. Only one listener object can be
registered per nodeId, and registering a listener
will clear any previously registered listener for that nodeId.
Registration must only be made during service startup.
Only nodes that have registered can be assigned identities. Nodes will
not be added to the server's NodeAssignPolicy unless they have
registered a listener with this method.
registerNodeListener in interface NodeMappingServerclient - the callback clientnodeId - the node which client is interested in changes to
IOException - if a communication problem occurs while
invoking this method
public void unregisterNodeListener(long nodeId)
throws IOException
NotifyClient object for a node if one
is registered.
Also called internally when we hear a node has died.
unregisterNodeListener in interface NodeMappingServernodeId - the node
IOException - if a communication problem occurs while
invoking this method
public boolean assertValid(Identity identity)
throws Exception
assertValid in interface NodeMappingServeridentity - the identity
true if all is well, false if there is a problem
Exception - if any error occursint getPort()
void runTransactionally(KernelRunnable task)
throws Exception
task - the task
Exception
long getNodeForIdentity(Identity id)
throws Exception
id - the identity
Exception - if any error occurs
Set<String> reportFoundKeys(Identity identity)
throws Exception
identity - the identity
Exception - if any error occurs
|
RedDwarf, Version 0.10.1 2010-03-14 10:56:12 |
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||