![JAR search and dependency download from the Maven repository](/logo.png)
org.hibernate.search.backend.jgroups.impl.DispatchMessageSender Maven / Gradle / Ivy
/*
* Hibernate Search, full-text search for your domain model
*
* License: GNU Lesser General Public License (LGPL), version 2.1 or later
* See the lgpl.txt file in the root directory or .
*/
package org.hibernate.search.backend.jgroups.impl;
import java.net.URL;
import java.util.Properties;
import org.hibernate.search.backend.jgroups.logging.impl.Log;
import org.hibernate.search.engine.service.spi.ServiceManager;
import org.hibernate.search.engine.service.spi.Startable;
import org.hibernate.search.engine.service.spi.Stoppable;
import org.hibernate.search.spi.BuildContext;
import org.hibernate.search.util.configuration.impl.ConfigurationParseHelper;
import org.hibernate.search.util.logging.impl.LoggerFactory;
import org.jgroups.Address;
import org.jgroups.JChannel;
import org.jgroups.Message;
import org.jgroups.MessageListener;
import org.jgroups.UpHandler;
import org.jgroups.View;
import org.jgroups.blocks.MessageDispatcher;
import org.jgroups.blocks.RequestOptions;
import org.jgroups.blocks.mux.MuxMessageDispatcher;
import org.jgroups.blocks.mux.Muxer;
import org.jgroups.util.Rsp;
import org.jgroups.util.RspList;
/**
* We use the MessageDispatcher instead of the JChannel to be able to use blocking
* operations (optionally) without having to rely on the RSVP protocol
* being configured on the stack.
*
* @author Lukasz Moren
* @author Sanne Grinovero (C) 2012 Red Hat Inc.
* @author Ales Justin
* @author Hardy Ferentschik
*/
public final class DispatchMessageSender implements MessageSenderService, Startable, Stoppable {
private static final Log log = LoggerFactory.make( Log.class );
public static final String JGROUPS_PREFIX = "hibernate.search.services.jgroups.";
public static final String CONFIGURATION_FILE = JGROUPS_PREFIX + "configurationFile";
public static final String CLUSTER_NAME = JGROUPS_PREFIX + "clusterName";
public static final String CHANNEL_INJECT = JGROUPS_PREFIX + "providedChannel";
public static final String CLASSLOADER = JGROUPS_PREFIX + "classloader";
public static final String MUX_ID = JGROUPS_PREFIX + "mux_id";
private static final String DEFAULT_JGROUPS_CONFIGURATION_FILE = "flush-udp.xml";
private static final String DEFAULT_CLUSTER_NAME = "Hibernate Search Cluster";
private ChannelContainer channelContainer;
private ServiceManager serviceManager;
private MessageDispatcher dispatcher;
@Override
public Address getAddress() {
return channelContainer.getChannel().getAddress();
}
@Override
public View getView() {
return channelContainer.getChannel().getView();
}
@Override
public void send(final Message message, final boolean synchronous, final long timeout) throws Exception {
final RequestOptions options = synchronous ? RequestOptions.SYNC() : RequestOptions.ASYNC();
options.setExclusionList( dispatcher.getChannel().getAddress() );
options.setTimeout( timeout );
RspList
© 2015 - 2025 Weber Informatics LLC | Privacy Policy