Package omero.util

Class ServantHolder


  • public class ServantHolder
    extends java.lang.Object
    Manager for all active servants in a single session. To reduce the need of using Util.stringToIdentity(String) and Util.identityToString(Ice.Identity) the servant tries to make the two usages equivalent.
    Since:
    3.0-Beta4
    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected java.util.Map<java.lang.String,​java.lang.Object> clientIds
      An internal mapping to all client ids from SessionI for a given DB session since there is no method on ObjectAdapter to retrieve all servants.
    • Constructor Summary

      Constructors 
      Constructor Description
      ServantHolder​(java.lang.String session)  
      ServantHolder​(java.lang.String session, int servantsPerSession)  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void acquireLock​(java.lang.String key)
      Acquires the given lock or if necessary creates a new one.
      void addClientId​(java.lang.String clientId)  
      Ice.Object get​(Ice.Identity id)  
      java.util.Set<java.lang.String> getClientIds()  
      Ice.Identity getIdentity​(java.lang.String idName)
      Constructs an Identity from the current session and from the given String which for stateful services are defined by UUIDs.
      java.util.List<java.lang.String> getServantList()  
      java.lang.String getSession()  
      java.lang.String getStatefulServiceCount()  
      java.lang.Object getUntied​(Ice.Identity id)  
      void put​(Ice.Identity id, Ice.Object servant)  
      void releaseLock​(java.lang.String key)
      Releases the given lock if found, otherwise throws an InternalException
      Ice.Object remove​(Ice.Identity id)  
      void removeClientId​(java.lang.String clientId)  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • clientIds

        protected final java.util.Map<java.lang.String,​java.lang.Object> clientIds
        An internal mapping to all client ids from SessionI for a given DB session since there is no method on ObjectAdapter to retrieve all servants.
    • Constructor Detail

      • ServantHolder

        public ServantHolder​(java.lang.String session)
      • ServantHolder

        public ServantHolder​(java.lang.String session,
                             int servantsPerSession)
    • Method Detail

      • getSession

        public java.lang.String getSession()
      • getIdentity

        public Ice.Identity getIdentity​(java.lang.String idName)
        Constructs an Identity from the current session and from the given String which for stateful services are defined by UUIDs.
      • addClientId

        public void addClientId​(java.lang.String clientId)
      • removeClientId

        public void removeClientId​(java.lang.String clientId)
      • getClientIds

        public java.util.Set<java.lang.String> getClientIds()
      • acquireLock

        public void acquireLock​(java.lang.String key)
        Acquires the given lock or if necessary creates a new one.
        Parameters:
        key - the lock's key
      • releaseLock

        public void releaseLock​(java.lang.String key)
        Releases the given lock if found, otherwise throws an InternalException
        Parameters:
        key - the lock's key
      • get

        public Ice.Object get​(Ice.Identity id)
      • getUntied

        public java.lang.Object getUntied​(Ice.Identity id)
      • remove

        public Ice.Object remove​(Ice.Identity id)
      • getServantList

        public java.util.List<java.lang.String> getServantList()
      • getStatefulServiceCount

        public java.lang.String getStatefulServiceCount()