Package com.sun.sgs.app

Examples of com.sun.sgs.app.DataManager


        private ManagedReference<ClientConnectionHandler> ref;
       
        public ManagedClientHandlerRef(ClientConnectionHandler handler) {
            super (null);
           
            DataManager dm = AppContext.getDataManager();
            ref = dm.createReference(handler);
        }
View Full Code Here


     * Create a new instance of WonderlandSessionListener for the given
     * session
     * @param session the session connected to this listener
     */
    public WonderlandSessionListener(ClientSession session) {
        DataManager dm = AppContext.getDataManager();
        sessionRef = dm.createReference(session);
       
        if (logger.isLoggable(Level.FINE)) {
            logger.finest("New session listener for " + session.getName());
        }
       
        // initialize maps
        handlers = new TreeMap<Short, ClientHandlerRef>();
        senders = new TreeMap<Short, WonderlandClientSenderImpl>();

        // create a binding for ourself in the datastore.  This binding
        // is used by inner classes to securely complete operations on this
        // listener
        dm.setBinding(getBindingName(), this);

        // add internal handler
        ClientHandlerRef internalRef = getHandlerStore().getHandlerRef(
                    SessionInternalConnectionType.SESSION_INTERNAL_CLIENT_TYPE);
        ((SessionInternalConnectionHandler) internalRef.get()).setListener(this);
View Full Code Here

     * Initialize the session listener
     */
    public static void initialize() {
        logger.fine("Initialize WonderlandSessionListener");
       
        DataManager dm = AppContext.getDataManager();
       
        // create store for registered handlers
        dm.setBinding(HandlerStore.DS_KEY, new HandlerStore());
   
        // register the internal handler
        SessionInternalConnectionHandler internal = new SessionInternalConnectionHandler();
        registerClientHandler(internal);
    }
View Full Code Here

     * Create a new instance of WonderlandSessionListener for the given
     * session
     * @param session the session connected to this listener
     */
    public ProtocolSessionListener(ClientSession session) {
        DataManager dm = AppContext.getDataManager();
        sessionRef = dm.createReference(session);
    }
View Full Code Here

   
    /**
     * Initialize the session listener
     */
    public static void initialize() {
        DataManager dm = AppContext.getDataManager();
       
        // create map from protocols to clients
        dm.setBinding(ProtocolClientMap.DS_KEY, new ProtocolClientMap());
    }
View Full Code Here

    protected void recordConnect(CommunicationsProtocol protocol,
                                 ClientSession session)
    {
        ProtocolClientMap pcm = getProtocolClientMap();
       
        DataManager dm = AppContext.getDataManager();
        dm.markForUpdate(pcm);
       
        pcm.add(protocol, session);
    }
View Full Code Here

    protected void recordDisconnect(CommunicationsProtocol protocol,
                                    ManagedReference<ClientSession> sessionRef)
    {
        ProtocolClientMap pcm = getProtocolClientMap();
       
        DataManager dm = AppContext.getDataManager();
        dm.markForUpdate(pcm);
       
        pcm.remove(protocol, sessionRef);
    }
View Full Code Here

         * Add a session to a communications protocol
         * @param protocol the communications protocol
         * @param session the client session associated with the given protocol
         */
        public void add(CommunicationsProtocol protocol, ClientSession session) {
            DataManager dm = AppContext.getDataManager();
                               
            // Add a reference to this client in the set of clients for
            // the given protocol.  If the set does not exist, then
            // create it.
            ManagedReference<ProtocolClientSet> ref = clientMap.get(protocol);
            if (ref == null) {
                ProtocolClientSet sessions = new ProtocolClientSet();
                ref = dm.createReference(sessions);
                clientMap.put(protocol, ref);
            }
           
            ManagedReference<ClientSession> sessionRef = dm.createReference(session);
           
            ProtocolClientSet sessions = ref.getForUpdate();
            sessions.add(sessionRef);
       
            // add a reference to the protocol from this client's session
View Full Code Here

         * @param session the session to get
         * @return the protocol in use by that session, or null if the
         * sessionId does not exist
         */
        public CommunicationsProtocol get(ClientSession session) {
            DataManager dm = AppContext.getDataManager();
            ManagedReference sessionRef = dm.createReference(session);
           
            return protocolMap.get(sessionRef);
        }
View Full Code Here

    public boolean offer(E o) {
  if (o == null) {
      throw new NullPointerException("null element");
  }
  Entry<E> entry = new Entry<E>(o);
  DataManager dataManager = AppContext.getDataManager();
  dataManager.markForUpdate(this);
  ManagedReference<Entry<E>> entryRef =
      dataManager.createReference(entry);
  if (tailRef == null) {
      headRef = entryRef;
            tailRef = entryRef;
  } else {
      Entry<E> tail = tailRef.getForUpdate();
View Full Code Here

TOP

Related Classes of com.sun.sgs.app.DataManager

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.