Nitido Inc.

com.nitido.nimx.services.valet
Class ValetService

java.lang.Object
  extended by com.nitido.nimx.services.valet.ValetService
Direct Known Subclasses:
ValetServiceImpl

public abstract class ValetService
extends java.lang.Object

Valet Service is a special NiMKernelService that provides custodian service for holding resources that cannot be migrated to other servers in the same cluster.

For example, an application may have a IMAP mail server connection opened for a specific user. However, this user's HTTP Session can be migrated to other machines in the same cluster. Therefore, the application will either open and close the connection for every transaction, or park the connection somewhere on the machine's runtime memory. This ValetService is designed to provide this type of "resource parking" functions.


Constructor Summary
ValetService()
           
 
Method Summary
abstract  ValetItem attachItem(ValetTicket ticket, ValetItem item)
          Invoked by the nugget to attach a new instance of the itemMap.
abstract  void populateItem(ValetTicket ticket)
          Invoked by the ValetTicket's activate() method only.
abstract  void removeItem(ValetTicket ticket)
          Invoked by the Nugget's destroyImpl() method to clean up the reference.
abstract  void signalBirth()
          Invoked by the system's listener when the whole server is starting up.
abstract  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
 

Constructor Detail

ValetService

public ValetService()
Method Detail

attachItem

public abstract 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 iteminside the ValetTicket object may not be the same as the one the caller passed in.

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 abstract void removeItem(ValetTicket ticket)
Invoked by the Nugget's destroyImpl() method to clean up the reference.


populateItem

public abstract 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.


signalBirth

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


signalDeath

public abstract 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.


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.