Package org.jgroups.mux

Examples of org.jgroups.mux.Multiplexer$BlockOkCollector


            throw new IllegalArgumentException("stack name and service ID have to be non null");
       
        if(stack_name.length()==0 || id.length() == 0)
            throw new IllegalArgumentException("stack name and service ID have to non empty strings");
              
        Multiplexer mux = null;
        synchronized (channels) {
            if (!channels.containsKey(stack_name)) {
                JChannel ch = new JChannel(getConfig(stack_name));
                registerChannel(ch, stack_name);
                mux = new Multiplexer(ch);
                channels.put(stack_name, mux);
            } else {
                mux = channels.get(stack_name);
            }
        }
        if(register_for_state_transfer)
            mux.registerForStateTransfer(id, substate_id);
       
        Channel c = mux.createMuxChannel(id, stack_name);
        c.addChannelListener(new MuxFactoryChannelListener());
        return c;
    }
View Full Code Here


     * @param id
     *            service id
     * @return true if such MuxChannel exists, false otherwise
     */
   public boolean hasMuxChannel(String stack_name, String id) {
    Multiplexer entry = channels.get(stack_name);
    if (entry != null) {
      Set<String> services = entry.getServiceIds();
      return (services != null && services.contains(id));
    }
    return false;
  }
View Full Code Here

    @ManagedOperation
    public void destroy() {       
        synchronized (channels) {
            for(Map.Entry<String,Multiplexer> entry: channels.entrySet()){               
                Multiplexer m = entry.getValue();
                if(m != null){
                    m.closeAll();
                    m.close();
                }          
            }   
        }       
        unregister(domain + ":*");       
        channels.clear();
View Full Code Here

    @ManagedOperation
    public String dumpChannels() {
        StringBuilder sb = new StringBuilder();
        synchronized (channels) {
            for (Map.Entry<String, Multiplexer> entry : channels.entrySet()) {               
                Multiplexer m = entry.getValue();
                sb.append(entry.getKey()).append(": ").append(m.getServiceIds()).append("\n");
            }
        }
        return sb.toString();
    }
View Full Code Here

   
    private class MuxFactoryChannelListener extends ChannelListenerAdapter{

        public void channelClosed(Channel channel) {
            MuxChannel mch = (MuxChannel)channel;
            Multiplexer multiplexer = mch.getMultiplexer();
            boolean all_closed = multiplexer.close();
            if(all_closed) {
                channels.remove(mch.getStackName());
                unregister(domain + ":*,cluster=" + mch.getStackName());
            }
        }           
View Full Code Here

            throw new IllegalArgumentException("stack name and service ID have to be non null");
       
        if(stack_name.length()==0 || id.length() == 0)
            throw new IllegalArgumentException("stack name and service ID have to non empty strings");
              
        Multiplexer mux = null;
        synchronized (channels) {
            if (!channels.containsKey(stack_name)) {
                JChannel ch = new JChannel(getConfig(stack_name));
                registerChannel(ch, stack_name);
                mux = new Multiplexer(ch);
                channels.put(stack_name, mux);
            } else {
                mux = channels.get(stack_name);
            }
        }
        if(register_for_state_transfer)
            mux.registerForStateTransfer(id, substate_id);
       
        Channel c = mux.createMuxChannel(id, stack_name);
        c.addChannelListener(new MuxFactoryChannelListener());
        return c;
    }
View Full Code Here

     * @param id
     *            service id
     * @return true if such MuxChannel exists, false otherwise
     */
   public boolean hasMuxChannel(String stack_name, String id) {
    Multiplexer entry = channels.get(stack_name);
    if (entry != null) {
      Set<String> services = entry.getServiceIds();
      return (services != null && services.contains(id));
    }
    return false;
  }
View Full Code Here

    }

    public void destroy() {       
        synchronized (channels) {
            for(Map.Entry<String,Multiplexer> entry: channels.entrySet()){               
                Multiplexer m = entry.getValue();
                if(m != null){
                    m.closeAll();
                    m.close();
                }          
            }   
        }       
        unregister(domain + ":*");       
        channels.clear();
View Full Code Here

    public String dumpChannels() {
        StringBuilder sb = new StringBuilder();
        synchronized (channels) {
            for (Map.Entry<String, Multiplexer> entry : channels.entrySet()) {               
                Multiplexer m = entry.getValue();
                sb.append(entry.getKey()).append(": ").append(m.getServiceIds()).append("\n");
            }
        }
        return sb.toString();
    }
View Full Code Here

    private class MuxFactoryChannelListener extends ChannelListenerAdapter{

        public void channelClosed(Channel channel) {
            MuxChannel mch = (MuxChannel)channel;
            Multiplexer multiplexer = mch.getMultiplexer();
            boolean all_closed = multiplexer.close();
            if(all_closed) {
                channels.remove(mch.getStackName());
                unregister(domain + ":*,cluster=" + mch.getStackName());
            }
        }           
View Full Code Here

TOP

Related Classes of org.jgroups.mux.Multiplexer$BlockOkCollector

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.