Nitido Inc.

com.nitido.nimx.services.valet
Class ValetServiceImpl

java.lang.Object
  extended by com.nitido.nimx.services.valet.ValetService
      extended by com.nitido.nimx.services.valet.ValetServiceImpl

public class ValetServiceImpl
extends ValetService

The only implementation of the ValetService. It mantains the parked items in a HashMap that is kept in memory.


Field Summary
protected  NiM _confService
           
 
Constructor Summary
ValetServiceImpl()
           
 
Method Summary
 ValetItem attachItem(ValetTicket ticket, ValetItem item)
          Invoked by the nugget to attach a new instance of the itemMap.
static ValetServiceImpl getInstance()
          This is the singleton static method to obtain the reference
protected  int getIntConfig(java.lang.String confKey, int defaultValue)
           
protected  ValetItem getItem(java.lang.String id)
           
protected  java.util.ArrayList getItemIDs()
           
protected  long getLongConfig(java.lang.String confKey, long defaultValue)
           
protected  void init(NiM confService)
           
 void populateItem(ValetTicket ticket)
          Invoked by the ValetTicket's activate() method only.
 void removeItem(ValetTicket ticket)
          Invoked by the Nugget's destroyImpl() method to clean up the reference.
 void signalBirth()
          Invoked by the system's listener when the whole server is starting up.
 void signalDeath()
          Invoked by the system's listener when the whole server is shutting down.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

_confService

protected NiM _confService
Constructor Detail

ValetServiceImpl

public ValetServiceImpl()
Method Detail

getInstance

public static ValetServiceImpl getInstance()
This is the singleton static method to obtain the reference


init

protected void init(NiM confService)
             throws InitializationFailedException,
                    NiMException
Throws:
InitializationFailedException
NiMException

attachItem

public ValetItem attachItem(ValetTicket ticket,
                            ValetItem item)
                     throws ValetException
Invoked by the nugget to attach a new instance of the itemMap. This method must be thread safe. It will first check to see if there is any item already attached to the current node for the reference (just a safe guard against bad nugget code).

If the reference has nothing attached for the current node, the method should assign the ticket's _item field with the new object, update the ticket's node-id map and put the new item into this ValetService's id-item map.

If the reference has already got something assigned and the item is located in the id-item map, this service should simply use the existing item.

If the reference has already got something assigned and the item is not located in the id-item map, this service should replace that reference's node-id map with the new id and put the new id and item into the id-item map.

After a successful invocation, the ticket will contain the id of the item in the current node.

Please note that the resulting item inside the ValetTicket object may not be the same as the one the caller passed in.

Specified by:
attachItem in class ValetService
Returns:
an ValetItem object that is actually being parked to the ValetService (Note: it can be either the same item that was passed in, or another item object that has already been parked as specified in the ticket.)
Throws:
ValetException

removeItem

public void removeItem(ValetTicket ticket)
Invoked by the Nugget's destroyImpl() method to clean up the reference.

Specified by:
removeItem in class ValetService

populateItem

public void populateItem(ValetTicket ticket)
Invoked by the ValetTicket's activate() method only. It's used to populate the reference to the item when the ValetTicket is deserialized.

Specified by:
populateItem in class ValetService

getItem

protected ValetItem getItem(java.lang.String id)

getItemIDs

protected java.util.ArrayList getItemIDs()

signalBirth

public void signalBirth()
Invoked by the system's listener when the whole server is starting up.

Specified by:
signalBirth in class ValetService

signalDeath

public void signalDeath()
Invoked by the system's listener when the whole server is shutting down. This is mainly used to stop the clean up thread and force-close all pending connections.

Specified by:
signalDeath in class ValetService

getIntConfig

protected int getIntConfig(java.lang.String confKey,
                           int defaultValue)
                    throws InitializationFailedException
Throws:
InitializationFailedException

getLongConfig

protected long getLongConfig(java.lang.String confKey,
                             long defaultValue)
                      throws InitializationFailedException
Throws:
InitializationFailedException

Nitido NiM 2.5 Java API

These JavaDoc pages are generated for release/nim_2_5-2.5.44

Copyright © 1999-2009 Nitido Inc.    Proprietary and Confidential.    All Rights Reserved.