public void setSocketFactory(SocketFactory factory) { ProtocolStack stack=getProtocolStack(); Protocol prot=stack != null? stack.getTopProtocol() : null; if(prot != null) prot.setSocketFactory(factory); }
protected final void handlePingRequest(Channel channel, InputStream stream) throws Exception { OpenshiftPing handler = (OpenshiftPing) channel.getProtocolStack().findProtocol(OpenshiftPing.class); handler.handlePingRequest(stream); } }
/** * Creates a new service instance using the supplied JGroups channel. * <p> * Note that the channel is expected to have been initialized and the CENTRAL_LOCK protocol added. * </p> * * @param channel a {@link Channel} instance; may not be null * @param lockTimeoutMillis the number of millis to wait before timing out when attempting to obtain a lock */ public JGroupsLockingService(Channel channel, long lockTimeoutMillis) { super(lockTimeoutMillis); ProtocolStack protocolStack = channel.getProtocolStack(); Protocol centralLock = protocolStack.findProtocol(CENTRAL_LOCK.class); if (centralLock == null) { throw new IllegalArgumentException("JGroups protocol stack does not contain a CENTRAL_LOCK protocol..."); } this.lockService = new LockService(channel); }
public void setSocketFactory(SocketFactory factory) { ProtocolStack stack=getProtocolStack(); Protocol prot=stack != null? stack.getTopProtocol() : null; if(prot != null) prot.setSocketFactory(factory); }
/** * Creates a new service instance using the supplied JGroups channel. * <p> * Note that the channel is expected to have been initialized and the CENTRAL_LOCK protocol added. * </p> * * @param channel a {@link Channel} instance; may not be null * @param lockTimeoutMillis the number of millis to wait before timing out when attempting to obtain a lock */ public JGroupsLockingService(Channel channel, long lockTimeoutMillis) { super(lockTimeoutMillis); ProtocolStack protocolStack = channel.getProtocolStack(); Protocol centralLock = protocolStack.findProtocol(CENTRAL_LOCK.class); if (centralLock == null) { throw new IllegalArgumentException("JGroups protocol stack does not contain a CENTRAL_LOCK protocol..."); } this.lockService = new LockService(channel); }
protected void initializeChannel(Channel channel) { // turn off local message reception channel.setDiscardOwnMessages(true); TP transport = channel.getProtocolStack().getTransport(); // Replace the default thread pool transport.setDefaultThreadPool(executor); for (Protocol protocol : channel.getProtocolStack().getProtocols()) { if (protocol instanceof GMS) { ((GMS) protocol).setPrintLocalAddr(printLocalAddress); } } }
@Override public synchronized boolean shutdown() { if (super.shutdown()) { String mainChannelName = mainChannel.getName(); List<String> forksForChannel = FORK_STACKS_BY_CHANNEL_NAME.get(mainChannelName); if (forksForChannel != null) { forksForChannel.remove(clusterName); if (forksForChannel.isEmpty()) { FORK_STACKS_BY_CHANNEL_NAME.remove(mainChannelName); Protocol removed = this.mainChannel.getProtocolStack().removeProtocol(FORK.class); if (removed != null) { LOGGER.debug("FORK protocol removed from original channel stack for channel {0}", mainChannelName); } else { LOGGER.debug("FORK protocol not found in original channel stack for channel {0}", mainChannelName); } } } return true; } return false; } }
@Override public synchronized boolean shutdown() { if (super.shutdown()) { String mainChannelName = mainChannel.getName(); List<String> forksForChannel = FORK_STACKS_BY_CHANNEL_NAME.get(mainChannelName); if (forksForChannel != null) { forksForChannel.remove(clusterName); if (forksForChannel.isEmpty()) { FORK_STACKS_BY_CHANNEL_NAME.remove(mainChannelName); Protocol removed = this.mainChannel.getProtocolStack().removeProtocol(FORK.class); if (removed != null) { LOGGER.debug("FORK protocol removed from original channel stack for channel {0}", mainChannelName); } else { LOGGER.debug("FORK protocol not found in original channel stack for channel {0}", mainChannelName); } } } return true; } return false; } }
logger.debug("JGROUPS PROTOCOL: " + clusterChannel.getProtocolStack().printProtocolSpecAsXML());
@Override protected void init() { try { ProtocolStack stack = mainChannel.getProtocolStack(); Protocol topProtocol = stack.getTopProtocol(); String forkStackId = this.clusterName;
@Override protected void init() { try { ProtocolStack stack = mainChannel.getProtocolStack(); Protocol topProtocol = stack.getTopProtocol(); String forkStackId = this.clusterName;
@Override protected void init() { try { if (this.channel == null) { this.channel = newChannel(jgroupsConfig); } ProtocolStack protocolStack = channel.getProtocolStack(); Protocol centralLock = protocolStack.findProtocol(CENTRAL_LOCK.class); if (centralLock == null) { // add the locking protocol CENTRAL_LOCK lockingProtocol = new CENTRAL_LOCK(); // we have to call init because the channel has already been created lockingProtocol.init(); protocolStack.addProtocol(lockingProtocol); } // Add a listener through which we'll know what's going on within the cluster ... this.channel.addChannelListener(listener); // Set the receiver through which we'll receive all of the changes ... this.channel.setReceiver(receiver); // Now connect to the cluster ... this.channel.connect(clusterName); } catch (Exception e) { throw new RuntimeException(e); } }
try { List<Protocol> protocols = channel.getProtocolStack().getProtocols(); Collections.reverse(protocols); ProtocolStack stack = new ProtocolStack();
@Override protected void init() { try { if (this.channel == null) { this.channel = newChannel(jgroupsConfig); } ProtocolStack protocolStack = channel.getProtocolStack(); Protocol centralLock = protocolStack.findProtocol(CENTRAL_LOCK.class); if (centralLock == null) { // add the locking protocol CENTRAL_LOCK lockingProtocol = new CENTRAL_LOCK(); // we have to call init because the channel has already been created lockingProtocol.init(); protocolStack.addProtocol(lockingProtocol); } // Add a listener through which we'll know what's going on within the cluster ... this.channel.addChannelListener(listener); // Set the receiver through which we'll receive all of the changes ... this.channel.setReceiver(receiver); // Now connect to the cluster ... this.channel.connect(clusterName); } catch (Exception e) { throw new RuntimeException(e); } }
@Override public void start(StartContext context) throws StartException { ChannelFactory factory = this.factory.getValue(); try { this.channel = factory.createChannel(this.id); this.channel.addChannelListener(this); // Don't connect the channel here // This will be done by Infinispan (see AS7-5904) } catch (Exception e) { throw new StartException(e); } if (ROOT_LOGGER.isTraceEnabled()) { String output = this.channel.getProtocolStack().printProtocolSpec(true); ROOT_LOGGER.tracef("JGroups channel named %s created with configuration:\n %s", this.id, output); } }