001    /**
002     * Copyright (c) 2000-2013 Liferay, Inc. All rights reserved.
003     *
004     * The contents of this file are subject to the terms of the Liferay Enterprise
005     * Subscription License ("License"). You may not use this file except in
006     * compliance with the License. You can obtain a copy of the License by
007     * contacting Liferay, Inc. See the License for the specific language governing
008     * permissions and limitations under the License, including but not limited to
009     * distribution rights of the Software.
010     *
011     *
012     *
013     */
014    
015    package com.liferay.portal.cluster;
016    
017    import com.liferay.portal.kernel.log.Log;
018    import com.liferay.portal.kernel.log.LogFactoryUtil;
019    
020    import org.jgroups.Address;
021    import org.jgroups.Message;
022    import org.jgroups.Receiver;
023    import org.jgroups.View;
024    
025    /**
026     * @author Tina Tian
027     */
028    public class BaseReceiver implements Receiver {
029    
030            @Override
031            public void block() {
032            }
033    
034            @Override
035            public byte[] getState() {
036                    return null;
037            }
038    
039            public View getView() {
040                    return view;
041            }
042    
043            @Override
044            public void receive(Message message) {
045            }
046    
047            @Override
048            public void setState(byte[] state) {
049            }
050    
051            @Override
052            public void suspect(Address address) {
053            }
054    
055            @Override
056            public void viewAccepted(View view) {
057                    if (_log.isInfoEnabled()) {
058                            _log.info("Accepted view " + view);
059                    }
060    
061                    this.view = view;
062            }
063    
064            protected volatile View view;
065    
066            private static Log _log = LogFactoryUtil.getLog(BaseReceiver.class);
067    
068    }