Package com.sun.sgs.app

Examples of com.sun.sgs.app.ChannelManager


        sessionRef = dataMgr.createReference(session);
        sessionName = session.getName();
       
        // Join the session to all channels.  We obtain the channel
        // in two different ways, by reference and by name.
        ChannelManager channelMgr = AppContext.getChannelManager();
       
        // We were passed a reference to the first channel.
        channel1.get().join(session);
       
        // We look up the second channel by name.
        Channel channel2 = channelMgr.getChannel(HelloChannels.CHANNEL_2_NAME);
        channel2.join(session);
    }
View Full Code Here


     * <p>
     * Creates the channels.  Channels persist across server restarts,
     * so they only need to be created here in {@code initialize}.
     */
    public void initialize(Properties props) {
        ChannelManager channelMgr = AppContext.getChannelManager();
       
        // Create and keep a reference to the first channel.
        Channel c1 = channelMgr.createChannel(CHANNEL_1_NAME,
                                              null,
                                              Delivery.RELIABLE);
        channel1 = AppContext.getDataManager().createReference(c1);
       
        // We don't keep a reference to the second channel, to demonstrate
        // looking it up by name when needed.  Also, this channel uses a
        // {@link ChannelListener} to filter messages.
        channelMgr.createChannel(CHANNEL_2_NAME,
                                 new HelloChannelsChannelListener(),
                                 Delivery.RELIABLE);
    }
View Full Code Here

     * Open the channel for this component. 
     */
    protected void openChannel() {
        CellMO cell = cellRef.get();

        ChannelManager cm = AppContext.getChannelManager();
        Channel cellChannel = cm.createChannel("Cell "+cell.getCellID().toString(),
                                               null,
                                               Delivery.RELIABLE);

        DataManager dm = AppContext.getDataManager();
        cellChannelRef = dm.createReference(cellChannel);
View Full Code Here

                assignID = SessionInternalConnectionType.SESSION_INTERNAL_CLIENT_ID;
            }
           
            // create a ClientSessionSet and channel
            DataManager dm = AppContext.getDataManager();
            ChannelManager cm = AppContext.getChannelManager();
           
            ClientSessionSet sessions = new ClientSessionSet();
            String channelName = handler.getConnectionType().toString() +
                                 "(" + String.valueOf(assignID) + ")";
            Channel channel = cm.createChannel(channelName,
                                               null,
                                               Delivery.RELIABLE);

            // mark ourself for udate
            dm.markForUpdate(this);
View Full Code Here

        // pre-fetch the three standard managers...if any of them isn't
        // present then we're running without an application and with a
        // sub-set of services, so just set that manager to null

        ChannelManager cm;
        try {
            cm = managerComponents.getComponent(ChannelManager.class);
        } catch (MissingResourceException mre) {
            cm = null;
        }
View Full Code Here

        sessionRef = dataMgr.createReference(session);
        sessionName = session.getName();
       
        // Join the session to all channels.  We obtain the channel
        // in two different ways, by reference and by name.
        ChannelManager channelMgr = AppContext.getChannelManager();
       
        // We were passed a reference to the first channel.
        channel1.get().join(session);
       
        // We look up the second channel by name.
        Channel channel2 = channelMgr.getChannel(HelloChannels.CHANNEL_2_NAME);
        channel2.join(session);
    }
View Full Code Here

     * <p>
     * Creates the channels.  Channels persist across server restarts,
     * so they only need to be created here in {@code initialize}.
     */
    public void initialize(Properties props) {
        ChannelManager channelMgr = AppContext.getChannelManager();
       
        // Create and keep a reference to the first channel.
        Channel c1 = channelMgr.createChannel(CHANNEL_1_NAME,
                                              null,
                                              Delivery.RELIABLE);
        channel1 = AppContext.getDataManager().createReference(c1);
       
        // We don't keep a reference to the second channel, to demonstrate
        // looking it up by name when needed.  Also, this channel uses a
        // {@link ChannelListener} to filter messages.
        channelMgr.createChannel(CHANNEL_2_NAME,
                                 new HelloChannelsChannelListener(),
                                 Delivery.RELIABLE);
    }
View Full Code Here

   
    @Test
    public void testGetChannelManagerAfterInit() {
        initStableAppContext();
        InternalContext.setManagerLocator(managerLocator);
        ChannelManager c = AppContext.getChannelManager();
       
        Assert.assertSame(c, channelManager);
    }
View Full Code Here

    @Test
    public void testGetChannelManagerWithUnstableManagerLocator() {
        initUnstableAppContext();
        InternalContext.setManagerLocator(managerLocator);
       
        ChannelManager c1 = AppContext.getChannelManager();
        ChannelManager c2 = AppContext.getChannelManager();
       
        Assert.assertSame(c1, channelManager);
        Assert.assertNull(c2);
    }
View Full Code Here

        // pre-fetch the three standard managers...if any of them isn't
        // present then we're running without an application and with a
        // sub-set of services, so just set that manager to null

        ChannelManager cm;
        try {
            cm = managerComponents.getComponent(ChannelManager.class);
        } catch (MissingResourceException mre) {
            cm = null;
        }
View Full Code Here

TOP

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

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.