public void start() throws Exception { channel.connect(bus_name); }
public JGroupsSpace(Identity serverId, Channel channel, HashFunction hashFunction, int substanceSize) throws ChannelException { this.channel = channel; this.serverId = serverId; this.substanceSize = substanceSize; this.hashFunction = hashFunction; log.info("Creating space[" + DEFAULT_SPACE_NAME + "] ... "); this.channel.connect(DEFAULT_SPACE_NAME); log.info("Space[" + DEFAULT_SPACE_NAME + "] created."); }
/** * {@inheritDoc} */ public void startup() throws Throwable { disp = createRpcDispatcher(); if (clusterName == null) clusterName = "jca"; channel.connect(clusterName); }
void connect() throws ChannelException, ChannelClosedException { if (channel != null && !channel.isConnected()) channel.connect(channelName); }
public DrawRepl() { colors.put(new Integer(1), Color.white); colors.put(new Integer(2), Color.black); colors.put(new Integer(3), Color.red); colors.put(new Integer(4), Color.orange); colors.put(new Integer(5), Color.green); colors.put(new Integer(6), Color.magenta); colors.put(new Integer(7), Color.cyan); colors.put(new Integer(8), Color.blue); mythread=new Thread(this); try { channel=new JChannel(); dispatcher=new RpcDispatcher(channel, null, null, this); channel.connect(groupname); } catch(Exception e) { System.err.println(e); System.exit(0); } }
public void start(long timeout) throws Exception { if(channel != null) // already started return; channel=new JChannel(channel_properties); disp=new RpcDispatcher(channel, this, this, this); channel.connect(groupname); rc=channel.getState(null, timeout); if(rc) { if(log.isInfoEnabled()) log.info("state was retrieved successfully"); } else if(log.isInfoEnabled()) log.info("state could not be retrieved (must be first member in group)"); }
public Void run() throws Exception { channel = createChannel(); dispatcher = new MessageDispatcher(channel, null, AbstractRPCService.this, AbstractRPCService.this); channel.connect(clusterName); return null; } });
/** * {@inheritDoc} * @see net.sf.hajdbc.Lifecycle#start() */ @Override public void start() throws SQLException { Channel channel = this.dispatcher.getChannel(); channel.setDiscardOwnMessages(false); // Connect and fetch state try { channel.connect(this.id, null, 0); } catch (Exception e) { throw new SQLException(e); } }
public void start() { try { channel=new JChannel(props); disp=new RpcDispatcher(channel, this, this, this); channel.connect(channel_name); System.out.println("\nQuote Server started at " + new Date()); System.out.println("Joined channel '" + channel_name + "' (" + channel.getView().size() + " members)"); channel.getState(null, 0); System.out.println("Ready to serve requests"); } catch(Exception e) { log.error("QuoteServer.start() : " + e); System.exit(-1); } }
public void init() { System.out.println("INIT"); setLayout(new BorderLayout()); String tmp_props=getParameter("properties"); if(tmp_props != null) { System.out.println("Setting parameters " + tmp_props); props=tmp_props; } try { channel=factory.createChannel(props); showStatus("Connecting to group " + groupname); channel.connect(groupname); } catch(Exception e) { log.error(e); } receiver=new Thread(this, "DrawThread"); receiver.start(); go(); }
public void start(final long timeout) throws Exception { if(channel != null) { return; } channel = new JChannel(channel_properties); // Set the auto-reconnect option for enabling a node to leave and re-join the cluster channel.setOpt(Channel.AUTO_RECONNECT, true); disp = new RpcDispatcher(channel, this, this, this); channel.connect(groupname); rc = channel.getState(null, timeout); if(rc) { if(log.isInfoEnabled()) { log.info("state was retrieved successfully"); } } else if(log.isInfoEnabled()) { log.info("state could not be retrieved (must be first member in group)"); } }
public QuoteClient() { super(); try { channel=new JChannel(props); channel.setOpt(Channel.LOCAL, Boolean.FALSE); disp=new RpcDispatcher(channel, null, this, this); channel.connect(channel_name); } catch(Exception e) { System.err.println("QuoteClient(): " + e); } addWindowListener(this); }
public void start(String props, boolean use_additional_data) throws Exception { channel=new JChannel(props); channel.setOpt(Channel.AUTO_RECONNECT, Boolean.TRUE); if(use_additional_data) { HashMap m=new HashMap(); m.put("additional_data", "bela".getBytes()); channel.down(new Event(Event.CONFIG, m)); } channel.connect("ViewDemo"); new PullPushAdapter(channel, this); while(true) { Util.sleep(10000); } }
/** * Initialize the JGROUPS channel and connect them to the group. * * @throws Exception */ private void startChannels() throws Exception { this.log.start(); // start the discovery HashMap and wait the synchronization of its data this.discoveryHashMapChannel.connect(this.domainConfiguration .getDomain()); this.containerAddressesHashMap.start(LATENTY_MAX_TIME); this.discoveryCoordinationChannel.connect(this.domainConfiguration .getDomain()); if (this.jndiHashMapChannel != null) { // start the JNDI HashMap and wait the synchronization of its data this.jndiHashMapChannel.connect(this.domainConfiguration .getDomain()); this.jndiHashMap.start(LATENTY_MAX_TIME); } this.log.end(); }
private void start(String props, String stack_name, boolean state) throws Exception { factory=new JChannelFactory(); factory.setMultiplexerConfig(props); final Channel ch1, ch2; ch1=factory.createMultiplexerChannel(stack_name, "id-1"); Draw draw1=new Draw(ch1, state, 5000); ch1.connect("bela"); ch2=factory.createMultiplexerChannel(stack_name, "id-2"); Draw draw2=new Draw(ch2, state, 5000); ch2.connect("ban"); draw1.go(); draw2.go(); } }
/** * Creates a ReplicatedHashtable * @param groupname The name of the group to join * @param factory The ChannelFactory which will be used to create a channel * @param properties The property string to be used to define the channel * @param state_timeout The time to wait until state is retrieved in milliseconds. A value of 0 means wait forever. */ public ReplicatedHashtable(String groupname, ChannelFactory factory, StateTransferListener l, String properties, long state_timeout) { if(l != null) addStateTransferListener(l); try { channel=factory != null ? factory.createChannel(properties) : new JChannel(properties); channel.connect(groupname); adapter=new PullPushAdapter(channel, this, this); adapter.setListener(this); getInitState(channel, state_timeout); } catch(Exception e) { if(log.isErrorEnabled()) log.error("exception=" + e); } }
public void start() throws Exception { Channel channel = channelRef.getValue(); log.info( "Connect to " + clusterName ); channel.connect( clusterName ); this.service = new CoreGroupCommunicationService( SCOPE_ID, channelRef, moduleLoaderRef ); this.service.setAllowSynchronousMembershipNotifications( true ); this.service.registerGroupMembershipListener( this ); this.service.setChannel( channel ); this.service.start(); allMembersChanged( this.service.getClusterNodes() ); }
public void openChannel(String name, String configuration, MessageReceiver receiver) throws ZoneChannelException { if (channels.containsKey(name)) { throw new ZoneChannelException("Channel already open:" + name); } try { Channel channel; if (configuration != null) { channel = new JChannel(configuration); } else if (channelConfig != null) { channel = new JChannel(channelConfig); } else { channel = new JChannel(); } initializeChannel(channel); channels.put(name, channel); DelegatingReceiver delegatingReceiver = new DelegatingReceiver(channel, receiver, helper, monitor); channel.setReceiver(delegatingReceiver); channel.connect(info.getDomain().getAuthority() + ":" + name); } catch (Exception e) { throw new ZoneChannelException(e); } }
protected void startupExternal() throws Exception { // TODO: need to do more research to figure out the best default transport // settings // to avoid fragmentation, etc. // if config file is set, use it, otherwise use a default // set of properties, trying to configure multicast address and port if (configURL != null) { channel = new JChannel(configURL); } else { String configString = buildConfigString(); channel = new JChannel(configString); } // Important - discard messages from self channel.setOpt(Channel.LOCAL, Boolean.FALSE); channel.connect(externalSubject); if (receivesExternalEvents()) { adapter = new PullPushAdapter(channel, this); } }
protected void startupExternal() throws Exception { // TODO: need to do more research to figure out the best default transport // settings // to avoid fragmentation, etc. // if config file is set, use it, otherwise use a default // set of properties, trying to configure multicast address and port if (configURL != null) { channel = new JChannel(configURL); } else { String configString = buildConfigString(); channel = new JChannel(configString); } // Important - discard messages from self channel.setOpt(Channel.LOCAL, Boolean.FALSE); channel.connect(externalSubject); if (receivesExternalEvents()) { adapter = new PullPushAdapter(channel, this); } }