public final void start() throws Exception { if(request_handler == null) { request_handler=new Thread(this, "ReplicatedTree.RequestHandler thread"); request_handler.setDaemon(true); request_handler.start(); } adapter=new PullPushAdapter(channel, this, this); adapter.setListener(this); boolean rc=channel.getState(null, state_fetch_timeout); if(log.isInfoEnabled()) { if(rc) log.info("state was retrieved successfully"); else log.info("state could not be retrieved (first member)"); } }
channel.connect(channelName); new PullPushAdapter(channel, this, this); myAddr = channel.getLocalAddress();
public ReplicatedHashtable(JChannel channel, StateTransferListener l, long state_timeout) throws ChannelClosedException, ChannelNotConnectedException { this.channel=channel; this.adapter=new PullPushAdapter(channel, this, this); this.adapter.setListener(this); if(l != null) addStateTransferListener(l); getInitState(channel, state_timeout); // boolean rc=channel.getState(null, state_timeout); // if(rc) // if(log.isInfoEnabled()) log.info("state was retrieved successfully"); // else // if(log.isInfoEnabled()) log.info("state could not be retrieved (first member)"); }
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); } }
/** * 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); } }
new PullPushAdapter(channel, this); my_addr=channel.getLocalAddress(); if(my_addr != null)
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); } }
System.out.println("Connecting to " + group_name); channel.connect(group_name); ad=new PullPushAdapter(channel, this, this); channel.getState(null, 5000);